public ActionResult WindowSaveClick(tblUserInfo model, string PanelID, string ParentVariable)//, string sSelAuthors, string sSetAuthors, string sOriginAuthors) { DirectResult result = new DirectResult(); result.Success = true; UserInfoManage userMan = new UserInfoManage(); //校验用户名和密码是否填写 if ((model.UserICode == null) || (model.UserICode == "") || (model.UserIPsd == "") || (model.UserIPsd == null)) { result.ErrorMessage = "用户名和密码不能为空!"; result.Success = false; return(result); } //校验如果用户名修改了,是否会有重复 Expression <Func <tblUserInfo, bool> > where = (c => c.UserICode == model.UserICode && c.DelFlag == false); List <tblUserInfo> list = userMan.GetRecord(where); if ((list != null) && (list.Count > 0)) { if (list[0].ID != model.ID) { result.ErrorMessage = "用户名已经存在,不能使用!"; result.Success = false; return(result); } } model.UserIPsd = userMan.GetSecretPass(model.UserIPsd); long lUserID = model.ID; if (model.UserIDutyIID == 0) { model.UserIDutyIID = null; } if (model.UserIDepartmentIID == 0) { model.UserIDepartmentIID = null; model.WholeDepartmentName = ""; } else { DepartmentInfoManage departmentMan = new DepartmentInfoManage(); model.WholeDepartmentName = departmentMan.GetWholeDepartmentName(Convert.ToInt64(model.UserIDepartmentIID)); } if (lUserID == 0) { lUserID = userMan.AddOneRecord(model); } else { userMan.SaveOneRecord(model); } if (lUserID == 0) { result.ErrorMessage = "保存出错!"; result.Success = false; return(result); } X.AddScript("var i = 0; var sSelAuthors = \"\"; while (i < App." + PanelID + "_NowRoleStore" + ".getCount()) { sSelAuthors = sSelAuthors + App." + PanelID + "_NowRoleStore" + ".getAt(i).get('ID') + \",\"; i++; } sSelAuthors = sSelAuthors.slice(0, sSelAuthors.length - 1);"); X.AddScript("App.direct.UserControl.WinUserMore_SaveAuthorsDirectMethod(" + lUserID + ",sSelAuthors, App." + PanelID + "_SetAuthorID" + ".getValue(),App." + PanelID + "_OriginAuthorIDs" + ".getValue(),\"" + PanelID + "\");"); return(result); }