Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "" || textBox2.Text.Trim() == "" || textBox4.Text.Trim() == "")
            {
                MessageBox.Show("用户名密码不得为空!");
                return;
            }
            if (this.comboBox1.SelectedValue == null || this.comboBox2.SelectedValue == null)
            {
                MessageBox.Show("部门和角色必选!");
                return;
            }
            int          departant = Convert.ToInt32(this.comboBox1.SelectedValue.ToString());
            int          role      = Convert.ToInt32(this.comboBox2.SelectedValue.ToString());
            User         u         = new User(textBox1.Text, textBox2.Text, role, textBox4.Text);
            MessageModel msg       = uctrl.add(u);

            if (msg.Code == 0)
            {
                parentForm.loadData();
                this.Close();
            }
            else
            {
                MessageBox.Show(msg.Msg);
            }
        }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox2.Text == "")
     {
         MessageBox.Show("密码不能为空");
     }
     else if (textBox2.Text != textBox3.Text)
     {
         MessageBox.Show("二次密码不同");
         textBox3.Text = "";
     }
     else
     {
         MessageModel msg = uctrl.updatePwd(_id, textBox1.Text, textBox2.Text);
         if (msg.Code == 0)
         {
             parentForm.loadData();
             this.Close();
         }
         else
         {
             MessageBox.Show(msg.Msg);
         }
     }
 }