예제 #1
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 = "升级失败"
            }));
        }
        /// <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 = "升级失败"
            }));
        }
예제 #3
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 = "升级失败"
                }));
            }
        }