Example #1
0
 private void btnDangKi_Click(object sender, EventArgs e)
 {
     if (Register.checkMK(txtMatKhau.Text, txtXNMK.Text) == false)
     {
         MessageBox.Show("Mật khẩu xác nhận không đúng", "Thông báo", MessageBoxButtons.OKCancel);
     }
     else if (Register.checkTK(txtTaikhoan.Text) != true)
     {
         TAIKHOAN tk = new TAIKHOAN();
         tk.HoTen     = txtHoten.Text;
         tk.Email     = txtEmail.Text;
         tk.Matkhau   = txtMatKhau.Text;
         tk.TaiKhoan1 = txtTaikhoan.Text;
         tk.Phone     = txtPhone.Text;
         if (txtMatKhau.TextLength < 8 || txtMatKhau.TextLength > 16)
         {
             MessageBox.Show("Mật khẩu quá ngắn, mật khẩu tối thiểu là 8 kí tự và tối đa là 15 kí tự. \n\n Xin vui lòng nhập lại mật khẩu.", "", MessageBoxButtons.OKCancel);
             txtMatKhau.Focus();
         }
         else
         if (Register.addNew(db, tk))
         {
             MessageBox.Show("Đăng ký thành công.", "Thông báo", MessageBoxButtons.OKCancel);
             db.SaveChanges();
         }
         else
         {
             MessageBox.Show("Đăng ký không thành công. \n\nXin vui lòng đăng ký lai.", "Thông báo", MessageBoxButtons.OKCancel);
         }
     }
     else
     {
         MessageBox.Show("Tài khoản này hiện đã tồn tại. \n\nXin vui lòng nhập tài khoản khác.", "Thông báo", MessageBoxButtons.OKCancel);
     }
 }
Example #2
0
 public static bool addnewHoaDon(QuanLyHomestayEntities db, HOADON hd)
 {
     if (hd.NgayDen == null)
     {
         return(false);
     }
     else if (hd.NgayDen < DateTime.Today)
     {
         return(false);
     }
     else if (hd.NgayDen > hd.NgayDi)
     {
         return(false);
     }
     else if (hd.NgayDi == null)
     {
         return(false);
     }
     else if (hd.MaLoaiPhong == null)
     {
         return(false);
     }
     else if (hd.MaHoaDon == null)
     {
         return(false);
     }
     else
     {
         db.HOADONs.Add(hd);
         db.SaveChanges();
         return(true);
     }
 }
Example #3
0
        public static bool deletePhong(QuanLyHomestayEntities db, HOADON hd)
        {
            db = new QuanLyHomestayEntities();

            db.HOADONs.Attach(hd);
            db.HOADONs.Remove(hd);
            db.SaveChanges();
            return(true);
        }
Example #4
0
        private void btnGui_Click(object sender, EventArgs e)
        {
            DANHGIA dg = new DANHGIA();

            dg.MaLoaiPhong = comboBox1.SelectedValue.ToString();
            dg.DanhGia1    = textBox1.Text;
            db.DANHGIAs.Add(dg);
            db.SaveChanges();
            MessageBox.Show("Cảm ơn bạn đã thực hiện đánh giá này.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
Example #5
0
 private void btnXacNhan_Click(object sender, EventArgs e)
 {
     if (status.Equals("add"))
     {
         if (DatPhong.addnewHoaDon(db, hd))
         {
             MessageBox.Show("Cảm ơn bạn đã sử dụng dịch vụ của chúng tôi. Xin quý khách ghi nhớ mã hóa đơn để tiện cho việc nhận phòng. \n\n Mã hóa đơn của bạn là: " + hd.MaHoaDon, "thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Đặt phòng không thành công.");
         }
         this.Close();
     }
     else
     {
         hd.MaLoaiPhong = comboBox1.SelectedValue.ToString();
         hd.GiaTien     = textBox4.Text;
         MessageBox.Show("Bạn đã đổi phòng thành công.");
     }
     db.SaveChanges();
     this.Close();
 }
Example #6
0
 public static bool addNew(QuanLyHomestayEntities db, TAIKHOAN a)
 {
     if (checkTK(a.TaiKhoan1))
     {
         return(false);
     }
     else if (a.Matkhau == null || a.Matkhau == "")
     {
         return(false);
     }
     else if (a.Matkhau.Length < 8 || a.Matkhau.Length > 16)
     {
         return(false);
     }
     else if (a.HoTen == null || a.HoTen == "")
     {
         return(false);
     }
     else if (a.Phone == null || a.Phone == "")
     {
         return(false);
     }
     else if (a.TaiKhoan1 == null || a.TaiKhoan1 == "")
     {
         return(false);
     }
     else if (a != null)
     {
         db.TAIKHOANs.Add(a);
         db.SaveChanges();
         return(true);
     }
     else
     {
         return(false);
     }
 }