예제 #1
0
        public void AddUserPoint(decimal point, string type)
        {
            Beauty.Core.PaginationInfo paging = new Core.PaginationInfo();
            IList <User> users = iuser.Get(null, UserName, null, null, null, null, null, null, null, null, 1, 0, null, out paging);

            if (users != null && users.Count > 0)
            {
                User user = users[0];
                user.FreezePoint -= point;
                if (user.FreezePoint < 0)
                {
                    user.FreezePoint = 0;
                }
                iuser.Update(user);

                MoneyRecord money = new MoneyRecord
                {
                    ID       = Guid.NewGuid(),
                    Money    = 0,
                    Statues  = 1,
                    Username = user.Username,
                    Balance  = user.Point - user.FreezePoint,
                    Type     = type
                };

                imoney.Create(money);
            }
        }
예제 #2
0
        //提现失败返回余额
        public void ReduceUserPoint4(string username, decimal money, string type)
        {
            Beauty.Core.PaginationInfo paging = new Core.PaginationInfo();
            IList <User> users = iuser.Get(null, username, null, null, null, null, null, null, null, null, 1, 0, null, out paging);

            if (users != null && users.Count > 0)
            {
                User user = users[0];

                user.Balance += money;
                iuser.Update(user);

                MoneyRecord moneyrecord = new MoneyRecord
                {
                    ID       = Guid.NewGuid(),
                    Money    = 0,
                    Statues  = 1,
                    Username = user.Username,
                    Balance  = user.Point - user.FreezePoint,
                    Type     = type
                };

                imoney.Create(moneyrecord);
            }
        }
예제 #3
0
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            //if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
            //{
            //    return RedirectToLocal(returnUrl);
            //}

            //// If we got this far, something failed, redisplay form
            //ModelState.AddModelError("", "The user name or password provided is incorrect.");
            if (ModelState.IsValid)
            {
                string code = Request["code"];
                if (Session["__VCode"] == null)
                {
                    ModelState.AddModelError("", "验证码不正确");
                    return(View(model));
                }
                if (code != Session["__VCode"].ToString())
                {
                    ModelState.AddModelError("", "验证码不正确");
                    return(View(model));
                }
                Core.PaginationInfo paging = new Core.PaginationInfo();
                IList <User>        users  = iuser.Get(null, model.UserName, null, null, null, null, null, null, null, null, 1, 0, null, out paging);
                if (users.Count > 0)
                {
                    User user = users[0];
                    if (user.Password == model.Password)
                    {
                        ICustomPrincipal cp = new CustomPrincipal();
                        cp.Login(model.UserName, user.ID.ToString(), true);
                        user.Ip            = null;
                        user.Lastlogintime = DateTime.Now;
                        //user.IsLogin = true;
                        bool isupdate = iuser.Update(user);


                        if (user.Role != 0)
                        {
                            if (!string.IsNullOrEmpty(returnUrl))
                            {
                                return(Redirect(returnUrl));
                            }
                            WriteLog(user.Username + " 登录系统");
                            return(RedirectToAction("Index", "Home"));
                        }
                        else
                        {
                            WriteLog(user.Username + " 登录系统");
                            return(RedirectToAction("usermanager", "admin"));
                        }
                    }
                }

                ModelState.AddModelError("", "用户名密码错误");
            }
            return(View(model));
        }
예제 #4
0
        public decimal GetAlivePoint()
        {
            decimal money = 0;

            Beauty.Core.PaginationInfo paging = new Core.PaginationInfo();
            IList <User> users = iuser.Get(null, UserName, null, null, null, null, null, null, null, null, 1, 0, null, out paging);

            if (users != null && users.Count > 0)
            {
                money = users[0].Point - users[0].FreezePoint;
            }

            return(money);
        }