public ActionResult Edit(UserFM userFM) { //if user valid edit user UserService users = new UserService(); users.UpdateUser(userFM); return RedirectToAction("Index"); //else return edit with errors }
public ActionResult Create(UserFM user) { //if user valid create user UserService users = new UserService(); users.CreateUser(user); return RedirectToAction("Index"); //else return to create with errors }
// // GET: /User/ public ActionResult Index() { if(Session["UserID"] == null) { return RedirectToAction("../Login/Index"); } UserService userS = new UserService(); UsersVM usersVM = userS.GetUsers(); return View(usersVM); }
public ActionResult ChangePassword(PasswordFM passwordFM) { //if user valid edit pass UserService users = new UserService(); if(users.VerifyPassword(passwordFM) && passwordFM.NewPassword == passwordFM.VerifyPassword && passwordFM.NewPassword.Length > 7) { users.UpdatePassword(passwordFM); } return RedirectToAction("Index"); //else return edit with errors }
public static AddUsers getInstance() { instance = new AddUsers(); if (userService == null) { userService = new UserService(); } return instance; }
public AddUser() { InitializeComponent(); button1.BackColor = Color.FromArgb(255, 80, 151, 228); button1.ForeColor = Color.White; button2.BackColor = Color.FromArgb(255, 80, 151, 228); button2.ForeColor = Color.White; if (userService == null) { userService = new UserService(); } }
public static BodyTea createForm() { if (instance == null || instance.IsDisposed) { instance = new BodyTea(); } if (userService == null) { userService = UserService.getInstance(); } if (strWheres == null) { strWheres = new Dictionary<string, string>(); } return instance; }
public static BodyStu createForm() { if (instance == null || instance.IsDisposed) { instance = new BodyStu(); if (userService == null) userService = UserService.getInstance(); if (classService == null) classService = ClassService.getInstance(); if (strWheres == null) strWheres = new Dictionary<string, string>(); } return instance; }
public ModifyPassword() { InitializeComponent(); //this.BackColor = Color.FromArgb(255, 208, 232, 253); button1.BackColor = Color.FromArgb(255, 80, 151, 228); button1.ForeColor = Color.White; button2.BackColor = Color.FromArgb(255, 80, 151, 228); button2.ForeColor = Color.White; userId = LoginRoler.userId; userService = UserService.getInstance(); if (mainFram == null) { mainFram = new MainFrame(); } }
public ActionResult Edit(int ID) { UserService users = new UserService(); UserFM userFM = users.GetUserFM(ID); return View(userFM); }
public ActionResult Delete(int ID) { UserService users = new UserService(); users.DeleteUser(ID); return RedirectToAction("Index"); }
public ActionResult ChangePassword(int ID) { UserService users = new UserService(); return View(users.GetPasswordFM(ID)); }
/// <summary> /// 更新占成 /// By xzz /// 2010-10-8 /// </summary> /// <param name="userName"></param> /// <param name="percent"></param> /// <param name="roleId"></param> /// <returns></returns> public static string UpdatePercent(int ID, double percent, int roleId) { double maxPercent = 0; double UpPercent = 10; object ob; if (roleId == 5) { UserService userService = new UserService(); ob = userService.GetMaxPercentByUserName(ID); if (!Convert.IsDBNull(ob)) { maxPercent = Convert.ToDouble(ob); } } else { ob = agentService.GetMaxPercentByUserName(ID); if (!Convert.IsDBNull(ob)) { maxPercent = Convert.ToDouble(ob); } } Agent agent = GetAgentByPK(ID); if (agent != null) { if (roleId != 2) { Agent upAgent = GetAgentByPK(agent.UpUserID); if (upAgent != null) { UpPercent = upAgent.Percent; } } } if (percent < maxPercent) { return("不能小于下级最大占成:" + maxPercent.ToString("")); } else if (percent > UpPercent) { return("不能大于上级占成:" + UpPercent.ToString("")); } else { if (agentService.UpdatePercent(percent, ID)) { //更新会员占成 if (roleId == 5) { agentService.UpdatePercentAll(UpPercent - percent, percent, agent.RoleId, agent.UserName); } else { IList <Agent> nextAgents = agentService.GetAgentByupUsername(agent.UserName); foreach (Agent info in nextAgents) { agentService.UpdatePercentAll(UpPercent - percent, percent - info.Percent, agent.RoleId, info.UserName); } } return("ok"); } else { return("更新失败"); } } }