Exemple #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (admin.UserID1 == -1)
            {
                //新增
                if (txtPwd.Text.Trim() == txtPwd2.Text.Trim())
                {
                    string      userName = txtUserName.Text.Trim();
                    string      pwd      = txtPwd.Text.Trim();
                    string      pwd2     = txtPwd2.Text.Trim();
                    string      name     = txtName.Text.Trim();
                    AdminsModel admin2   = new AdminsModel(userName, pwd, name);
                    int         result   = adminsBLL.getAddAdmin(admin2);
                    if (result > 0)
                    {
                        MessageBox.Show("OK");
                        this.Close();
                        SystemSettingsForm ssf = new SystemSettingsForm();
                        ssf.Show();
                    }
                    else
                    {
                        MessageBox.Show("NO");
                    }
                }
                else
                {
                    MessageBox.Show("密码不一致!请重新输入!");
                }
            }
            else
            {
                //修改

                if (txtPwd.Text.Trim() == txtPwd2.Text.Trim())
                {
                    string      userName = txtUserName.Text.Trim();
                    string      pwd      = txtPwd.Text.Trim();
                    string      pwd2     = txtPwd2.Text.Trim();
                    string      name     = txtName.Text.Trim();
                    AdminsModel admin2   = new AdminsModel(admin.UserID1, userName, pwd, name);
                    int         result   = adminsBLL.getUpdateAdmin(admin2);
                    if (result > 0)
                    {
                        MessageBox.Show("OK");
                        this.Close();
                        SystemSettingsForm ssf = new SystemSettingsForm();
                        ssf.Show();
                    }
                    else
                    {
                        MessageBox.Show("NO");
                    }
                }
                else
                {
                    MessageBox.Show("密码不一致!请重新输入!");
                }
            }
        }
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (vip.VGID1 == -1)
     {
         //新增
         string        top    = txtTop.Text.Trim();
         double        zk     = Convert.ToDouble(txtZk.Text.Trim());
         VipGradeModel vip2   = new VipGradeModel(top, zk);
         int           result = adminsBLL.getAddVip(vip2);
         if (result > 0)
         {
             MessageBox.Show("OK");
             this.Close();
             SystemSettingsForm ssf = new SystemSettingsForm();
             ssf.Show();
         }
         else
         {
             MessageBox.Show("NO");
         }
     }
     else
     {
         //修改
         string        top    = txtTop.Text.Trim();
         double        zk     = Convert.ToDouble(txtZk.Text.Trim());
         VipGradeModel vip2   = new VipGradeModel(vip.VGID1, top, zk);
         int           result = adminsBLL.getUpdateVip(vip2);
         if (result > 0)
         {
             MessageBox.Show("OK");
             this.Close();
             SystemSettingsForm ssf = new SystemSettingsForm();
             ssf.Show();
         }
         else
         {
             MessageBox.Show("NO");
         }
     }
 }