protected void btnSaveSPCode_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SPCodeWrapper obj = new SPCodeWrapper();


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

                obj.IsMatchCase = chkIsMatchCase.Checked;


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


                obj.MOType       = this.cmbCodeType.SelectedItem.Value;
                obj.MOLength     = obj.Mo.Length;
                obj.MOType       = this.cmbCodeType.SelectedItem.Value;
                obj.OrderIndex   = 1;
                obj.SPCode       = this.txtSPCode.Text.Trim();
                obj.SPCodeType   = "1";
                obj.SPCodeLength = obj.SPCode.Length;
                obj.IsDiable     = this.chkIsDiable.Checked;

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

                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());

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

                //obj.SendText = this.txtCodeSendText.Text.Trim();

                obj.Name = ChannelID.Name + "-" + obj.MoCode;
                obj.Code = ChannelID.Name + "-" + obj.MoCode;

                SPCodeWrapper.QuickAddCode(obj, this.txtSubCodes.Text);

                winSPCodeAdd.Hide();
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
            }
        }
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;
            }
        }