private void batchCreate_Click(object sender, System.EventArgs e)
 {
     try
     {
         string distributorname = this.txtslsdistributors.Value;
         int    referruserId    = MemberHelper.IsExiteDistributorNames(distributorname);
         if (string.IsNullOrEmpty(this.txtslsdistributors.Value))
         {
             this.ShowMsg("输入的推荐分销商不能为空!", false);
         }
         else
         {
             if (!string.IsNullOrEmpty(distributorname) && referruserId <= 0)
             {
                 this.ShowMsg("输入的推荐分销商不存在!", false);
             }
             else
             {
                 if (this.radionumber.Checked)
                 {
                     if (string.IsNullOrEmpty(this.txtnumber.Value.Trim()))
                     {
                         this.ShowMsg("请输入要生成的账号数量", false);
                     }
                     else
                     {
                         int result = 0;
                         int.TryParse(this.txtnumber.Value, out result);
                         if (result <= 0 || result > 999)
                         {
                             this.ShowMsg("数值必须在1~999之间的正整数", false);
                         }
                         else
                         {
                             branchAddDistributors.exportdistirbutors = MemberHelper.BatchCreateMembers(this.CreateDistributros(result), referruserId, "1");
                             this.ShowMsg("批量制作成功", true);
                             if (branchAddDistributors.exportdistirbutors != null && branchAddDistributors.exportdistirbutors.Count > 0)
                             {
                                 this.btnExport.Visible = true;
                                 this.btnExport.Text    = "导出分销商";
                             }
                         }
                     }
                 }
                 else
                 {
                     string str2 = this.txtdistributornames.Value;
                     System.Collections.Generic.IList <string> distributornames = new System.Collections.Generic.List <string>();
                     if (string.IsNullOrEmpty(str2))
                     {
                         this.ShowMsg("请输入要制作的账号", false);
                     }
                     else
                     {
                         bool     flag  = false;
                         string[] array = str2.Split(new string[]
                         {
                             "\r\n"
                         }, System.StringSplitOptions.None);
                         for (int i = 0; i < array.Length; i++)
                         {
                             string str3 = array[i];
                             if (string.IsNullOrEmpty(str3) || str3.Length < 2 || str3.Length > 10)
                             {
                                 flag = true;
                                 break;
                             }
                             distributornames.Add(str3);
                         }
                         if (flag)
                         {
                             this.ShowMsg("每个账号长度在2~10个字符", false);
                         }
                         else
                         {
                             branchAddDistributors.exportdistirbutors = MemberHelper.BatchCreateMembers(distributornames, referruserId, "2");
                             if (branchAddDistributors.exportdistirbutors != null && branchAddDistributors.exportdistirbutors.Count > 0)
                             {
                                 this.btnExport.Visible = true;
                                 this.btnExport.Text    = "导出失败分销商";
                                 this.ShowMsg("生成成功,分销商账号已存在!", true);
                             }
                             else
                             {
                                 this.btnExport.Visible = false;
                                 this.ShowMsg("生成成功!", true);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (System.Exception)
     {
         throw;
     }
 }
 private void batchCreate_Click(object sender, EventArgs e)
 {
     try
     {
         string distributorname = this.txtslsdistributors.Value;
         int    referruserId    = MemberHelper.IsExiteDistributorNames(distributorname);
         if (string.IsNullOrEmpty(distributorname) || (referruserId <= 0))
         {
             this.ShowMsg("输入的推荐分销商不存在!", false);
         }
         else if (this.radionumber.Checked)
         {
             if (string.IsNullOrEmpty(this.txtnumber.Value.Trim()))
             {
                 this.ShowMsg("请输入要生成的账号数量", false);
             }
             else
             {
                 int result = 0;
                 int.TryParse(this.txtnumber.Value, out result);
                 if ((result <= 0) || (result > 0x3e7))
                 {
                     this.ShowMsg("数值必须在1~999之间的正整数", false);
                 }
                 else if (this.CheckDistributorIsCanAuthorization(result))
                 {
                     exportdistirbutors = MemberHelper.BatchCreateMembers(this.CreateDistributros(result), referruserId, "1");
                     this.ShowMsg("批量制作成功", true);
                     if ((exportdistirbutors != null) && (exportdistirbutors.Count > 0))
                     {
                         this.btnExport.Visible = true;
                         this.btnExport.Text    = "导出分销商";
                     }
                 }
             }
         }
         else
         {
             string         str2             = this.txtdistributornames.Value;
             IList <string> distributornames = new List <string>();
             if (string.IsNullOrEmpty(str2))
             {
                 this.ShowMsg("请输入要制作的账号", false);
             }
             else
             {
                 bool     flag   = false;
                 string[] source = str2.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                 if (this.CheckDistributorIsCanAuthorization(source.Count <string>()))
                 {
                     foreach (string str3 in source)
                     {
                         if ((string.IsNullOrEmpty(str3) || (str3.Length < 6)) || (str3.Length > 50))
                         {
                             flag = true;
                             break;
                         }
                         distributornames.Add(str3);
                     }
                     if (flag)
                     {
                         this.ShowMsg("每个账号长度在2~10个字符", false);
                     }
                     else
                     {
                         exportdistirbutors = MemberHelper.BatchCreateMembers(distributornames, referruserId, "2");
                         if ((exportdistirbutors != null) && (exportdistirbutors.Count > 0))
                         {
                             this.btnExport.Visible = true;
                             this.btnExport.Text    = "导出失败分销商";
                             this.ShowMsg("部份分销商生成失败,请查看导出文档!", true);
                         }
                         else
                         {
                             this.btnExport.Visible = false;
                             this.ShowMsg("生成成功!", true);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #3
0
 private void batchCreate_Click(object sender, System.EventArgs e)
 {
     try
     {
         string value = this.txtslsdistributors.Value;
         int    num   = MemberHelper.IsExiteDistributorNames(value);
         if (string.IsNullOrEmpty(value) || num <= 0)
         {
             this.ShowMsg("输入的推荐分销商不存在!", false);
         }
         else if (this.radionumber.Checked)
         {
             if (string.IsNullOrEmpty(this.txtnumber.Value.Trim()))
             {
                 this.ShowMsg("请输入要生成的账号数量", false);
             }
             else
             {
                 int num2 = 0;
                 int.TryParse(this.txtnumber.Value, out num2);
                 if (num2 <= 0 || num2 > 999)
                 {
                     this.ShowMsg("数值必须在1~999之间的正整数", false);
                 }
                 else if (this.CheckDistributorIsCanAuthorization(num2))
                 {
                     System.Collections.Generic.IList <string> distributornames = this.CreateDistributros(num2);
                     BranchAddDistributors.exportdistirbutors = MemberHelper.BatchCreateMembers(distributornames, num, "1");
                     this.ShowMsg("批量制作成功", true);
                     if (BranchAddDistributors.exportdistirbutors != null && BranchAddDistributors.exportdistirbutors.Count > 0)
                     {
                         this.btnExport.Visible = true;
                         this.btnExport.Text    = "导出分销商";
                     }
                 }
             }
         }
         else
         {
             string value2 = this.txtdistributornames.Value;
             System.Collections.Generic.IList <string> list = new System.Collections.Generic.List <string>();
             if (string.IsNullOrEmpty(value2))
             {
                 this.ShowMsg("请输入要制作的账号", false);
             }
             else
             {
                 bool     flag  = false;
                 string[] array = value2.Split(new string[]
                 {
                     "\r\n"
                 }, System.StringSplitOptions.None);
                 if (this.CheckDistributorIsCanAuthorization(array.Count <string>()))
                 {
                     string[] array2 = array;
                     for (int i = 0; i < array2.Length; i++)
                     {
                         string text = array2[i];
                         if (string.IsNullOrEmpty(text) || text.Length < 6 || text.Length > 50)
                         {
                             flag = true;
                             break;
                         }
                         list.Add(text);
                     }
                     if (flag)
                     {
                         this.ShowMsg("每个账号长度在2~10个字符", false);
                     }
                     else
                     {
                         BranchAddDistributors.exportdistirbutors = MemberHelper.BatchCreateMembers(list, num, "2");
                         if (BranchAddDistributors.exportdistirbutors != null && BranchAddDistributors.exportdistirbutors.Count > 0)
                         {
                             this.btnExport.Visible = true;
                             this.btnExport.Text    = "导出失败分销商";
                             this.ShowMsg("部份分销商生成失败,请查看导出文档!", true);
                         }
                         else
                         {
                             this.btnExport.Visible = false;
                             this.ShowMsg("生成成功!", true);
                         }
                     }
                 }
             }
         }
     }
     catch (System.Exception)
     {
         throw;
     }
 }