public ActionResult Index(string userName, string password) { LogicStatusInfo logicStatusInfo = new LogicStatusInfo(); LoginStatuses loginStatus = LoginStatuses.Successful; BusinessUser businessUser = null; if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(password)) { logicStatusInfo.IsSuccessful = false; logicStatusInfo.Message = "请必须输入账号和口令,谢谢!"; } else { businessUser = BusinessUserBLL.Login(userName, password, out loginStatus); if (loginStatus == LoginStatuses.Successful) { logicStatusInfo.IsSuccessful = true; } else { logicStatusInfo.IsSuccessful = false; logicStatusInfo.Message = loginStatus.ToString(); } } if (logicStatusInfo.IsSuccessful == true) { FormsAuthentication.RedirectFromLoginPage(userName, false); } return(View(logicStatusInfo)); }
public ActionResult UChangePassword(string userGuid, string passwordNew, string passwordNewConfirm, bool isOnlyPlaceHolder = true) { LogicStatusInfo logicStatusInfo = new LogicStatusInfo(); logicStatusInfo.IsSuccessful = BusinessUserBLL.ChangePassword(new Guid(userGuid), passwordNew); return(Json(logicStatusInfo)); }
public ActionResult ChangePassword(Guid userGuid, string passwordOld, string passwordNew, string passwordNewConfirm) { LogicStatusInfo logicStatusInfo = new LogicStatusInfo(); logicStatusInfo.IsSuccessful = BusinessUserBLL.ChangePassword(userGuid, passwordNew, passwordOld); PassCurrentUser(); return(View(logicStatusInfo)); }
public override EmployeeEntity Get(Guid modelID) { BusinessUser businessUser = BusinessUserBLL.Get(modelID); EmployeeEntity entity = Converter.InheritedEntityConvert <BusinessUser, EmployeeEntity>(businessUser); EmployeeEntity entityPartial = base.Get(modelID); entity = ReflectHelper.CopyMemberValue <EmployeeEntity, EmployeeEntity>(entityPartial, entity, true); return(entity); }
public override LaborEntity Get(Guid modelID, bool isForceUseNoCache) { BusinessUser businessUser = BusinessUserBLL.Get(modelID, isForceUseNoCache); LaborEntity entity = Converter.InheritedEntityConvert <BusinessUser, LaborEntity>(businessUser); LaborEntity entityPartial = base.Get(modelID, isForceUseNoCache); entity = ReflectHelper.CopyMemberValue <LaborEntity, LaborEntity>(entityPartial, entity, true); return(entity); }
public ActionResult UChangePassword(string userGuid, string userName = "", string returnUrl = StringHelper.Empty) { BusinessUser businessUser = BusinessUserBLL.Get(userGuid); if (string.IsNullOrWhiteSpace(userName)) { userName = businessUser.UserName; } this.ViewBag.ReturnUrl = returnUrl; return(View(businessUser)); }
public override bool Update(EmployeeEntity model) { bool isSuccessful = BusinessUserBLL.UpdateUser(model); if (isSuccessful == true) { isSuccessful = base.Update(model); } return(isSuccessful); }
/// <summary> /// 角色选择器 /// </summary> /// <param name="userKey"></param> /// <returns></returns> public ActionResult RoleSelector(string userKey) { Guid userGuid = Converter.TryToGuid(userKey); List <BusinessRole> allRoleList = BusinessRoleBLL.GetList(Logics.True, string.Empty); List <BusinessRole> userRoleList = BusinessUserBLL.GetUserRoles(userGuid); this.ViewBag.UserKey = userKey; this.ViewBag.UserRoleList = userRoleList; return(View(allRoleList)); }
public ActionResult UserItem(string enterpriseKey, string itemKey = StringHelper.Empty) { BusinessUser user = BusinessUser.Empty; if (GuidHelper.IsInvalidOrEmpty(itemKey) == false) { user = BusinessUserBLL.Get(new Guid(itemKey)); } this.ViewBag.EnterpriseKey = enterpriseKey; return(View(user)); }
/// <summary> /// 删除 /// </summary> /// <param name="modelID"></param> /// <returns></returns> public override bool Delete(string modelID) { bool isSuccessful = base.Delete(modelID); if (isSuccessful == true) { //TODO:xieran20130112 如果删除劳务人员成功,那么其对应的其他信息(工资等)均需要删除 if (GuidHelper.IsInvalidOrEmpty(modelID) == false) { BusinessUserBLL.DeleteUser(GuidHelper.TryConvert(modelID)); } } return(isSuccessful); }
public ActionResult UserList(string itemKey, string itemName = StringHelper.Empty) { List <BusinessUser> userList = new List <BusinessUser>(); if (GuidHelper.IsInvalidOrEmpty(itemKey) == false) { Guid itemGuid = GuidHelper.TryConvert(itemKey); string whereClause = string.Format("EnterpriseKey='{0}'", itemGuid.ToString()); userList = BusinessUserBLL.GetList(whereClause); } this.ViewBag.EnterpriseKey = itemKey; this.ViewBag.EnterpriseName = itemName; return(View(userList)); }
public override bool Update(LaborEntity model) { LaborEntity originalModel = Get(model.UserGuid, true); bool isSuccessful = BusinessUserBLL.UpdateUser(model); if (isSuccessful == true) { //TIP:xieran2012124 保存即加锁锁定 model.IsProtectedByOwner = Logics.True; isSuccessful = base.Update(model); } OperateLogBLL.RecordOperateLog(string.Format("修改劳务人员信息{0}", isSuccessful == true ? "成功" : "失败"), "Labor", model.UserGuid.ToString(), model.UserNameDisplay, model, originalModel); return(isSuccessful); }
private void DispatchRemindMessage(List <EnterpriseContractEntity> enterpriseContractList) { RemindEntity remindEntity = CreateRemindEntity(); foreach (EnterpriseContractEntity enterpriseContractEntity in enterpriseContractList) { remindEntity.RemindTitle = string.Format("企业【{0}】的合同【{1}】将在{2}到期", enterpriseContractEntity.EnterpriseInfo, enterpriseContractEntity.ContractTitle, enterpriseContractEntity.ContractStopDate.ToShortDateString()); remindEntity.RemindCategory = RemindCategories.ContractRemindOfEnterprise; remindEntity.RemindUrl = string.Empty; List <BusinessUser> employeeList = BusinessUserBLL.GetList(UserTypes.Manager, UserStatuses.Normal); foreach (BusinessUser item in employeeList) { RemindBLL.Instance.Create(item.ExecutorGuid, ExecutorTypes.User, remindEntity); } } }
/// <summary> /// Job执行的具体实现 /// </summary> /// <param name="context"></param> protected override void ExecuteDetails(JobExecutionContext context) { int daysOffToday = 3; if (SystemTaskInConfig != null) { daysOffToday = Converter.ChangeType(SystemTaskInConfig.GetAddonItemValue("aheadDays"), 3); } int dayOfYear = DateTime.Today.DayOfYear; int dateLower = dayOfYear + daysOffToday; int dateUpper = dateLower + 1; List <BusinessUser> birthdayUserList = BusinessUserBLL.GetList(string.Format("[UserType] ={0} AND DATEPART(DY,UserBirthDay)>= {1} AND DATEPART(DY,UserBirthDay)<{2} ", (int)this.UserType, dateLower, dateUpper)); DispatchRemindMessage(birthdayUserList); }
public ActionResult UserItem(string enterpriseKey, string itemKey, BusinessUser originalEntity) { bool isSuccessful = false; string displayMessage = string.Empty; BusinessUser targetUser = null; if (GuidHelper.IsInvalidOrEmpty(itemKey) == true) { targetUser = new BusinessUser(); targetUser.EnterpriseKey = enterpriseKey; targetUser.UserType = UserTypes.Broker; targetUser.Password = SystemConst.InitialUserPassword; SetTargetUserEntityValue(originalEntity, ref targetUser); CreateUserRoleStatuses createStatus = CreateUserRoleStatuses.Successful; BusinessUserBLL.CreateUser(targetUser, out createStatus); if (createStatus == CreateUserRoleStatuses.Successful) { isSuccessful = true; } } else { targetUser = BusinessUserBLL.Get(new Guid(itemKey)); SetTargetUserEntityValue(originalEntity, ref targetUser); isSuccessful = BusinessUserBLL.UpdateUser(targetUser); } if (isSuccessful == true) { displayMessage = "数据保存成功"; } else { displayMessage = "数据保存失败"; } return(Json(new LogicStatusInfo(isSuccessful, displayMessage))); }
/// <summary> /// 删除员工 /// </summary> /// <param name="itemKey"></param> /// <returns></returns> public ActionResult Delete(string itemKey) { if (GuidHelper.IsInvalidOrEmpty(itemKey) == false) { bool isSuccessful = EmployeeBLL.Instance.Delete(itemKey); if (isSuccessful == true) { BusinessUserBLL.DeleteUser(GuidHelper.TryConvert(itemKey)); } } string url = RequestHelper.GetValue("returnUrl"); bool isUsingCompress = RequestHelper.GetValue <bool>("isUsingCompress"); if (isUsingCompress == true) { url = CompressHelper.Decompress(url); } return(Redirect(url)); }
private void PassCurrentUser() { string currentUserName = string.Empty; bool isAuthenticated = this.Request.RequestContext.HttpContext.User.Identity.IsAuthenticated; if (isAuthenticated == true) { currentUserName = this.Request.RequestContext.HttpContext.User.Identity.Name; } if (string.IsNullOrWhiteSpace(currentUserName) == true) { UserCookie userCookie = UserCookie.Load <UserCookie>(); currentUserName = userCookie.UserName; } BusinessUser currentUser = BusinessUserBLL.Get(currentUserName); this.ViewBag.CurrentUser = currentUser; }
public new CreateUserRoleStatuses Create(EmployeeEntity model) { CreateUserRoleStatuses createStatus; BusinessUserBLL.CreateUser(model, out createStatus); if (createStatus == CreateUserRoleStatuses.Successful) { bool isSuccessful = base.Create(model); if (isSuccessful == true) { return(CreateUserRoleStatuses.Successful); } else { return(CreateUserRoleStatuses.FailureUnknowReason); } } else { return(createStatus); } }
public ActionResult RoleSelector(string userKey, bool isOnlyPlaceHolder = true) { Guid userGuid = Converter.TryToGuid(userKey); if (userGuid == Guid.Empty) { return(Json(new LogicStatusInfo(false, "保存权限失败"))); } else { List <Guid> roleGuidList = new List <Guid>(); NameValueCollection nvc = this.Request.Form; //获取选中的checkbox for (int i = 0; i < nvc.Count; i++) { string currentKey = nvc.AllKeys[i]; string currentValue = nvc[i]; if (currentKey.StartsWith(SystemConst.RoleItemValuePrefix) && currentValue.ToLower() == "on") { int seperatorPos = currentKey.LastIndexOf(SystemConst.PermissionItemGuidValueSeperator); int valueStarPos = seperatorPos + SystemConst.PermissionItemGuidValueSeperator.Length; string currentRoleString = currentKey.Substring(valueStarPos); Guid currentRoleGuid = Converter.TryToGuid(currentRoleString); if (currentRoleGuid != Guid.Empty) { roleGuidList.Add(currentRoleGuid); } } } BusinessUserBLL.UpdateUserRoles(userGuid, roleGuidList); return(Json(new LogicStatusInfo(true, "保存权限成功"))); } }
public new CreateUserRoleStatuses Create(LaborEntity model) { CreateUserRoleStatuses createStatus; BusinessUserBLL.CreateUser(model, out createStatus); if (createStatus == CreateUserRoleStatuses.Successful) { bool isSuccessful = base.Create(model); OperateLogBLL.RecordOperateLog(string.Format("创建劳务人员信息{0}", isSuccessful == true ? "成功" : "失败"), "Labor", model.UserGuid.ToString(), model.UserNameDisplay, model, null); if (isSuccessful == true) { return(CreateUserRoleStatuses.Successful); } else { return(CreateUserRoleStatuses.FailureUnknowReason); } } else { return(createStatus); } }
public ActionResult Index(string userName, string password) { LogicStatusInfo logicStatusInfo = new LogicStatusInfo(); LoginStatuses loginStatus = LoginStatuses.Successful; BusinessUser businessUser = null; if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(password)) { logicStatusInfo.IsSuccessful = false; logicStatusInfo.Message = "请必须输入账号和口令,谢谢!"; } else { businessUser = BusinessUserBLL.Login(userName, password, out loginStatus); switch (loginStatus) { case LoginStatuses.Successful: logicStatusInfo.IsSuccessful = true; break; case LoginStatuses.FailureUnactive: logicStatusInfo.IsSuccessful = false; return(RedirectToAction("Active", "Home", new { area = "UserCenter" })); default: logicStatusInfo.IsSuccessful = false; break; } logicStatusInfo.Message = EnumHelper.GetDisplayValue(loginStatus); } if (logicStatusInfo.IsSuccessful == true) { if (FormsAuthentication.GetRedirectUrl(userName, false) == FormsAuthentication.DefaultUrl) { switch (businessUser.UserType) { case UserTypes.EnterpriseUser: return(RedirectToAction("Index", "Home", new { area = "EnterpriseConsole" })); case UserTypes.Broker: return(RedirectToAction("Index", "Home", new { area = "InformationBrokerConsole" })); case UserTypes.Manager: case UserTypes.SuperAdmin: return(RedirectToAction("Index", "Home", new { area = "" })); case UserTypes.CommonUser: default: return(RedirectToAction("Index", "Home", new { area = "LaborConsole" })); } } else { FormsAuthentication.RedirectFromLoginPage(userName, false); } } return(View(logicStatusInfo)); }