public ActionResult AddEquip() { QueryModal qm = new QueryModal(); SpeciatyManagment spm = new SpeciatyManagment(); qm.sps = spm.getsps(); return(View(qm)); }
//返回设备专业子类 public JsonResult EquipSp_Info(int sp_id) { SpeciatyManagment sm = new SpeciatyManagment(); List <Speciaty_Info> sp = sm.getsps_child(sp_id); List <object> sp_obj = new List <object>(); foreach (var item in sp) { object o = new { sp_Id = item.Specialty_Id, sp_Name = item.Specialty_Name }; sp_obj.Add(o); } return(Json(sp_obj.ToArray())); }
public string submitNewUser(string json1) { try { SpeciatyManagment SM = new SpeciatyManagment(); PersonManagment PM = new PersonManagment(); Person_Info newP = new Person_Info(); JObject item = (JObject)JsonConvert.DeserializeObject(json1); newP.Person_Name = item["UserName"].ToString(); /*0710添加*/ var pwd = item["UserPwd"].ToString(); MD5 md5 = new MD5CryptoServiceProvider(); byte[] result = md5.ComputeHash(System.Text.Encoding.Default.GetBytes(pwd.Trim())); newP.Person_Pwd = result; /*0710end*/ newP.Person_tel = item["UserTel"].ToString(); newP.Person_mail = item["UserMail"].ToString(); var equipArchiStr = item["UserEquipArchiSel"].ToString(); var roleStr = item["UserRole"].ToString(); var speciatyStr = item["UserSpeciatySel"].ToString(); var MenuStr = item["UserMenus"].ToString(); int Depart_id = Convert.ToInt32(item["UserDepartId"].ToString()); List <int> EquipArchiList = new List <int>(); if (equipArchiStr != "") { string[] s = equipArchiStr.Split(new char[] { ',' }); for (int i = 0; i < s.Length; i++) { EquipArchiList.Add(Convert.ToInt32(s[i])); } } /* List<int> SpeciatyList = new List<int>(); * if (speciatyStr != "") * { * string[] s = speciatyStr.Split(new char[] { ',' }); * for (int i = 0; i < s.Length; i++) * { SpeciatyList.Add(Convert.ToInt32(s[i])); } * }*/ List <int> SpeciatyList = new List <int>(); if (speciatyStr != "") { string[] s = speciatyStr.Split(new char[] { ',' }); for (int i = 0; i < s.Length; i++) { int id = Convert.ToInt16(s[i]); List <Speciaty_Info> r = SM.GetChildsspecialty(id); if (r == null) { if (SpeciatyList.Where(x => x == id).Count() == 0) { SpeciatyList.Add(Convert.ToInt32(s[i])); } } else { if (SpeciatyList.Where(x => x == id).Count() == 0) { SpeciatyList.Add(Convert.ToInt32(s[i])); } foreach (var t in r) { if (SpeciatyList.Where(x => x == t.Specialty_Id).Count() == 0) { SpeciatyList.Add(Convert.ToInt32(t.Specialty_Id)); } } } } } List <int> MenuList = new List <int>(); if (MenuStr != "") { string[] s1 = MenuStr.Split(new char[] { ',' }); for (int i = 0; i < s1.Length; i++) { MenuList.Add(Convert.ToInt32(s1[i])); } } List <int> RoleList = new List <int>(); if (roleStr != "") { string[] s2 = roleStr.Split(new char[] { ',' }); for (int i = 0; i < s2.Length; i++) { RoleList.Add(Convert.ToInt32(s2[i])); } } PM.Add_Person(newP, Depart_id, RoleList, EquipArchiList, SpeciatyList, MenuList); //保存基础信息 return("保存成功!"); } catch { return(""); }; }
public string submitUpdateUser(string json1) { try { SpeciatyManagment SM = new SpeciatyManagment(); PersonManagment PM = new PersonManagment(); Person_Info newP = new Person_Info(); JObject item = (JObject)JsonConvert.DeserializeObject(json1); newP.Person_Id = Convert.ToInt32(item["UserId"].ToString()); newP.Person_Name = item["UserName"].ToString(); newP.Person_tel = item["UserTel"].ToString(); newP.Person_mail = item["UserMail"].ToString(); var roleStr = item["UserRole"].ToString(); var speciatyStr = item["UserSpeciatySel"].ToString(); var MenuStr = item["UserMenus"].ToString(); var equipArchiStr = item["UserEquipArchiSel"].ToString(); int Depart_id = Convert.ToInt32(item["UserDepartId"].ToString()); List <int> EquipArchiList = new List <int>(); if (equipArchiStr != "") { string[] s = equipArchiStr.Split(new char[] { ',' }); for (int i = 0; i < s.Length; i++) { EquipArchiList.Add(Convert.ToInt32(s[i])); } } /* List<int> SpeciatyList = new List<int>(); * if (speciatyStr != "") * { * string[] s = speciatyStr.Split(new char[] { ',' }); * for (int i = 0; i < s.Length; i++) * { SpeciatyList.Add(Convert.ToInt32(s[i])); } * }*/ List <int> SpeciatyList = new List <int>(); if (speciatyStr != "") { string[] s = speciatyStr.Split(new char[] { ',' }); for (int i = 0; i < s.Length; i++) { int id = Convert.ToInt16(s[i]); List <Speciaty_Info> r = SM.GetChildsspecialty(id); if (r == null) { if (SpeciatyList.Where(x => x == id).Count() == 0) { SpeciatyList.Add(Convert.ToInt32(s[i])); } } else { if (SpeciatyList.Where(x => x == id).Count() == 0) { SpeciatyList.Add(Convert.ToInt32(s[i])); } foreach (var t in r) { if (SpeciatyList.Where(x => x == t.Specialty_Id).Count() == 0) { SpeciatyList.Add(Convert.ToInt32(t.Specialty_Id)); } } } } } List <int> MenuList = new List <int>(); if (MenuStr != "") { string[] s1 = MenuStr.Split(new char[] { ',' }); for (int i = 0; i < s1.Length; i++) { MenuList.Add(Convert.ToInt32(s1[i])); } } List <int> RoleList = new List <int>(); if (roleStr != "") { string[] s2 = roleStr.Split(new char[] { ',' }); for (int i = 0; i < s2.Length; i++) { RoleList.Add(Convert.ToInt32(s2[i])); } } PM.Update_Person(newP, Depart_id, RoleList, EquipArchiList, SpeciatyList, MenuList); //保存基础信息 return("用户信息修改成功!"); } catch { return(""); }; }