예제 #1
0
 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
 }
예제 #2
0
 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
 }
예제 #3
0
 //
 // GET: /User/
 public ActionResult Index()
 {
     if(Session["UserID"] == null)
     {
         return RedirectToAction("../Login/Index");
     }
     UserService userS = new UserService();
     UsersVM usersVM = userS.GetUsers();
     return View(usersVM);
 }
예제 #4
0
 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
 }
예제 #5
0
파일: AddUsers.cs 프로젝트: yaopengchao/tcz
        public static AddUsers getInstance()
        {
            instance = new AddUsers();

            if (userService == null)
            {
                userService = new UserService();
            }

            return instance;
        }
예제 #6
0
파일: AddUser.cs 프로젝트: yaopengchao/tcz
        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();
            }
        }
예제 #7
0
파일: BodyTea.cs 프로젝트: yaopengchao/tcz
 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;
 }
예제 #8
0
파일: BodyStu.cs 프로젝트: yaopengchao/tcz
        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;
        }
예제 #9
0
        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();
            }
        }
예제 #10
0
 public ActionResult Edit(int ID)
 {
     UserService users = new UserService();
     UserFM userFM = users.GetUserFM(ID);
     return View(userFM);
 }
예제 #11
0
 public ActionResult Delete(int ID)
 {
     UserService users = new UserService();
     users.DeleteUser(ID);
     return RedirectToAction("Index");
 }
예제 #12
0
 public ActionResult ChangePassword(int ID)
 {
     UserService users = new UserService();
     return View(users.GetPasswordFM(ID));
 }
예제 #13
0
        /// <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("更新失败");
                }
            }
        }