protected void btnSaveSPCode_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SPCodeWrapper obj = SPCodeWrapper.FindById(int.Parse(hidId.Text.Trim()));
                obj.Id          = Convert.ToInt32(this.hidId.Text.Trim());
                obj.Name        = this.txtName.Text.Trim();
                obj.Description = this.txtDescription.Text.Trim();
                obj.Code        = this.txtCode.Text.Trim();
                obj.Mo          = this.txtMO.Text.Trim();
                obj.MOType      = this.cmbMOType.SelectedItem.Value;
                obj.OrderIndex  = Convert.ToInt32(this.numOrderIndex.Text.Trim());
                obj.SPCode      = this.txtSPCode.Text.Trim();
                //obj.Province = this.txtProvince.Text.Trim();
                //obj.DisableCity = this.txtDisableCity.Text.Trim();
                obj.IsDiable = this.chkIsDiable.Checked;

                //obj.CodeLength = obj.Mo.Length;
                //obj.DayLimit =  this.txtDayLimit.Text.Trim();
                //obj.MonthLimit = this.txtMonthLimit.Text.Trim();
                obj.Price = Convert.ToDecimal(this.txtPrice.Text.Trim());
                //obj.SendText = this.txtCodeSendText.Text.Trim();
                obj.HasFilters       = this.chkHasFilters.Checked;
                obj.HasParamsConvert = this.chkHasParamsConvert.Checked;

                SPCodeWrapper.Update(obj);

                winSPCodeEdit.Hide();
                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
                return;
            }
        }
Exemple #2
0
        protected void btnSaveSPCode_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SPCodeWrapper obj = SPCodeWrapper.FindById(int.Parse(hidSPCodeID.Text.Trim()));

                obj.Description = this.txtDescription.Text.Trim();

                obj.IsMatchCase = chkIsMatchCase.Checked;

                if (!chkIsMatchCase.Checked)
                {
                    obj.Mo = this.txtMO.Text.Trim();
                }
                else
                {
                    obj.Mo = this.txtMO.Text;
                }
                obj.MOLength = obj.Mo.Length;

                obj.SPCode       = this.txtSPCode.Text.Trim();
                obj.SPCodeLength = obj.SPCode.Length;

                obj.IsDiable = this.chkIsDiable.Checked;

                obj.LimitProvince = this.chkLimitProvince.Checked;

                string oldLimitProvinceArea = obj.LimitProvinceArea;

                obj.LimitProvinceArea = WebUIHelper.GetSelectMutilItems(this.mfLimitProvinceArea, ",");


                if (obj.LimitProvinceArea != oldLimitProvinceArea)
                {
                    List <PhoneLimitAreaAssigned> phoneLimitAreas = new List <PhoneLimitAreaAssigned>();

                    string[] provinces = obj.LimitProvinceArea.Split((",").ToCharArray());

                    foreach (string province in provinces)
                    {
                        phoneLimitAreas.Add(new PhoneLimitAreaAssigned()
                        {
                            AreaName = province, LimitCount = 0
                        });
                    }

                    obj.DayTotalLimitInProvinceAssignedCount = SerializeUtil.ToJson(phoneLimitAreas);
                }

                obj.HasPhoneLimit = this.chkHasPhoneLimit.Checked;

                obj.HasFilters       = this.chkHasFilters.Checked;
                obj.HasParamsConvert = this.chkHasParamsConvert.Checked;
                obj.HasPhoneLimit    = this.chkHasPhoneLimit.Checked;

                obj.Price = Convert.ToDecimal(this.nfPrice.Text.Trim());

                SPCodeWrapper.Update(obj);

                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
            }
        }
Exemple #3
0
        protected void btnSaveSPCodeLimitSetting_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SPCodeWrapper code = CodeID;

                code.IsDayTimeLimit = chkIsDayTimeLimit.Checked;

                code.HasDayMonthLimit = chkDayMonthTotalLimit.Checked;

                code.HasDayTotalLimit = chkDayTotalLimit.Checked;

                if (chkIsDayTimeLimit.Checked)
                {
                    if (!string.IsNullOrEmpty(tfDayTimeLimitRangeStart.Text))
                    {
                        CodeID.DayTimeLimitRangeStart = new DateTime(2013, 1, 1, Convert.ToInt32(tfDayTimeLimitRangeStart.Text.Split(':')[0]), Convert.ToInt32(tfDayTimeLimitRangeStart.Text.Split(':')[1]), 0);
                    }
                    else
                    {
                        CodeID.DayTimeLimitRangeStart = new DateTime(2013, 1, 1, 0, 0, 0);
                    }
                    if (!string.IsNullOrEmpty(tfDayTimeLimitRangeEnd.Text))
                    {
                        CodeID.DayTimeLimitRangeEnd = new DateTime(2013, 1, 1, Convert.ToInt32(tfDayTimeLimitRangeEnd.Text.Split(':')[0]), Convert.ToInt32(tfDayTimeLimitRangeEnd.Text.Split(':')[1]), 0);
                    }
                    else
                    {
                        CodeID.DayTimeLimitRangeEnd = new DateTime(2013, 1, 1, 0, 0, 0);
                    }
                }
                else
                {
                    CodeID.DayTimeLimitRangeStart = new DateTime(2013, 1, 1, 0, 0, 0);
                    CodeID.DayTimeLimitRangeEnd   = new DateTime(2013, 1, 1, 0, 0, 0);
                }



                if (chkDayMonthTotalLimit.Checked)
                {
                    CodeID.PhoneLimitDayCount   = Convert.ToInt32(nfPhoneLimitDayCount.Value);
                    CodeID.PhoneLimitMonthCount = Convert.ToInt32(nfPhoneLimitMonthCount.Value);
                }
                else
                {
                    CodeID.PhoneLimitDayCount   = 0;
                    CodeID.PhoneLimitMonthCount = 0;
                }

                if (chkDayTotalLimit.Checked)
                {
                    CodeID.DayTotalLimitCount = Convert.ToInt32(nfDayTotalLimit.Value);
                }
                else
                {
                    CodeID.DayTotalLimitCount = 0;
                }

                if (CodeID.LimitProvince.HasValue && CodeID.LimitProvince.Value)
                {
                    CodeID.DayTotalLimitInProvince = !fsLimitProvince.Collapsed;

                    CodeID.DayTotalLimitInProvinceAssignedCount = hidAreaCountList.Text;
                }

                SPCodeWrapper.Update(CodeID);
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
                return;
            }
        }