Example #1
0
        public ActionResult ProcLevel()
        {
            ViewBag.LeveModelList = lvelname.GetAll();
            UserProView modelview = new UserProView();

            modelview.UserProViewList = MemberLevelService.GetUerProList(pageIndex, pageSize);
            for (int i = 0; i < modelview.UserProViewList.Count; i++)
            {
                UserDTO model = UserServer.GetModel(modelview.UserProViewList[i].UserID);
                if (model != null)
                {
                    modelview.UserProViewList[i].UserCode      = model.UserCode;
                    modelview.UserProViewList[i].LastLevelName = lvelname.GetLevelName(modelview.UserProViewList[i].LastLevel).LevelName;
                    modelview.UserProViewList[i].EndLevelName  = lvelname.GetLevelName(modelview.UserProViewList[i].EndLevel).LevelName;
                    modelview.UserProViewList[i].TrueName      = model.TrueName;
                    //if (list[i].Flag == 0)
                    //{
                    //    list[i].
                    //}
                }
            }
            modelview.totalPage = MemberLevelService.GetUerProCount().Count;
            decimal s = (decimal)modelview.totalPage / (decimal)pageSize;

            modelview.showPageNum = int.Parse(Math.Ceiling(s).ToString());
            return(PartialView(modelview));
        }
        // GET: MemberLevel

        /// <summary>
        /// MemberLevel控制器
        /// </summary>
        /// <returns></returns>
        public ActionResult MemberLevel()
        {
            GlobeParamDTO            GlobeParam = new GlobeParamDTO();
            MemberLevelListViewModel Model      = new MemberLevelListViewModel();

            //GlobeParam = GlobeParamService.GetByName("1");
            Model.UserPro       = MemberLevelService.GetUserPro((int)GetLoginID()).UserPro;
            Model.MemberListDTO = Member.ToUser((int)GetLoginID()).MemberList.First();
            Model.BlogCategory  = Level.GetAll();
            return(View(Model));
        }
        /// <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 = "升级失败"
            }));
        }
        /// <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 = "升级失败"
            }));
        }
Example #5
0
        public ActionResult ProUserLevel(string code, int leveID)
        {
            UserDTO model = UserServer.GetModelCode(code);
            string  bramk = "";

            if (model != null)
            {
                if (leveID == 0)
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "请选择等级"
                    }));
                }
                if (leveID <= model.LevelID)
                {
                    bramk = "后台降级";
                }
                else
                {
                    bramk = "后台升级";
                }
                //if (leveID > model.LevelID)
                //{
                GlobeParamDTO GlobeParam = new GlobeParamDTO();
                GlobeParam = GlobeParamService.GetByName("Level" + model.LevelID);
                if (GlobeParam == null)
                {
                    return(Json(new AjaxResult {
                        Status = "0", Msg = "后台参数设置错误"
                    }));
                }
                GlobeParamDTO GlobeParam1 = new GlobeParamDTO();
                GlobeParam1 = GlobeParamService.GetByName("Level" + leveID);
                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.LevelID;
                UserPro.EndLevel   = leveID;
                UserPro.Pro001     = 0;
                UserPro.ProMoney   = 100;
                UserPro.Remark     = bramk;
                UserPro.UserID     = model.ID;
                long i = MemberLevelService.Add(UserPro);
                long b = Member.Update_LeveID(int.Parse(model.ID.ToString()), leveID);
                return(Json(new AjaxResult {
                    Status = "1", Msg = "升级成功"
                }));
                //}
                //else
                //{
                //    return Json(new AjaxResult { Status = "0", Msg = "升级失败" });
                //}
            }
            else
            {
                return(Json(new AjaxResult {
                    Status = "0", Msg = "升级失败"
                }));
            }
        }