public ActionResult Advert(int AdvertID = -1, int LinkManID =-1, int PageIndex = 0,double BeginMoney =-1 ,double EndMoney = -1,DateTime? BeginTime = null,DateTime? Endtime = null,string IsCounted = "false") { #region 保存查询条件 ViewBag.AdvertID = AdvertID; ViewBag.LinkManID = LinkManID; ViewBag.BeginMoney = BeginMoney == -1 ? "" : BeginMoney.ToString(); ViewBag.EndMoney = EndMoney == -1 ? "" : EndMoney.ToString(); ViewBag.BeginTime = BeginTime; ViewBag.Endtime = Endtime; ViewBag.IsCounted = IsCounted; ViewBag.AmIn = "apk"; #endregion if (BeginTime == null) BeginTime = DateTime.Now.AddYears(-20); if (Endtime == null) Endtime = DateTime.Now.AddYears(20); AdvertBLL bll = new AdvertBLL(); AdminUserBLL userBll = new AdminUserBLL(); ViewBag.AdminUsers = userBll.GetAdminUsersByRoleType(RoleType.商务); ViewBag.Adverts = bll.GetAll(); int count; int pageSize = 10; IList<AdvertDTO> list = bll.GetList(AdvertID, LinkManID, BeginMoney == -1 ? 0 : BeginMoney, EndMoney == -1 ? 0 : EndMoney, (DateTime)BeginTime, (DateTime)Endtime, IsCounted == "on", PageIndex, pageSize, out count); ViewBag.AdvertList = list; ViewBag.PageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1; ViewBag.Record = count; ViewBag.CurrentPage = PageIndex; return View(); }
public ActionResult Update(int id) { ViewBag.AmIn = "user";//标识左边菜单是否展开 AdminUserBLL bll = new AdminUserBLL(); ViewBag.UserNameIDList = bll.GetAdminUserNameIDsByRoleType(RoleType.媒介); ViewBag.User = bll.Get(id); return View(); }
public ActionResult UserInfo() { AdminUser user = CheckLogin.Instance.GetUser(); if (user == null) { return RedirectToAction("Login", "Home"); } AdminUserBLL bll = new AdminUserBLL(); ViewBag.UserInfo = bll.Get(user.ID); return View(); }
public ActionResult UpdateDo(AdminUser User) { AdminUserBLL bll = new AdminUserBLL(); if (User.Password == null) { User.Password = bll.Get(User.ID).Password; } else { User.Password = Des.GetMD5String(User.Password); } bll.Update(User); return RedirectToAction("UserList", "AdminUser"); }
public ActionResult TaskCanApplyList(string AppName = "", string CPID = "", int PageIndex = 0) { ViewBag.AmIn = "taskapply"; ViewBag.AppName = AppName; ViewBag.CPID = CPID; int count; int pageSize = 10; AdminUserBLL userBll = new AdminUserBLL(); ViewBag.UserList = userBll.GetAdminUserNameIDsByRoleType(RoleType.渠道); AppBLL bll = new AppBLL(); ViewBag.AppList = bll.GetAppListByNameAndCPID(AppName, CPID, PageIndex, pageSize, out count); ; ViewBag.PageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1; ViewBag.Record = count; ViewBag.CurrentPage = PageIndex; return View(); }
public ActionResult UserList(string UserName = "", int RoleType = -1, int PageIndex = 0) { #region 保存输入参数 ViewBag.UserName = UserName; ViewBag.RoleType = RoleType; ViewBag.PageIndex = PageIndex; ViewBag.AmIn = "user";//标识左边菜单是否展开 #endregion int count; int pageSize = 10; AdminUserBLL bll = new AdminUserBLL(); IList<AdminUser> list = bll.GetList(UserName, RoleType, PageIndex, pageSize, out count); ViewBag.UserList = list; ViewBag.PageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1; ViewBag.Record = count; ViewBag.CurrentPage = PageIndex; return View(); }
public ActionResult LoginIn(LoginModel model) { AdminUserBLL bll = new AdminUserBLL(); string md5_pwd = Des.GetMD5String(model.Password); AdminUser user = bll.Login(model.UserName, md5_pwd); if(user == null || user.UserName != model.UserName || user.Password != md5_pwd) { ViewBag.LoginInfo = model; ViewBag.Message = "登录失败,用户名或密码错误!"; return View("Login"); } //为提供的用户名提供一个身份验证的票据 FormsAuthentication.SetAuthCookie(user.UserName, true, FormsAuthentication.FormsCookiePath); //把用户对象保存在票据里 FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, user.UserName, DateTime.Now, DateTime.Now.AddTicks(FormsAuthentication.Timeout.Ticks), false, JsonConvert.SerializeObject(user)); //加密票据 string hashTicket = FormsAuthentication.Encrypt(Ticket); HttpCookie userCookie = new HttpCookie(FormsAuthentication.FormsCookieName, hashTicket); Response.Cookies.Add(userCookie); return RedirectToAction("UserInfo","AdminUser"); }
public ActionResult TaskList(int AdvertID =0,int AppID =0,string CPID ="",int MeiJieID =0,int PageIndex =0) { #region 保存查询条件 ViewBag.AdvertID = AdvertID; ViewBag.AppID = AppID; ViewBag.CPID = CPID; ViewBag.MeiJieID = MeiJieID; ViewBag.AmIn = "task"; #endregion AppBLL appBll = new AppBLL(); AdvertBLL advertBLL = new AdvertBLL(); AdminUserBLL userBll = new AdminUserBLL(); ViewBag.MeiJieList = userBll.GetAdminUserNameIDsByRoleType(NetworkLeagueModel.Enum.RoleType.媒介); ViewBag.AdvertList = advertBLL.GetAll(); ViewBag.AppNameIDList = appBll.GetAll(); TaskBLL taskBll = new TaskBLL(); int count; int pageSize=10; AdminUser user = CheckLogin.Instance.GetUser(); ViewBag.TaskList = taskBll.GetTaskListByUserID("",AdvertID, AppID, CPID, user.ID, (int)user.RoleType, 0, 0, PageIndex, pageSize, out count); ViewBag.PageCount = count % pageSize == 0 ? count / pageSize : (count / pageSize) + 1; ViewBag.Record = count; ViewBag.CurrentPage = PageIndex; return View(); }
public ActionResult SaveUser(int UserID, string Mobile, string BankName, string BankAccount) { AdminUserBLL bll = new AdminUserBLL(); AdminUser user = bll.Get(UserID); user.Mobile = Mobile; user.BankName = BankName; user.BankAccount = BankAccount; bll.Update(user); return RedirectToAction("UserInfo", "AdminUser"); }
public ActionResult Delete(int id) { AdminUserBLL bll = new AdminUserBLL(); bll.Delete(id); return RedirectToAction("UserList", "AdminUser"); }
public ActionResult ResetPassword(string OldPassword = "", string NewPassword = "", string CheckPassword = "") { if (Request["Message"] == null) { return View(); } AdminUser user = CheckLogin.Instance.GetUser(); if (user == null) { return RedirectToAction("Login", "Home"); } if (user.Password != Des.GetMD5String(OldPassword)) { ViewBag.Message = "旧密码不正确!"; return View(); } Regex reg = new Regex(RegexPatton.PasswordPatton); if (!reg.Match(NewPassword).Success) { ViewBag.Message = "新密码格式不正确!"; return View(); } if (NewPassword == "" || NewPassword != CheckPassword) { ViewBag.Message = "两次新密码输入不正确!"; return View(); } user.Password = Des.GetMD5String(NewPassword); AdminUserBLL bll = new AdminUserBLL(); if (bll.Update(user)) return RedirectToAction("LogOut", "Home"); else { ViewBag.Message = "修改密码失败!"; return View(); } }
public ActionResult Register(AdminUser user =null) { AdminUserBLL userBll = new AdminUserBLL(); ViewBag.CustomServices = userBll.GetAdminUserNameIDsByRoleType(RoleType.媒介); ViewBag.PwdPatton = RegexPatton.PasswordPatton; //以用户名有没有值来判断是请求注册页面还是提交注册数据 if (user != null && !string.IsNullOrEmpty(user.UserName)) { string msg = CheckRegistInfo(user, userBll); if (msg.Length > 0) { ViewBag.RegistInfo = user; ViewBag.Message = msg; return View(); } user.RoleType = (int)RoleType.渠道; user.Password = Des.GetMD5String(user.Password); user.CreateTime = DateTime.Now; userBll.Add(user); } else { ViewBag.RegistInfo = new AdminUser(); return View(); } return RedirectToAction("Login","Home"); }
public ActionResult AdvertEdit(int AdvertID = 0, Advert model = null) { ViewBag.AmIn = "apk"; AdminUserBLL bll = new AdminUserBLL(); AdvertBLL advertBLL = new AdvertBLL(); if (AdvertID == 0) { ViewBag.STitle = "添加"; } else { ViewBag.STitle = "编辑"; } if (Request["ID"] == null) { IList<AdminUserNameIDDto> list = bll.GetAdminUserNameIDsByRoleType(RoleType.商务); ViewBag.UserList = list; if (AdvertID == 0) { ViewBag.Advert = new Advert(); return View(); } else { Advert ad = advertBLL.Get(AdvertID); ViewBag.Advert = ad; return View(); } } else { if (string.IsNullOrEmpty(model.AdName)) { IList<AdminUserNameIDDto> list = bll.GetAdminUserNameIDsByRoleType(RoleType.商务); ViewBag.UserList = list; ViewBag.Message = "广告主名称不能为空";//保存要提示的消息 if (AdvertID == 0) { ViewBag.Advert = new Advert(); } else { ViewBag.Advert = advertBLL.Get(AdvertID); } return View(); } if (advertBLL.AdvertIsExists(model.AdName, model.ID)) { IList<AdminUserNameIDDto> list = bll.GetAdminUserNameIDsByRoleType(RoleType.商务); ViewBag.UserList = list; ViewBag.Message = "广告主名称已存在";//保存要提示的消息 if (AdvertID == 0) { ViewBag.Advert = new Advert(); } else { ViewBag.Advert = advertBLL.Get(AdvertID); } return View(); } if (model.ID == 0) { model.CreateTime = DateTime.Now; advertBLL.Add(model); } else { advertBLL.Update(model); } return RedirectToAction("Advert", "Home"); } }
/// <summary> /// 注册信息验证 /// </summary> /// <param name="user"></param> /// <param name="bll"></param> /// <returns></returns> private string CheckRegistInfo(AdminUser user, AdminUserBLL bll) { Regex reg; string msg = string.Empty; #region 验证用户名 if (string.IsNullOrEmpty(user.UserName)) { return "请填写用户名!"; } reg = new Regex(RegexPatton.UserNamePatton); if (!reg.Match(user.UserName).Success) { return "用户名格式不正确!"; } if (bll.UserNameIsExists(user.UserName)) { return "用户名已存在!"; } #endregion #region 验证密码 if (string.IsNullOrEmpty(user.Password)) { return "请填写密码!"; } reg = new Regex(RegexPatton.PasswordPatton); if (!reg.Match(user.Password).Success) { return "密码格式不正确!"; } if (user.Password != Request.Form["Password2"]) { return "两次输入的密码不一致!"; } #endregion #region 验证邮箱 if (string.IsNullOrEmpty(user.EMail)) { return "请填写邮箱!"; } reg = new Regex(RegexPatton.EMailPatton); if (!reg.Match(user.EMail).Success) { return "邮箱格式不正确!"; } if (bll.EmailIsExists(user.EMail)) { return "邮箱已存在!"; } #endregion #region 验证QQ if (string.IsNullOrEmpty(user.QQ)) { return "请填写QQ!"; } reg = new Regex(RegexPatton.qqPatton); if (!reg.Match(user.QQ).Success) { return "qq格式不正确!"; } if (bll.QQIsExists(user.QQ)) { return "qq已存在!"; } #endregion #region 验证收款人 if (string.IsNullOrEmpty(user.RealName)) { return "请填写收款人!"; } reg = new Regex(RegexPatton.RealNamePatton); if (!reg.Match(user.RealName).Success) { return "收款人格式不正确!"; } #endregion #region 验证手机号 if (string.IsNullOrEmpty(user.Mobile)) { return "请填写手机号!"; } reg = new Regex(RegexPatton.MobilePatton); if (!reg.Match(user.Mobile).Success) { return "手机号格式不正确!"; } if (bll.MobileIsExists(user.Mobile)) { return "手机号码已存在!"; } #endregion if (Session["vcode"] == null) { return "验证码已失效,请换一张!"; } if (Request.Form["ValidateCode"].ToUpper() != GetCode()) { return "验证码不正确!"; } return msg; }