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(""); }; }