using dccdc.BLL; using dccdc.Models; using NetSDKCS; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Web; using System.Web.Mvc; using System.Web.Security; namespace dccdc.Controllers { public class AccessygsqController : Controller { public ActionResult AccessygsqResult() { return View(); } public string Accessygsq(String TrueName) { ViewBag.list = new List(); List al = new List(); var AccessygsqBll = new BLL.AccessygsqBll(); al = AccessygsqBll.GetAllList(TrueName); return Newtonsoft.Json.JsonConvert.SerializeObject(new { code = 0, msg = "success", al.Count, data = al }); } public ActionResult rysq(string ygid) { ViewBag.list = new List(); List extal = new BLL.AccessBll().GetYgDoorSq(ygid); List vmlist = new List(); foreach(var ext in extal) { accessVm vm = new accessVm(); vm.id = ext.id; vm.sbmc = ext.sbmc; vm.ygid = ygid; if(!string.IsNullOrEmpty(ext.UserName)) { vm.check = "checked"; } else { vm.check = ""; } vmlist.Add(vm); } return View(vmlist); } public ActionResult Updateryqx(YgsqModel model) { YgsqBLL ygsqbl = new BLL.YgsqBLL(); List al = new BLL.YgsqBLL().findId(model.ygid); if (al.Count > 0) { ygsqbl.Delete(model.ygid); } var f = false; YgsqModel ygsqModel = new YgsqModel(); string[] sbid = model.sbid.Split(','); for(int i = 0; i < sbid.Length; i++) { ygsqModel.sbid = sbid[i]; ygsqModel.ygid = model.ygid; f = ygsqbl.save(ygsqModel); } return Json(f ? new { State = 1, Message = "操作成功!" } : new { State = 0, Message = "操作失败!" }); } } }