/// <summary> /// 保存用户基本信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public JsonResult SaveAccountInfo(string entity, string departmentName) { JavaScriptSerializer serializer = new JavaScriptSerializer(); IntFactoryEntity.Users model = serializer.Deserialize <IntFactoryEntity.Users>(entity); bool flag = OrganizationBusiness.UpdateUserInfo(CurrentUser.UserID, model.Name, model.Jobs, model.Birthday, 0, model.DepartID, model.Email, model.MobilePhone, model.OfficePhone, CurrentUser.ClientID); JsonDictionary.Add("result", flag?1:0); if (flag) { CurrentUser.Name = model.Name; CurrentUser.Jobs = model.Jobs; CurrentUser.Birthday = model.Birthday; CurrentUser.Age = model.Age; if (CurrentUser.DepartID != model.DepartID) { CurrentUser.DepartID = model.DepartID; CurrentUser.Department = OrganizationBusiness.GetDepartmentByID(model.DepartID, CurrentUser.ClientID); } CurrentUser.Email = model.Email; CurrentUser.MobilePhone = model.MobilePhone; CurrentUser.OfficePhone = model.OfficePhone; Session["ClientManager"] = CurrentUser; } return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult UserLogin(string userName, string pwd) { int result = 0; Dictionary <string, object> resultObj = new Dictionary <string, object>(); YXERP.Common.PwdErrorUserEntity pwdErrorUser = null; if (Common.Common.CachePwdErrorUsers.ContainsKey(userName)) { pwdErrorUser = Common.Common.CachePwdErrorUsers[userName]; } if (pwdErrorUser == null || (pwdErrorUser.ErrorCount < 10 && pwdErrorUser.ForbidTime < DateTime.Now)) { string operateip = Common.Common.GetRequestIP(); IntFactoryEntity.Users model = IntFactoryBusiness.OrganizationBusiness.GetUserByUserName(userName, pwd, out result, operateip); if (model != null) { if (result == 1) { Dictionary <string, object> userObj = new Dictionary <string, object>(); string domainUrl = Request.Url.Scheme + "://" + Request.Url.Host; userObj.Add("userID", model.UserID); userObj.Add("clientID", model.ClientID); userObj.Add("name", model.Name); userObj.Add("avatar", domainUrl + model.Avatar); resultObj.Add("user", userObj); } } else { if (result == 3) { if (pwdErrorUser == null) { pwdErrorUser = new Common.PwdErrorUserEntity(); } else { if (pwdErrorUser.ErrorCount > 9) { pwdErrorUser.ErrorCount = 0; } } pwdErrorUser.ErrorCount += 1; if (pwdErrorUser.ErrorCount > 9) { pwdErrorUser.ForbidTime = DateTime.Now.AddHours(2); result = 2; } else { result = 3; resultObj.Add("errorCount", pwdErrorUser.ErrorCount); } Common.Common.CachePwdErrorUsers[userName] = pwdErrorUser; } } } else { int forbidTime = (int)(pwdErrorUser.ForbidTime - DateTime.Now).TotalMinutes; resultObj.Add("forbidTime", forbidTime); result = -1; } resultObj.Add("result", result); return(new JsonResult { Data = resultObj, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult FinishTask(string taskID, string userID, string agentID) { int result = 0; CurrentUser = OrganizationBusiness.GetUserByUserID(userID, agentID); TaskBusiness.FinishTask(taskID, CurrentUser.UserID, Common.Common.GetRequestIP(), CurrentUser.AgentID, CurrentUser.ClientID, out result); JsonDictionary.Add("result", result); return new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
public JsonResult UpdateTaskEndTime(string taskID, string endTime, string userID, string agentID) { int result = 0; DateTime? endDate = null; if (!string.IsNullOrEmpty(endTime)) endDate = DateTime.Parse(endTime); CurrentUser = OrganizationBusiness.GetUserByUserID(userID, agentID); TaskBusiness.UpdateTaskEndTime(taskID, endDate, CurrentUser.UserID, Common.Common.GetRequestIP(), CurrentUser.AgentID, CurrentUser.ClientID, out result); JsonDictionary.Add("result", result); return new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }