Exemplo n.º 1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public int Update_Date(MemberListDTO MemberList)
        {
            using (MyDbContext dbc = new MyDbContext())
            {
                MemberSearchResult result = new MemberSearchResult();
                var User = dbc.User.SingleOrDefault(u => u.ID == MemberList.ID);
                if (User == null)
                {
                    return(0);
                }
                User.TrueName = MemberList.TrueName;
                User.IdenCode = MemberList.IdenCode;
                User.PhoneNum = MemberList.PhoneNum;

                if (User.Password != MemberList.Password)
                {
                    User.Password = MemberList.Password;
                }
                if (User.SecondPassword != MemberList.SecondPassword)
                {
                    User.SecondPassword = MemberList.SecondPassword;
                }
                if (User.ThreePassword != MemberList.ThreePassword)
                {
                    User.ThreePassword = MemberList.ThreePassword;
                }

                dbc.SaveChanges();
                return(2);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public int Update_Date(MemberListDTO MemberList)
        {
            using (MyDbContext dbc = new MyDbContext())
            {
                MemberSearchResult         result = new MemberSearchResult();
                CommonService <UserEntity> cs     = new CommonService <UserEntity>(dbc);
                var User = cs.GetById(MemberList.ID);
                if (User == null)
                {
                    return(0);
                }
                User.TrueName = MemberList.TrueName;
                User.IdenCode = MemberList.IdenCode;
                User.PhoneNum = MemberList.PhoneNum;

                if (User.Password != MemberList.Password)
                {
                    User.Password = MemberList.Password;
                }
                if (User.SecondPassword != MemberList.SecondPassword)
                {
                    User.SecondPassword = MemberList.SecondPassword;
                }
                if (User.ThreePassword != MemberList.ThreePassword)
                {
                    User.ThreePassword = MemberList.ThreePassword;
                }

                dbc.SaveChanges();
                return(2);
            }
        }
        // GET: api/Members
        public MemberListDTO GetMembers([FromUri] int page = 1, [FromUri] int psize = 20)
        {
            int           count  = db.Members.Count();
            MemberListDTO result = new MemberListDTO();

            result.TotalPages = count > psize ?  (db.Members.Count() / psize) : 1;
            if (page > result.TotalPages)
            {
                page = result.TotalPages;
            }
            else if (page < 1)
            {
                page = 1;
            }
            var query = db.Members.OrderBy(t => t.ID).Skip((page - 1) * psize).Take(psize);

            foreach (Member m in query.ToList())
            {
                m.Password = "";
                result.Members.Add(m);
            }
            result.Page = page;

            return(result);
        }
Exemplo n.º 4
0
        public ActionResult Update_Password(int id)
        {
            MemberListViewModel model = new MemberListViewModel();

            model.MemberList = MemberService.ToUser(id).MemberList;
            MemberListDTO MemberList = new MemberListDTO();

            MemberList                = model.MemberList.First();
            MemberList.Password       = CommonHelper.GetMD5("111111");
            MemberList.SecondPassword = CommonHelper.GetMD5("111111");;
            MemberList.ThreePassword  = CommonHelper.GetMD5("111111");;
            int i = MemberService.Update_Date(MemberList);

            if (i > 0)
            {
                return(Json(new AjaxResult {
                    Status = "1", Msg = "密码修改成功", Data = "/admin/Member/PersonalData?id=" + id + ""
                }));
            }
            else
            {
                return(Json(new AjaxResult {
                    Status = "0", Msg = "密码修改失败", Data = "/admin/Member/PersonalData?id=" + id + ""
                }));
            }
        }
Exemplo n.º 5
0
        public ActionResult PersonalData_UpdateData(int id, string txtTrueName, string txtIdenCode, string txtPhoneNum)
        {
            MemberListViewModel model = new MemberListViewModel();

            model.MemberList = MemberService.ToUser(id).MemberList;
            MemberListDTO MemberList = new MemberListDTO();

            MemberList          = model.MemberList.First();
            MemberList.TrueName = txtTrueName;
            MemberList.IdenCode = txtIdenCode;
            MemberList.PhoneNum = txtPhoneNum;
            int i = MemberService.Update_Date(MemberList);

            if (i > 0)
            {
                return(Json(new AjaxResult {
                    Status = "1", Msg = "修改成功", Data = "/admin/Member/PersonalData?id=" + id + ""
                }));
            }
            else
            {
                return(Json(new AjaxResult {
                    Status = "0", Msg = "修改失败", Data = "/admin/Member/PersonalData?id=" + id + ""
                }));
            }
        }
Exemplo n.º 6
0
        public MemberListDTO ToDTO(UserEntity User)
        {
            LevelService  Level      = new LevelService();
            MemberListDTO MemberList = new MemberListDTO();

            MemberList.ID            = User.ID;
            MemberList.Emoney        = User.Emoney;
            MemberList.UserCode      = User.UserCode;
            MemberList.LevelID       = User.LevelID;
            MemberList.RecommendID   = User.RecommendID;
            MemberList.RecommendCode = User.RecommendCode;
            MemberList.ParentID      = User.ParentID;
            MemberList.IsOpend       = User.IsOpend;
            MemberList.TrueName      = User.TrueName;
            MemberList.PhoneNum      = User.PhoneNum;
            MemberList.CreateTime    = User.CreateTime;
            MemberList.IsLock        = User.IsLock;
            MemberList.OpenTime      = User.OpenTime;
            MemberList.LevelName     = "";
            if (Level.GetLevelName(MemberList.LevelID) != null)
            {
                MemberList.LevelName = Level.GetLevelName(MemberList.LevelID).LevelName;
            }

            MemberList.BankAccount     = User.BankAccount;
            MemberList.BankAccountUser = User.BankAccountUser;
            MemberList.BankName        = User.BankName;
            MemberList.BankBranch      = User.BankBranch;
            MemberList.BankInProvince  = User.BankInProvince;
            MemberList.Location        = User.Location;
            MemberList.RegMoney        = User.RegMoney;
            MemberList.ParentCode      = User.ParentCode;
            MemberList.IdenCode        = User.IdenCode;
            MemberList.Password        = User.Password;
            MemberList.ThreePassword   = User.ThreePassword;
            MemberList.SecondPassword  = User.SecondPassword;
            return(MemberList);
        }
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult MemberLevel_btn(int id) //还差钱没扣
        {
            MemberLevelListViewModel model = new MemberLevelListViewModel();
            shengji       shengji          = new shengji();
            MemberListDTO User             = new MemberListDTO();

            model.MemberListDTO = Member.ToUser((int)GetLoginID()).MemberList.First();//查这个人的ID信息
            if (id == 0)
            {
                return(Json(new AjaxResult {
                    Status = "0", Msg = "请选择等级"
                }));
            }
            if (id <= model.MemberListDTO.LevelID)
            {
                return(Json(new AjaxResult {
                    Status = "0", Msg = "选取的等级不能小于当前等级"
                }));
            }
            if (id > model.MemberListDTO.LevelID)
            {
                //GlobeParamDTO GlobeParam = new GlobeParamDTO();
                //GlobeParam = GlobeParamService.GetByName("Level" + model.MemberListDTO.LevelID);
                //if (GlobeParam == null)
                //{
                //    return Json(new AjaxResult { Status = "0", Msg = "后台参数设置错误" });
                //}
                GlobeParamDTO GlobeParam = new GlobeParamDTO();
                GlobeParam = GlobeParamService.GetByName("Level" + id);
                if (GlobeParam == null)
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "后台参数设置错误"
                    }));
                }
                decimal a;
                if (!decimal.TryParse(GlobeParam.ParamVarchar, out a))
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "数值类型无效"
                    }));
                }
                shengji.shengji_Left  = model.MemberListDTO.RegMoney;
                shengji.shengji_right = a;
                shengji.balance       = shengji.shengji_right - shengji.shengji_Left;
                model.shengji         = shengji;

                if (model.MemberListDTO.Emoney < shengji.balance)
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "余额不足,请充值后再注册"
                    }));
                }

                UserProDTO UserPro = new UserProDTO();
                UserPro.AddDate    = DateTime.Now;
                UserPro.CreateTime = DateTime.Now;
                UserPro.Flag       = 1;
                UserPro.FlagDate   = DateTime.Now;
                UserPro.LastLevel  = model.MemberListDTO.LevelID;
                UserPro.EndLevel   = id;
                UserPro.Pro001     = 0;
                UserPro.ProMoney   = a;
                UserPro.Remark     = "前台升级";
                UserPro.UserID     = GetLoginID();
                long i = 0;
                long b = 0;


                //try
                //{

                //}
                //catch (Exception)
                //{

                //}
                i = MemberLevelService.Add(UserPro);
                b = Member.Update_LeveID((int)GetLoginID(), id, shengji.balance);

                if (i > 0 && b > 0)
                {
                    return(Json(new AjaxResult {
                        Status = "1", Msg = "升级成功"
                    }));
                }
                else
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "升级失败"
                    }));
                }
            }
            return(Json(new AjaxResult {
                Status = "0", Msg = "升级失败"
            }));
        }
Exemplo n.º 8
0
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult MemberLevel_btn(int id) //还差钱没扣
        {
            MemberLevelListViewModel model = new MemberLevelListViewModel();
            shengji       shengji          = new shengji();
            MemberListDTO User             = new MemberListDTO();

            model.MemberListDTO = Member.ToUser(getLoginID).MemberList.First();//查这个人的ID信息
            if (id == 0)
            {
                return(Json(new AjaxResult {
                    Status = "0", Msg = "请选择等级"
                }));
            }
            if (id <= model.MemberListDTO.LevelID)
            {
                return(Json(new AjaxResult {
                    Status = "0", Msg = "选取的等级不能小于当前等级"
                }));
            }
            if (id > model.MemberListDTO.LevelID)
            {
                GlobeParamDTO GlobeParam = new GlobeParamDTO();
                GlobeParam = GlobeParamService.GetByName("Level" + model.MemberListDTO.LevelID);
                if (GlobeParam == null)
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "后台参数设置错误"
                    }));
                }
                GlobeParamDTO GlobeParam1 = new GlobeParamDTO();
                GlobeParam1 = GlobeParamService.GetByName("Level" + id);
                if (GlobeParam1 == null)
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "后台参数设置错误"
                    }));
                }
                decimal a;
                if (!decimal.TryParse("100", out a))
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "数值类型无效"
                    }));
                }
                shengji.shengji_Left  = a;
                shengji.shengji_right = Convert.ToDecimal(GlobeParam1.ParamVarchar.ToString());
                shengji.balance       = shengji.shengji_right - shengji.shengji_Left;
                model.shengji         = shengji;

                UserProDTO UserPro = new UserProDTO();
                UserPro.AddDate    = DateTime.Now;
                UserPro.CreateTime = DateTime.Now;
                UserPro.Flag       = 1;
                UserPro.FlagDate   = DateTime.Now;
                UserPro.LastLevel  = model.MemberListDTO.LevelID;
                UserPro.EndLevel   = id;
                UserPro.Pro001     = 0;
                UserPro.ProMoney   = 100;
                UserPro.Remark     = "前台升级";
                UserPro.UserID     = getLoginID;
                long i = 0;
                long b = 0;


                try
                {
                    i = MemberLevelService.Add(UserPro);
                    b = Member.Update_LeveID(getLoginID, id);
                }
                catch (Exception)
                {
                }

                if (i > 0 && b > 0)
                {
                    return(Json(new AjaxResult {
                        Status = "1", Msg = "升级成功"
                    }));
                }
                else
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "升级失败"
                    }));
                }
            }
            return(Json(new AjaxResult {
                Status = "0", Msg = "升级失败"
            }));
        }