Esempio n. 1
0
 private void btnAddDistrbutor_Click(object sender, EventArgs e)
 {
     if (DistributorHelper.ExistGradeName(txtRankName.Text.Trim()))
     {
         ShowMsg("已经存在相同名称的分销商等级", false);
     }
     else
     {
         int num;
         DistributorGradeInfo distributorGrade = new DistributorGradeInfo();
         distributorGrade.Name        = txtRankName.Text.Trim();
         distributorGrade.Description = txtRankDesc.Text.Trim();
         if (!(!int.TryParse(txtValue.Text, out num) || txtValue.Text.Contains(".")))
         {
             distributorGrade.Discount = num;
         }
         else
         {
             ShowMsg("等级折扣必须只能为正整数", false);
             return;
         }
         if (ValidationMemberGrade(distributorGrade))
         {
             if (DistributorHelper.AddDistributorGrade(distributorGrade))
             {
                 ResetText();
                 ShowMsg("成功添加了一个分销商等级", true);
             }
             else
             {
                 ShowMsg("添加分销商等级失败", false);
             }
         }
     }
 }
Esempio n. 2
0
        private void btnAddDistrbutor_Click(object sender, System.EventArgs e)
        {
            if (DistributorHelper.ExistGradeName(this.txtRankName.Text.Trim()))
            {
                this.ShowMsg("已经存在相同名称的分销商等级", false);
                return;
            }
            DistributorGradeInfo distributorGradeInfo = new DistributorGradeInfo();

            distributorGradeInfo.Name        = this.txtRankName.Text.Trim();
            distributorGradeInfo.Description = this.txtRankDesc.Text.Trim();
            int discount;

            if (!int.TryParse(this.txtValue.Text, out discount) || this.txtValue.Text.Contains("."))
            {
                this.ShowMsg("等级折扣必须只能为正整数", false);
                return;
            }
            distributorGradeInfo.Discount = discount;
            if (!this.ValidationMemberGrade(distributorGradeInfo))
            {
                return;
            }
            if (DistributorHelper.AddDistributorGrade(distributorGradeInfo))
            {
                this.ResetText();
                this.ShowMsg("成功添加了一个分销商等级", true);
                return;
            }
            this.ShowMsg("添加分销商等级失败", false);
        }