Ejemplo n.º 1
0
 private void buttonSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string id   = textBoxID.Text;
         string role = comboBoxRole.SelectedItem.ToString();
         if (!id.Equals("") && !role.Equals(""))
         {
             cm = new ClassMain();
             ds = cm.UpdateUserRole(id, role);
             if (ds != null)
             {
                 //MessageBox.Show("修改成功");
                 ans = true;
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("无效输入!请重新输入", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show("修改成功");
         //MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 2
0
 private void buttonSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         String oldpwd  = textBoxOldPwd.Text;
         String newpwd  = textBoxNewPwd.Text;
         String newpwd2 = textBoxNewPwd2.Text;
         if (newpwd.Equals(newpwd2))
         {
             cm = new ClassMain();
             ds = cm.UpdateUserPwd(id, oldpwd, newpwd);
             if (ds != null)
             {
                 //MessageBox.Show("修改成功");
                 ans = true;
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("两次密码输入不一致!");
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show("修改成功");
         //MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            String id = textBox1.Text;

            try
            {
                cm = new ClassMain();
                ds = cm.DelUser(id);

                if (ds != null)
                {
                    //MessageBox.Show("删除成功");
                    ans = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("输入的账号不存在");
                }
            }catch (SqlException ex)
            {
                MessageBox.Show("删除成功");
                //MessageBox.Show(ex.Message);
            }
            finally
            {
                cm.Closecon();
            }
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClassMain mainTest = new ClassMain();

            if (mainTest.Checkin(textBoxUserID.Text, textBoxPwd.Text))
            {
                string role = mainTest.GetRole();
                if (role.Equals("管理员"))
                {
                    /*
                     * MF mf = new MF();
                     * this.Visible = false;
                     * mf.ShowDialog();
                     * this.Dispose();
                     * this.Close();
                     */
                    FormMain fm = new FormMain();
                    this.Visible = false;
                    fm.ShowDialog();
                    this.Dispose();
                    this.Close();
                }
                else if (role.Equals("采购员"))
                {
                    FormBuyer fb = new FormBuyer();
                    this.Visible = false;
                    fb.Setid(textBoxUserID.Text);
                    fb.ShowDialog();

                    this.Dispose();
                    this.Close();
                }
                else if (role.Equals("配送员"))
                {
                    FormDeliveryStaff fds = new FormDeliveryStaff();
                    this.Visible = false;
                    fds.Setid(textBoxUserID.Text);
                    fds.ShowDialog();
                    this.Dispose();
                    this.Close();
                }

                /*
                 * else if(role.Equals("客户"))
                 * {
                 *  FormUser fu=new FormUser();
                 *  this.Visible = false;
                 *  fu.Setid(textBoxUserID.Text);
                 *  fu.ShowDialog();
                 *  this.Dispose();
                 *  this.Close();
                 * }
                 */
            }


            mainTest.Closecon();
        }
Ejemplo n.º 5
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         mainLogic = new ClassMain();
         FormChangePwd fcp = new FormChangePwd();
         fcp.Setid(Getid());
         fcp.ShowDialog();
         if (fcp.getAns())//修改成功 刷新数据
         {
             MessageBox.Show("修改成功");
         }
         else
         {
             MessageBox.Show("修改失败");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("修改成功");
         //MessageBox.Show(ex.Message);
     }
 }