Exemple #1
0
 private void chỉnhSửaThôngTinCáNhânToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!CheckExitsForm("frm_SuaTKCaNhan"))
     {
         frm_SuaTKCaNhan STKCN = new frm_SuaTKCaNhan();
         STKCN.MdiParent = this;
         //STKCN.MdiParent = this;
         STKCN.Show();
     }
     else ActiveChildForm("frm_SuaTKCaNhan");
 }
        private void btn_save_Click(object sender, EventArgs e)
        {
            frm_QuanLiNguoiDung QLND = new frm_QuanLiNguoiDung();
            user us = new user();
            frm_SuaTKCaNhan TTCN = new frm_SuaTKCaNhan();
            if (txt_username.Text == "")
            {
                MessageBox.Show("Xin nhập tên người dùng ");
                txt_username.Focus();

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

            }
            //else if (TTCN.IsNumber(txt_phone.Text) == false)
            //{
            //    MessageBox.Show("Bạn phải nhập định dạng số cho điện thoại");
            //    txt_phone.Focus();
            //}
            else
            {
                us.username = txt_username.Text;
                us.password = txt_password.Text;
                if(txt_email.Text !="")
                {
                    us.Email = txt_email.Text;
                }
                else
                {
                    us.Email = null;
                }
                if (txt_name.Text != "")
                {
                    us.HoTen = txt_name.Text;
                }
                else
                {
                    us.HoTen = null;
                }
                if (txt_phone.Text != "")
                {
                    us.Phone = int.Parse(txt_phone.Text);
                }
                else
                {
                    us.Phone = null;
                }
                db.users.InsertOnSubmit(us);
                db.SubmitChanges();
                redgv();
                dgv_TaiKhoan.Enabled = true;
                MessageBox.Show("Thêm mới thánh công");
                reset();
                btn_add.Focus();
                an();
                btn_delete.Enabled = true;
            }
        }