Пример #1
0
 private void quảnLýNgườiDùngToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!CheckExitsForm("frmManagerUsers"))
     {
         frmManagerUsers QLND = new frmManagerUsers();
         QLND.MdiParent = this;
         QLND.Show();
     }
     else ActiveChildForm("frmManagerUsers");
 }
Пример #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            frmManagerUsers QLND = new frmManagerUsers();
            user us = new user();
            //frmRepairInformationPersonal TTCN = new frmRepairInformationPersonal();
            if (txtUsername.Text == "")
            {
                MessageBox.Show("Xin nhập tên người dùng ");
                txtUsername.Focus();

            }
            else if (txtPassword.Text == "")
            {
                MessageBox.Show("Xin nhập mật khẩu ");
                txtPassword.Focus();

            }
            else if (txtConfirmPassword.Text != txtPassword.Text)
            {
                MessageBox.Show("Bạn phải nhập đúng mật khẩu !");
                txtConfirmPassword.Text = "";
                txtConfirmPassword.Focus();
            }
            else if ((txtPhone.Text !="") && (IsNumber(txtPhone.Text) == false))
            {

                MessageBox.Show("Bạn phải nhập định dạng số cho điện thoại");
                txtPhone.Text = "";
                txtPhone.Focus();

            }
            else
            {
                us.username = txtUsername.Text;
                us.password = txtPassword.Text.ToMD5();

                if (txtName.Text != "")
                {
                    us.HoTen = txtName.Text;
                }
                else
                {
                    us.HoTen = null;
                }
                if (txtPhone.Text != "")
                {
                    us.Phone = int.Parse(txtPhone.Text);
                }
                else
                {
                    us.Phone = null;
                }
                db.users.InsertOnSubmit(us);
                db.SubmitChanges();
                redgv();
                dgvUsers.Enabled = true;
                MessageBox.Show("Thêm mới thánh công");
                reset();
                btnAdd.Focus();
                an();
                btnDelete.Enabled = true;

            }
        }