コード例 #1
0
ファイル: quanlikhachhang.cs プロジェクト: hieudm97/NMPM_MV4R
 private void button3_Click(object sender, EventArgs e)
 {
     /*thêm khách hàng vào trong DB*/
     //khởi tạo thông tin cần thiết
     try
     {
         int      ID       = int.Parse(txt_makhachang.Text);
         string   TEN      = txt_hoten.Text;
         int      TUOI     = int.Parse(txt_tuoi.Text);
         DateTime NGAYSINH = DateTime.ParseExact(txt_ngaysinh.Text, "ddMMyyyy",
                                                 System.Globalization.CultureInfo.InvariantCulture);
         string TENCONGTY     = txt_tencongty.Text;
         string TENDANGNHAP   = txt_tendangnhap.Text;
         string MATKHAU       = txt_matkhau.Text;
         string LOAITHANHVIEN = cbo_loaithanhvien.Text;
         //thực hiện thao tác thêm
         if (lg.kiemtratendangnhap(TENDANGNHAP) == false)
         {
             lg.themkhachhang_GUI_nhanvien_quanlikh(TEN, TUOI,
                                                    NGAYSINH, TENCONGTY, TENDANGNHAP,
                                                    MATKHAU, LOAITHANHVIEN);
             //thông báo
             MessageBox.Show("CHÚC MỪNG BẠN VỪA THÊM THÀNH CÔNG KHÁCH HÀNG");
         }
         else
         {
             MessageBox.Show("TÊN ĐĂNG NHẬP CỦA BẠN ĐÃ ĐƯỢC SỬ DỤNG!!!");
         }
     }
     catch
     {
         MessageBox.Show("VUI LÒNG KIỂM TRA LẠI TOÀN BỘ THÔNG TIN VỪA NHẬP");
     }
 }