コード例 #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
ファイル: ModifyPassword.cs プロジェクト: yaopengchao/tcz
        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("更新失败");
                }
            }
        }