public ActionResult Login(LoginViewModel model) { if (ModelState.IsValid) { var userSvc = new SysUserService(); var permissionSvc = new SysPermissionService(); //判断登录 if (userSvc.Login(model.LoginName, model.LoginPwd)) { Session[CommonSession.SysUserName] = model.LoginName; //当前登录用户名 Session[CommonSession.SysUserRealName] = userSvc.SysUser.RealName; //当前登录用户名 Session[CommonSession.SysUserId] = userSvc.UserId; //当前登录用户编号 Session[CommonSession.SysDepartId] = userSvc.SysDepartId; //当前登录用户所属部门 Session[CommonSession.SysDepartName] = userSvc.SysDepartName; //当前登录用户所属部门名称 Session[CommonSession.SysDepartType] = userSvc.SysDepartType; //当前登录用户所属部门类型 Session[CommonSession.RegionCity] = userSvc.RegionCity; //当前登录用户所属城市 Session[CommonSession.RegionCounty] = userSvc.RegionCounty; //当前登录用户所属县区 Session[CommonSession.CurrentUser] = userSvc.SysUser; //当前登录的用户实体 Session[CommonSession.SysRoles] = userSvc.SysRole; //当前登录用户角色 model.LoginName = userSvc.SysUser.RealName; return(RedirectToAction(nameof(Success))); //跳转 } else { ModelState.AddModelError("", @"您的账号密码有误"); } } return(View(model)); }
public void LoginTest() { SysUserService userService = new SysUserService(); var rValue = userService.CheckUser("admin", "123456"); Console.WriteLine(rValue != null); }
public async Task <ActionResult> SysUserDetails(Guid?id) { var sysUserService = new SysUserService(); if (id == null || !await sysUserService.ExistsSysUser(id.Value)) { return(RedirectToAction(nameof(SysUserList))); } var m = await sysUserService.GetOneSysUserById(id.Value); string roleName = ""; foreach (var t in m.SysUserRoles.Where(r => !r.IsRemoved)) { roleName += t.SysRole.RoleName + '、'; } return(View(new SysUserDto() { Id = m.Id, UserName = m.UserName, RealName = m.RealName, SysRoleName = roleName.TrimEnd('、'), SysDepartName = m.SysDepart.DepartName, CreateTime = m.CreateTime })); }
public async Task <ActionResult> SysUserDelete(Guid id) { var sysUserService = new SysUserService(); await sysUserService.RemoveSysUser(id); return(RedirectToAction(nameof(SysUserList))); }
public async Task <IHttpActionResult> Register([FromBody] UserRegisterBaseModel user) { if (ModelState.IsValid) { try { await SysUserService.AddAsync(new SysUserDto() { LoginName = user.LoginName, UserName = user.Name, Password = user.Password, Email = user.Email, SysRoleSerialnum = user.RoleCode, SysDepartmentSerialnum = user.DepartmentCode, Status = 0, CreateTime = DateTime.Now }); } catch (AggregateException ex) { if (ex.InnerExceptions.Any()) { ex.InnerExceptions.ForEach(e => { ModelState.AddModelError(e.HResult.ToString(), e); }); } } } else { ModelState.AddModelError("user", "用户添加失败"); } return(new ApiV1Result(ModelState.IsValid ? ResultMessageType.Success : ResultMessageType.InternalError, ModelState.ToString())); }
protected override void OnRetrieveSearchCriteria() { SmSiteObject smSiteObject = new SmSiteObject(); SysUserObject sysUserObject = new SysUserObject(); ArrayList sysUserList = SysUserService.Create().RetriveSysUserAll(); this.ExGridSkLineResp.SourceBags.Add(AddLine.UserSource, sysUserList); this.ExGridSkLineResp.SourceBags.Add(AddLine.UserSource, (ArrayList)sysUserList.Clone()); sysUserList.Insert(0, new SysUserObject() { UserId = null, StaffName = PMSConstant.DDL_EMPTY_DESC }); this.DataBinder.SourceBag.Add(AddLine.UserSource, sysUserList); this.SubNatureList = PropertySubNatureService.Create().RetrievePropertySubNatureAll(); ExListFilterCriteriaCollection criterias = new ExListFilterCriteriaCollection(); criterias.Add(NatureCodeId, this.NatureCode); ArrayList subNatureLst = ExListFilter.Create().Filter(this.SubNatureList, criterias); subNatureLst.Insert(0, new PropertySubNatureObject() { NatureCode = PMSConstant.DDL_EMPTY_CODE, SubNatureCode = PMSConstant.DDL_EMPTY_CODE, SubNatureDesc = PMSConstant.DDL_ALL_DESC }); this.ExGridSkLineResp.SourceBags.Add(SubNatureCodeSource, subNatureLst); this.DataBinder.SourceBag.Add(SubNatureCodeSource, subNatureLst); this.Search(); }
public JsonResult List(SysUserViewModel viewModel, PageInfo pageInfo) { QueryCollection queries = new QueryCollection(); if (!string.IsNullOrEmpty(viewModel.UserName)) { queries.Add(new Query { Name = "UserName", Operator = Query.Operators.Contains, Value = viewModel.UserName }); } if (!string.IsNullOrEmpty(viewModel.NickName)) { queries.Add(new Query { Name = "NickName", Operator = Query.Operators.Contains, Value = viewModel.NickName }); } var list = SysUserService.GetListByPage(queries.AsExpression <SysUser>(), x => true, pageInfo.Limit, pageInfo.Page, out int totalCount, true).Select(x => new { x.Id, x.UserName, x.NickName, x.HeadIcon, x.MobilePhone, x.Email, x.EnabledMark }).ToList(); return(Json(Pager.Paging(list, totalCount), JsonRequestBehavior.AllowGet)); }
public PartialViewResult GetDetail(string id) { view_DetailUser obj = new SysUserService().GetViewUserByID(id); //List< tbl_Hotel> objCatalog = new HotelService().GetAll(new PagingModel() { offset = 0, limit = 100, search = "" }); return(PartialView("DetailUser", obj)); }
public async Task <IHttpActionResult> Login([FromBody] UserLoginModel user) { if (ModelState.IsValid) { try { var result = await SysUserService.LoginAsync(user.LoginName, user.Password); return(new ApiV1Result(result ? ResultMessageType.Success : ResultMessageType.InternalError, "", null)); } catch (AggregateException ex) { if (ex.InnerExceptions.Any()) { ex.InnerExceptions.ForEach(e => { ModelState.AddModelError(e.HResult.ToString(), e); }); } return(new ApiV1Result(ResultMessageType.InternalError, ModelState.ToString(), null)); } } else { return(BadRequest(ModelState)); } }
protected void LinkButton1_Click1(object sender, EventArgs e) { if (Session["Comm_CGPONo"] != null) { CG_POOrder model = POSer.GetModel(Convert.ToInt32(Session["Comm_CGPONo"])); txtPOGuestName.Text = model.GuestName; txtPOName.Text = model.POName; txtPONo.Text = model.PONo; Session["Comm_CGPONo"] = null; #region 需要审批的需要指定该项目AE try { var user = new SysUserService().getAllUserByLoginName(string.Format(" and loginName='{0}'", model.AE))[0]; //ddlUser.Text = user.Id.ToString(); //ddlUser.Enabled = false; ddlPers.Text = user.Id.ToString(); ddlPers.Enabled = false; } catch (Exception) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('没有找到对应的AE!');</script>"); } #endregion } }
public EditUserModel(SysRoleService sysRoleService, IMapper mapper, SysUserService sysUserService) { _sysUserService = sysUserService; _sysRoleService = sysRoleService; _mapper = mapper; }
public ProfileController(SysUserService sysUserService, SysUserLoginService sysUserLoginService, SysUserAuthentication sysUserAuthentication) { _sysUserService = sysUserService; _sysUserLoginService = sysUserLoginService; _sysUserAuthentication = sysUserAuthentication; }
public DeleteUserModel(SysUserService sysUserService, SysUserJwtService sysUserJwtService, SysRoleService sysRoleService) { _sysUserJwtService = sysUserJwtService; _sysUserService = sysUserService; _sysRoleService = sysRoleService; }
public JsonResult UserLogOn_Pad(FormCollection collection) { Language lang; var service = new SysUserService(); SysUser user = service.Login(collection["UserName"], collection["Password"]); if (user == null || string.Compare(user.Pwd, collection["Password"], false) != 0) { return(Json(new { success = false, msg = "<=PwdorNameError>" })); } else { DateTime dt = DateTime.Today; if (!(user.ValidDateFrom <= dt && user.ValidDateTo >= dt) || !user.Active) { return(Json(new { success = false, msg = "<=UserExpireError>" })); } //密码过期修改 if (!user.PasswordDate.HasValue) { string errorMsg = string.Empty; user.PasswordDate = DateTime.Now.Date; bool success = service.Save(user, out errorMsg); if (!success) { return(Json(new { success = false, msg = errorMsg })); } } else { if (user.PasswordDate.Value.AddDays(30).Date <= DateTime.Now.Date) { lang = (Language)int.Parse(collection["Lang"]); Response.Cookies["Lang"].Value = lang == Language.English ? "English" : "SimplifiedChinese"; Response.Cookies["Lang"].Expires = DateTime.Now.AddDays(365); return(Json(new { success = false, msg = "expired" })); } } FormsService.SignIn(collection["UserName"], false); lang = (Language)int.Parse(collection["Lang"]); Response.Cookies["Lang"].Value = lang == Language.English ? "English" : "SimplifiedChinese"; Response.Cookies["Lang"].Expires = DateTime.Now.AddDays(365); string s = "FrogDashboard.Service.Services.MasterData.SysManagement.SysFunctionService"; ISysFunction <SysFunction> service_ = (ISysFunction <SysFunction>)Assembly.Load("FrogDashboard.Service").CreateInstance(s); var userRoleId = user.RoleId; if (service_.GetUserFunction(userRoleId).Where(c => c.ControllerName == "OrderManagement" && c.ActionName == "TmsForPad").Count() > 0) { return(Json(new { success = true, msg = "<LoginSuccess>", URL = "Pad" })); } else { return(Json(new { success = true, msg = "<LoginSuccess>", URL = "Index" })); } } }
public StatisticalService() { EBServiceProvider serviceProvider = new EBServiceProvider(); _shopInfoService = serviceProvider.GetService <ShipInfoService>(); _sysUserService = serviceProvider.GetService <SysUserService>(); _monitorIndicatorService = serviceProvider.GetService <MonitorIndicatorService>(); _monitorIndicatorRecordService = serviceProvider.GetService <MonitorIndicatorRecordService>(); _dataSyncRecordService = serviceProvider.GetService <DataSyncRecordService>(); }
///<summary> /// sys_userController ///</summary> public SysUserController(SysUserService sysUserService, ISysUserRepository sysUserRepository, SysAppRoleService sysAppRoleService, SysOrgService sysOrgService, SysJobService sysJobService, SysUserAppRoleService sysUserAppRoleService) { _sysUserService = sysUserService; _sysUserRepository = sysUserRepository; _sysAppRoleService = sysAppRoleService; _sysOrgService = sysOrgService; _sysJobService = sysJobService; _sysUserAppRoleService = sysUserAppRoleService; }
/// <summary> /// /// </summary> /// <param name="sysRoleService"></param> /// <param name="sysUserService"></param> /// <param name="sysCategoryService"></param> /// <param name="mapper"></param> public SysRoleController(SysRoleService sysRoleService, SysUserService sysUserService, SysCategoryService sysCategoryService, IMapper mapper) { _sysCategoryService = sysCategoryService; _sysUserService = sysUserService; _mapper = mapper; _sysRoleService = sysRoleService; }
public ActionResult Logout() { SysUserService.Exit(); //if(SysUserService.StoreId=="sup")//供应平台 // return RedirectToAction("Login", "Supplier"); Session.Clear(); Session.Abandon(); CookieHelper.Remove("ASP.NET_SessionId");//重新会话ID return(RedirectToAction("Login", "Account")); }
public JsonResult ChangePasswordPost(FormCollection collection) { var service = new SysUserService(); SysUser user = service.Login(collection["UserCode"], collection["OldPwd"]); if (user == null || string.Compare(user.Pwd, collection["OldPwd"], false) != 0) { return(Json(new { success = false, msg = "<=OldPwdNotMatched>" })); } else { if (string.Compare(collection["NewPwd"], collection["ConfirmPwd"], false) != 0) { return(Json(new { success = false, msg = "<=NewPwdNotMatched>" })); } if (string.Compare(collection["NewPwd"], user.Pwd, false) == 0) { return(Json(new { success = false, msg = "<=ForbidMatchOldPwd>" })); } string errorMsg = string.Empty; user.PasswordDate = DateTime.Now.Date; user.Pwd = collection["NewPwd"]; TryUpdateModel <SysUser>(user); //判断新密码规则,Operator不受密码规则控制 var _sysUserRoleService = new SysUserRoleService(); var _sysRoleService = new SysRoleService(); var sysUserRole = _sysUserRoleService.GetList().Where(o => o.SysUserId == user.SysUserId).Select(o => o.SysRoleId).Distinct().ToList(); var sysRole = _sysRoleService.GetList().Where(o => sysUserRole.Contains(o.SysRoleId) || o.SysRoleId == user.RoleId).ToList(); if (sysRole.Count() > 0 && (sysRole.Count() != 1 || sysRole.Where(o => o.RoleCode.Contains("Operator")).Count() <= 0)) { if (!this.PassWordIsValid(user.Pwd)) { return(Json(new { success = false, msg = "<=PasswordError>" }, JsonRequestBehavior.AllowGet)); } } if (!ModelState.IsValid) { List <string> errorList = ModelStateExtension.GetModelError(ViewData); string str = string.Join(",", errorList.ToArray()); return(Json(new { success = false, msg = str }, JsonRequestBehavior.AllowGet)); } bool success = service.Save(user, out errorMsg); if (!success) { return(Json(new { success = false, msg = errorMsg })); } FormsService.SignIn(collection["UserCode"], false); return(Json(new { success = true, msg = "<=ModifySuccess>" })); } }
/// <summary> /// 操作后 /// </summary> /// <param name="filterContext"></param> public override void OnActionExecuted(ActionExecutedContext filterContext) { base.OnActionExecuted(filterContext); if (!isCheck) { return; } string token; token = filterContext.HttpContext.Request.Headers["Access"]; token = token ?? filterContext.HttpContext.Request["Access"]; token = token ?? filterContext.HttpContext.Request.Cookies["Access"]?.Value; var payload = Cache.GetCache <Payload>(token); //操作日志记录 JsonResult jsonResult = filterContext.Result as JsonResult; string roomId = filterContext.HttpContext.Request["classroom"]; string nodeId = filterContext.HttpContext.Request["nodeAdd"] ?? "00"; if (nodeId?.IndexOf("_") != -1) { nodeId = nodeId.Split('_')[0]; } string onoff = filterContext.HttpContext.Request["onoff"]; onoff = string.IsNullOrEmpty(onoff) ? "" : onoff; EquipmentResult equipmentResult = jsonResult?.Data as EquipmentResult; if (equipmentResult != null) { //开启线程处理后续日志操作 ThreadPool.QueueUserWorkItem(oo => { Z_EquipmentLog zEquipmentLog = new Z_EquipmentLog(); zEquipmentLog.F_Id = Guid.NewGuid().ToString(); zEquipmentLog.F_Account = payload.Account; zEquipmentLog.F_Date = DateTime.Now; zEquipmentLog.F_RoomNo = roomId; string roomName = ZRoomService.GetEntity(z => z.F_RoomNo.ToLower() == roomId.ToLower()).Select(z => z.F_FullName).FirstOrDefault(); string nodeName = ZEquipmentService.GetEntity(e => e.F_EquipmentNo.ToLower() == nodeId.ToLower()) .Select(e => e.F_FullName).FirstOrDefault(); var user = SysUserService.GetEntity(u => u.F_Account == payload.Account).Select(o => new { o.F_NickName, o.F_RealName }) .FirstOrDefault(); zEquipmentLog.F_EquipmentNo = nodeId; zEquipmentLog.F_Description = equipmentResult.Message; zEquipmentLog.F_EquipmentLogType = onoff == StateType.OPEN ? EQUOPEN : onoff == StateType.CLOSE ? EQUCLOSE : EQUSEARCH; zEquipmentLog.F_RoomName = roomName; zEquipmentLog.F_EquipmentName = nodeName; zEquipmentLog.F_NickName = user?.F_NickName; zEquipmentLog.F_FullName = user?.F_RealName; ZEquipmentLogService.AddEntity(zEquipmentLog); }); } }
public WorkContext(SysUserAuthentication sysUserAuthentication, SysRoleService sysRoleService, IHttpContextAccessor httpContextAccessor, SysCategoryService sysCategoryService, SysUserService sysUserService) { _sysRoleService = sysRoleService; _sysCategoryService = sysCategoryService; _sysUserAuthentication = sysUserAuthentication; _httpContextAccessor = httpContextAccessor; _sysUserService = sysUserService; }
public ActionResult Delete(int id) { try { SysUserService.DeleteBy(x => x.Id == id); return(WriteSuccess("数据删除成功")); } catch (Exception ex) { return(WriteError(ex)); } }
/// <summary> /// 负责将对象同步至数据库 /// </summary> private void UpdateBetDetail(object param) { /****初始化开始**/ IDbContextFactory factory = new DbContextFactory(); Ytg.Comm.IHasher hasher = new Ytg.Comm.Hasher(); var sysUser = new SysUserService(new Repo <SysUser>(factory), hasher); var sysUserBalanceService = new SysUserBalanceService(new Repo <SysUserBalance>(factory), hasher, sysUser); var sysUserBalanceDetailService = new SysUserBalanceDetailService(new Repo <SysUserBalanceDetail>(factory), sysUserBalanceService); var rebateHelper = new Service.Logic.RebateHelper(sysUser, sysUserBalanceService, sysUserBalanceDetailService); /****初始化结束**/ while (true) { var betDetail = this.Dequeue(); try { if (null == betDetail) { LogManager.Info("追号同步数据队列中暂无数据,开始休眠一秒!"); System.Threading.Thread.Sleep(1000);//休眠一秒 continue; } //计算返点 游戏返点 rebateHelper.BettingCalculate(betDetail.CatchDetail.PrizeType, betDetail.CatchDetail.UserId, betDetail.CatchNumIssue.TotalAmt, betDetail.CatchNumIssue.CatchNumIssueCode, rebateHelper.GetRadioMaxRemo(betDetail.CatchDetail.PalyRadioCode, betDetail.CatchDetail.BonusLevel)); if (betDetail.CatchNumIssue.IsMatch)//是否中奖 { rebateHelper.UpdateUserBanance(betDetail.CatchDetail.UserId, betDetail.CatchNumIssue.WinMoney, TradeType.奖金派送, betDetail.CatchNumIssue.CatchNumIssueCode, 0); } if (null != betDetail.ExitCatNumIssues) { //是否有结束追号的期数 var exitCount = betDetail.ExitCatNumIssues.Count; for (var i = 0; i < exitCount; i++) { var exit = betDetail.ExitCatNumIssues[i]; //if (betDetail.CatchDetail.PrizeType == 1) // rebateHelper.BettingCannelIssue(betDetail.CatchDetail.UserId, exit.TotalAmt, exit.CatchNumIssueCode, rebateHelper.GetRadioMaxRemo(betDetail.CatchDetail.PalyRadioCode, betDetail.CatchDetail.BonusLevel));//处理返点 //else rebateHelper.UpdateUserBanance(betDetail.CatchDetail.UserId, exit.TotalAmt, TradeType.追号返款, exit.CatchNumIssueCode, 0); } } LogManager.Info("修改追号信息成功!" + betDetail.ToString()); } catch (Exception ex) { LogManager.Error("修改追号用户信息异常,投注信息:" + betDetail.ToString() + "\n", ex); } } }
public UserDetailsModel(SysRoleService sysRoleService, SysUserService sysUserService, SysUserJwtService sysUserJwtService, SysUserLoginService sysUserLoginService, ActivityLogService activityLogService) { _activityLogService = activityLogService; _sysUserLoginService = sysUserLoginService; _sysUserService = sysUserService; _sysRoleService = sysRoleService; _sysUserJwtService = sysUserJwtService; }
public async Task <IHttpActionResult> UpdatePwd([FromBody] string userName, string pwd) { return(await ResultFactory.Create(ModelState, async arg => { var user = await SysUserService.GetAsync(u => u.UserName.Equals(userName)); user.Password = pwd; user.UpdateTime = DateTime.Now; var result = await SysUserService.UpdateAsync(user) > 0; return new ApiResult(result ? ExceptionCode.Success : ExceptionCode.InternalError, "", null); }, userName, "success", "请检查请求参数")); }
public ActionResult UpdateEnabledMark(int id, int enabledMark) { SysUser entity = new SysUser { Id = id, EnabledMark = enabledMark, UpdateTime = DateTime.Now, UpdateUserId = UserManager.GetCurrentUserInfo().Id }; SysUserService.Update(entity, new string[] { "EnabledMark", "UpdateTime", "UpdateUserId" }); return(WriteSuccess("更新成功")); }
public IEnumerable <Actions> GetUserActionList(int userId) { var r = from u in SysUserService.GetQueryList() join ur in RelUserRoleService.GetQueryList() on u.Id equals ur.UserId join ra in RelRoleActionService.GetQueryList() on ur.RoleId equals ra.RoleId join act in ActionsService.GetQueryList() on ra.ActionId equals act.ID where u.Id == userId select act; return(r.ToList()); }
/// <summary> /// /// </summary> public SysUserController(SysUserService sysUserService, SysRoleService sysRoleService, SysUserLoginService sysUserLoginLogService, ActivityLogService activityLogService, SysUserJwtService sysUserJwtService, IMapper mapper) { _sysUserJwtService = sysUserJwtService; _sysUserLoginLogService = sysUserLoginLogService; _sysRoleService = sysRoleService; _sysUserService = sysUserService; _activityLogService = activityLogService; _mapper = mapper; }
public ActionResult BatchDel(string idsStr) { try { var idsArray = idsStr.Substring(0, idsStr.Length).Split(','); int[] ids = Array.ConvertAll <string, int>(idsArray, int.Parse); var result = SysUserService.DeleteBy(x => ids.Contains(x.Id)) > 0 ? WriteSuccess("数据删除成功") : WriteError("数据删除失败"); return(result); } catch (Exception ex) { return(WriteError(ex)); } }
public async Task <ActionResult> SysUserEdit(Models.SysUserViewModels.SysUserViewModel model) { //设置中间表 var sysUserService = new SysUserService(); await sysUserService.EditSysUser(new SysUser() { Id = model.Id, UserName = model.UserName, RealName = model.RealName, SysDepartId = model.SysDepartId }, model.SysRoleIds); return(RedirectToAction(nameof(SysUserList))); }
public IndexController(SysUserService sysUserService, ISysEnterpriseService sysEnterpriseService) { _sysUserService = sysUserService; _sysEnterpriseService = sysEnterpriseService; }