protected void bt_OK_Click(object sender, EventArgs e)
 {
     CM_DIMembershipBLL ship = new CM_DIMembershipBLL();
     if (CM_DIMembershipBLL.GetByUserName(UserName.Text.Trim()).Rows.Count > 0)
     {
         MessageBox.Show(this, "用户名重复,请重新键入其他用户名!");
         return;
     }
     if (select_Client.SelectValue == "" || select_Client.SelectValue == "0")
     {
         MessageBox.Show(this, "请选择账号所属经销商!");
         return;
     }
     ship.Model.UserName = UserName.Text.Trim();
     ship.Model.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Password.Text, "md5");
     ship.Model.IsApproved = 1;
     ship.Model.IsLockedOut = 0;
     int shipid = ship.Add();
     if (shipid > 0)
     {
         CM_DIUsersBLL BLL = new CM_DIUsersBLL();
         BLL.Model.Client = int.Parse(select_Client.SelectValue);
         BLL.Model.ShipID = shipid;
         if (BLL.Add() > 0)
             MessageBox.ShowAndRedirect(this, "创建成功!", "DIUserList.aspx");
     }
     else
         MessageBox.Show(this, "账号创建出错,请联系管理员!");
 }
    protected void bt_OK_Click(object sender, EventArgs e)
    {
        CM_DIMembershipBLL ship = new CM_DIMembershipBLL();

        if (CM_DIMembershipBLL.GetByUserName(UserName.Text.Trim()).Rows.Count > 0)
        {
            MessageBox.Show(this, "用户名重复,请重新键入其他用户名!");
            return;
        }
        if (select_Client.SelectValue == "" || select_Client.SelectValue == "0")
        {
            MessageBox.Show(this, "请选择账号所属经销商!");
            return;
        }
        ship.Model.UserName    = UserName.Text.Trim();
        ship.Model.Password    = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(Password.Text, "md5");
        ship.Model.IsApproved  = 1;
        ship.Model.IsLockedOut = 0;
        int shipid = ship.Add();

        if (shipid > 0)
        {
            CM_DIUsersBLL BLL = new CM_DIUsersBLL();
            BLL.Model.Client = int.Parse(select_Client.SelectValue);
            BLL.Model.ShipID = shipid;
            if (BLL.Add() > 0)
            {
                MessageBox.ShowAndRedirect(this, "创建成功!", "DIUserList.aspx");
            }
        }
        else
        {
            MessageBox.Show(this, "账号创建出错,请联系管理员!");
        }
    }
 protected void btn_Add_Click(object sender, EventArgs e)
 {
     if (select_Client.SelectValue != "" && select_Client.SelectValue != "0")
     {
         int client = int.Parse(select_Client.SelectValue);
         if (CM_DIUsersBLL.GetModelList("ShipID=" + ViewState["ShipID"] + " AND Client=" + client).Count > 0)
         {
             MessageBox.Show(this,"该经销商已添加!");
             return;
         }
         CM_DIUsersBLL user = new CM_DIUsersBLL();
         user.Model.Client = client;
         user.Model.ShipID = (int)ViewState["ShipID"];
         if (user.Add() > 0)
             BindGrid();
         else MessageBox.Show(this, "添加失败!");
     }
 }
 protected void btn_Add_Click(object sender, EventArgs e)
 {
     if (select_Client.SelectValue != "" && select_Client.SelectValue != "0")
     {
         int client = int.Parse(select_Client.SelectValue);
         if (CM_DIUsersBLL.GetModelList("ShipID=" + ViewState["ShipID"] + " AND Client=" + client).Count > 0)
         {
             MessageBox.Show(this, "该经销商已添加!");
             return;
         }
         CM_DIUsersBLL user = new CM_DIUsersBLL();
         user.Model.Client = client;
         user.Model.ShipID = (int)ViewState["ShipID"];
         if (user.Add() > 0)
         {
             BindGrid();
         }
         else
         {
             MessageBox.Show(this, "添加失败!");
         }
     }
 }