示例#1
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);
     }
 }
示例#2
0
        public static bool deletePhong(QuanLyHomestayEntities db, HOADON hd)
        {
            db = new QuanLyHomestayEntities();

            db.HOADONs.Attach(hd);
            db.HOADONs.Remove(hd);
            db.SaveChanges();
            return(true);
        }
示例#3
0
        public static bool checkTK(string a)
        {
            QuanLyHomestayEntities db = new QuanLyHomestayEntities();
            TAIKHOAN s = (from i in db.TAIKHOANs where i.TaiKhoan1.Equals(a) select i).FirstOrDefault();

            if (s != null)
            {
                return(true);
            }
            return(false);
        }
示例#4
0
 public static bool testLogin(string tk, string mk)
 {
     db = new QuanLyHomestayEntities();
     try
     {
         TAIKHOAN s = (from i in db.TAIKHOANs where i.TaiKhoan1 == tk && i.Matkhau == mk select i).FirstOrDefault();
         if (s != null)
         {
             return(true);
         }
     }
     catch
     {
     }
     return(false);
 }
示例#5
0
 public Confirm(HOADON obj, string status)
 {
     InitializeComponent();
     db = new QuanLyHomestayEntities();
     lOAIPHONGBindingSource.DataSource = db.LOAIPHONGs.ToList();
     if (status.Equals("add"))
     {
         bindingSource1.DataSource = obj;
         hd = obj;
         LOAIPHONG p = (from i in db.LOAIPHONGs where i.MaLoaiPhong == obj.MaLoaiPhong select i).FirstOrDefault();
         textBox1.Text = p.TenLoaiPhong;
         this.status   = status;
     }
     else if (status.Equals("edit"))
     {
         bindingSource1.DataSource = obj;
         hd = obj;
         db.HOADONs.Attach(hd);
         unlock();
         this.status = status;
     }
 }
示例#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);
     }
 }
示例#7
0
        public static List <TAIKHOAN> LayDuLieu()
        {
            QuanLyHomestayEntities db = new QuanLyHomestayEntities();

            return((from i in db.TAIKHOANs select i).ToList());
        }
示例#8
0
 public fmDangKi()
 {
     InitializeComponent();
     db = new QuanLyHomestayEntities();
 }