Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            VipConfig config = new VipConfig();

            config.VipLevel = IntParam;
            config.Integral = Convert.ToInt64(TextBox2.Text);
            config.Fresh    = Convert.ToDecimal(TextBox3.Text);
            config.Week     = Convert.ToDecimal(TextBox4.Text);
            config.Month    = Convert.ToDecimal(TextBox5.Text);
            config.Day1     = Convert.ToDecimal(TextBox6.Text);
            config.Day2     = Convert.ToDecimal(TextBox7.Text);
            config.Day3     = Convert.ToDecimal(TextBox8.Text);
            config.Day4     = Convert.ToDecimal(TextBox9.Text);
            config.Day5     = Convert.ToDecimal(TextBox1.Text);
            config.Day6     = Convert.ToDecimal(TextBox10.Text);
            config.Day7     = Convert.ToDecimal(TextBox11.Text);
            int r = FacadeManage.aidePlatformFacade.SaveVipConfig(config);

            if (r > 0)
            {
                ShowInfo("配置信息操作成功", "VipConfigList.aspx", 1200);
            }
            else
            {
                ShowError("配置信息操作失败");
            }
        }
Пример #2
0
        /// <summary>
        ///会员自动升级和消费记录插入
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public bool updatelevel(int userId, string xcxTemplate, int pricesum = 0)
        {
            switch (xcxTemplate)
            {
            case "food": pricesum = GetFoodVipPriceSum(userId); break;

            case "entpro": pricesum = GetEntGoodsVipPriceSum(userId); break;

            case "footbath": pricesum = GetFootbathVipPriceSum(userId); break;

            case "multistore": pricesum = GetMultiStoreVipPriceSum(userId); break;

            case "platchild": pricesum = GetPlatChildGoodsVipPriceSum(userId); break;

            case "qiye": pricesum = 0; break;

            default: pricesum = GetVipConsumptionrecord(userId); break;
            }

            bool        result      = false;
            string      sqlwhere    = string.Empty;
            VipRelation viprelation = GetModel($"uid={userId} and state>=0");

            if (viprelation != null)
            {
                viprelation.PriceSum = pricesum;
                //获取会员卡参数配置
                VipConfig vipconfig = VipConfigBLL.SingleModel.GetModel($"appid='{viprelation.appId}' and state>=0");

                //当前会员等级规则
                VipRule        rule        = VipRuleBLL.SingleModel.GetModel($"levelid={viprelation.levelid} and state>=0 and RuleType=0");
                List <VipRule> updateRules = VipRuleBLL.SingleModel.GetList($" state>=0 and RuleType=0 and appid='{viprelation.appId}' and {viprelation.PriceSum}>minMoney ", 12, 1, "*", "minMoney desc");
                //是否开启自动升级
                if (vipconfig != null && vipconfig.autoupdate == 1)//&& rule != null
                {
                    if (updateRules != null && updateRules.Count > 0)
                    {
                        if (rule == null || rule.minMoney <= updateRules[0].minMoney)
                        {
                            viprelation.levelid    = updateRules[0].levelid;
                            viprelation.updatetime = DateTime.Now;
                        }
                    }
                }

                result = Update(viprelation, "levelid,pricesum,updatetime");
            }
            return(result);
        }
Пример #3
0
        private void BindData()
        {
            VipConfig cfg = FacadeManage.aidePlatformFacade.GetVipConfigByLevel(IntParam);

            TextLevel.Text = cfg.VipLevel.ToString();
            TextBox2.Text  = cfg.Integral.ToString();
            TextBox3.Text  = cfg.Fresh.ToString();
            TextBox4.Text  = cfg.Week.ToString();
            TextBox5.Text  = cfg.Month.ToString();
            TextBox6.Text  = cfg.Day1.ToString();
            TextBox7.Text  = cfg.Day2.ToString();
            TextBox8.Text  = cfg.Day3.ToString();
            TextBox9.Text  = cfg.Day4.ToString();
            TextBox1.Text  = cfg.Day5.ToString();
            TextBox10.Text = cfg.Day6.ToString();
            TextBox11.Text = cfg.Day7.ToString();
        }
Пример #4
0
        /// <summary>
        /// 储值 会员升级
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="price"></param>
        /// <returns></returns>
        public bool updatelevelBySaveMoney(int userId, int price)
        {
            VipRelation viprelation = new VipRelationBLL().GetModel($"uid={userId} and state>=0");

            if (viprelation != null)
            {
                //获取储值升级会员规则 获取会员卡参数配置

                VipConfig vipconfig = VipConfigBLL.SingleModel.GetModel($"appid='{viprelation.appId}' and state>=0");

                //当前会员等级规则
                VipRule rule = VipRuleBLL.SingleModel.GetModel($"levelid={viprelation.levelid} and state>=0 and RuleType=1");

                if (vipconfig != null && vipconfig.SaveMoneyAutoUpdate == 1) //&& rule != null
                {
                    int viprelationPrice = price;                            //默认单次充值不包含赠送的
                    if (vipconfig.SaveMoneyType == 1)
                    {
                        //表示累计充值
                        viprelationPrice = SaveMoneySetUserBLL.SingleModel.GetSaveMoneySum(userId);
                    }


                    List <VipRule> updateRules = VipRuleBLL.SingleModel.GetList($" state>=0 and RuleType=1 and appid='{viprelation.appId}' and {viprelationPrice}>minMoney ", 12, 1, "*", "minMoney desc");

                    if (updateRules != null && updateRules.Count > 0)
                    {
                        if (rule == null || rule.minMoney <= updateRules[0].minMoney)
                        {
                            viprelation.levelid    = updateRules[0].levelid;
                            viprelation.updatetime = DateTime.Now;
                        }
                    }


                    return(base.Update(viprelation, "levelid,updatetime"));
                }
            }
            return(false);
        }
Пример #5
0
 public int SaveVipConfig(VipConfig cfg)
 {
     return(_aidePlatformData.SaveVipConfig(cfg));
 }