示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Globals.RequestFormStr("posttype") == "save")
     {
         int num = Globals.RequestFormNum("isadd");
         base.Response.ContentType = "application/json";
         string s = "{\"type\":\"0\",\"tips\":\"修改失败,请输入正确的参数!\"}";
         if (num == 1)
         {
             string str3  = Globals.RequestFormStr("starttime");
             string str4  = Globals.RequestFormStr("endtime");
             JArray array = (JArray)JsonConvert.DeserializeObject(Globals.RequestFormStr("data"));
             try
             {
                 foreach (JObject obj2 in array)
                 {
                     int     gradeid       = Globals.ToNum(obj2["gradeid"].ToString());
                     decimal addcommission = decimal.Parse(obj2["addcommission"].ToString());
                     if ((gradeid > 0) && (addcommission >= 0M))
                     {
                         DistributorGradeBrower.SetAddCommission(gradeid, addcommission);
                     }
                 }
                 this.siteSettings.IsAddCommission        = 1;
                 this.siteSettings.AddCommissionStartTime = str3;
                 this.siteSettings.AddCommissionEndTime   = str4;
                 Globals.EntityCoding(this.siteSettings, true);
                 SettingsManager.Save(this.siteSettings);
                 s = "{\"type\":\"1\",\"tips\":\"修改成功!\"}";
             }
             catch
             {
             }
             base.Response.Write(s);
             base.Response.End();
         }
         else
         {
             if (DistributorGradeBrower.ClearAddCommission())
             {
                 this.siteSettings.IsAddCommission        = 0;
                 this.siteSettings.AddCommissionStartTime = null;
                 this.siteSettings.AddCommissionEndTime   = null;
                 Globals.EntityCoding(this.siteSettings, true);
                 SettingsManager.Save(this.siteSettings);
                 s = "{\"type\":\"1\",\"tips\":\"成功关闭分销商升级奖励!\"}";
             }
             base.Response.Write(s);
             base.Response.End();
         }
     }
     else
     {
         bool flag = this.siteSettings.IsAddCommission == 1;
         this.cbIsAddCommission.Checked = flag;
         if (flag)
         {
             this.calendarStartDate.Text = this.siteSettings.AddCommissionStartTime;
             this.calendarEndDate.Text   = this.siteSettings.AddCommissionEndTime;
         }
         else
         {
             DateTime now = DateTime.Now;
             this.calendarStartDate.Text = now.ToString("yyyy-MM-dd");
             this.calendarEndDate.Text   = now.AddMonths(2).ToString("yyyy-MM-dd");
         }
         this.rptList.DataSource = DistributorGradeBrower.GetAllDistributorGrade();
         this.rptList.DataBind();
     }
 }
示例#2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string a = Globals.RequestFormStr("posttype");

            if (!(a == "save"))
            {
                bool flag = this.siteSettings.IsAddCommission == 1;
                this.cbIsAddCommission.Checked = flag;
                if (flag)
                {
                    this.calendarStartDate.Text = this.siteSettings.AddCommissionStartTime;
                    this.calendarEndDate.Text   = this.siteSettings.AddCommissionEndTime;
                }
                else
                {
                    System.DateTime now = System.DateTime.Now;
                    this.calendarStartDate.Text = now.ToString("yyyy-MM-dd");
                    this.calendarEndDate.Text   = now.AddMonths(2).ToString("yyyy-MM-dd");
                }
                this.rptList.DataSource = DistributorGradeBrower.GetAllDistributorGrade();
                this.rptList.DataBind();
                return;
            }
            int num = Globals.RequestFormNum("isadd");

            base.Response.ContentType = "application/json";
            string s = "{\"type\":\"0\",\"tips\":\"修改失败,请输入正确的参数!\"}";

            if (num == 1)
            {
                string addCommissionStartTime = Globals.RequestFormStr("starttime");
                string addCommissionEndTime   = Globals.RequestFormStr("endtime");
                string value  = Globals.RequestFormStr("data");
                JArray jArray = (JArray)JsonConvert.DeserializeObject(value);
                try
                {
                    using (System.Collections.Generic.IEnumerator <JToken> enumerator = jArray.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            JObject jObject = (JObject)enumerator.Current;
                            int     num2    = Globals.ToNum(jObject["gradeid"].ToString());
                            decimal num3    = decimal.Parse(jObject["addcommission"].ToString());
                            if (num2 > 0 && num3 >= 0m)
                            {
                                DistributorGradeBrower.SetAddCommission(num2, num3);
                            }
                        }
                    }
                    this.siteSettings.IsAddCommission        = 1;
                    this.siteSettings.AddCommissionStartTime = addCommissionStartTime;
                    this.siteSettings.AddCommissionEndTime   = addCommissionEndTime;
                    Globals.EntityCoding(this.siteSettings, true);
                    SettingsManager.Save(this.siteSettings);
                    s = "{\"type\":\"1\",\"tips\":\"修改成功!\"}";
                }
                catch
                {
                }
                base.Response.Write(s);
                base.Response.End();
                return;
            }
            if (DistributorGradeBrower.ClearAddCommission())
            {
                this.siteSettings.IsAddCommission        = 0;
                this.siteSettings.AddCommissionStartTime = null;
                this.siteSettings.AddCommissionEndTime   = null;
                Globals.EntityCoding(this.siteSettings, true);
                SettingsManager.Save(this.siteSettings);
                s = "{\"type\":\"1\",\"tips\":\"成功关闭分销商升级奖励!\"}";
            }
            base.Response.Write(s);
            base.Response.End();
        }