예제 #1
0
 public NHANVIEN Staff_ID_DAL(int id)
 {
     using (var staff = new PBL3_QLTraSuaEntities())
     {
         return(staff.NHANVIENs.Where(p => (p.ID_NV) == id).FirstOrDefault());
     }
 }
예제 #2
0
        public string getNameTable(int IDBAN)
        {
            db = new PBL3_QLTraSuaEntities();
            BAN ban = db.BANs.FirstOrDefault(p => p.ID_BAN == IDBAN);

            if (ban == null)
            {
                return("");
            }
            else
            {
                return(ban.Tenban);
            }
        }
예제 #3
0
        public bool ChangeAccount(int username, NHANVIEN after)    //NHANVIEN before
        {
            db = new PBL3_QLTraSuaEntities();
            var s = db.NHANVIENs.Where(p => p.ID_NV == username).FirstOrDefault();

            s.Ten_NV   = after.Ten_NV;
            s.password = after.password;
            try
            {
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #4
0
 public bool Delete(NHANVIEN temp)
 {
     try
     {
         using (var newStaff = new PBL3_QLTraSuaEntities())
         {
             newStaff.Entry(temp).State = System.Data.Entity.EntityState.Deleted;
             newStaff.SaveChanges();
             MessageBox.Show("Thành Công");
             return(true);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Lỗi");
         return(false);
     }
 }
예제 #5
0
        public bool Update(NHANVIEN before, NHANVIEN after)    //NHANVIEN before
        {
            try
            {
                using (PBL3_QLTraSuaEntities db = new PBL3_QLTraSuaEntities())  //var newStaff = new PBL3_QLTraSuaEntities()
                {
                    before             = db.NHANVIENs.Where(p => p.ID_NV.Equals(before.ID_NV)).SingleOrDefault();
                    before.Ten_NV      = after.Ten_NV;
                    before.PhoneNumber = after.PhoneNumber;
                    before.Gender      = after.Gender;
                    db.SaveChanges();

                    MessageBox.Show("Thành Công");
                    return(true);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Lỗi ");
                return(false);
            }
        }
예제 #6
0
        public List <NHANVIEN> GetList()
        {
            PBL3_QLTraSuaEntities db = new PBL3_QLTraSuaEntities();

            List <NHANVIEN> list      = db.NHANVIENs.ToList();
            List <NHANVIEN> listStaff = new List <NHANVIEN>();
            NHANVIEN        temp      = new NHANVIEN();

            foreach (var item in list)
            {
                listStaff.Add(new NHANVIEN
                {
                    ID_NV       = item.ID_NV,
                    Phanquyen   = item.Phanquyen,
                    Gender      = item.Gender,
                    password    = item.password,
                    Ten_NV      = item.Ten_NV,
                    PhoneNumber = item.PhoneNumber
                });
            }

            return(list);
        }
예제 #7
0
        public bool ResetPassword_DAL(string username, string newpassword)
        {
            db = new PBL3_QLTraSuaEntities();
            var s = db.NHANVIENs.Where(p => p.PhoneNumber == username).FirstOrDefault();

            s.password = newpassword;
            try
            {
                db.SaveChanges();
                return(true);
            }
            catch (DbEntityValidationException ex)
            {
                foreach (var entityValidationErrors in ex.EntityValidationErrors)
                {
                    foreach (var validationError in entityValidationErrors.ValidationErrors)
                    {
                        Console.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
                    }
                }
                return(false);
            }
        }
예제 #8
0
 public BAN gettable(int idban)
 {
     db = new PBL3_QLTraSuaEntities();
     return(db.BANs.FirstOrDefault(p => p.ID_BAN == idban));
 }
예제 #9
0
 Table_DAL()
 {
     db = new PBL3_QLTraSuaEntities();
 }
예제 #10
0
 public Staff_DAL()
 {
     db = new PBL3_QLTraSuaEntities();
 }
예제 #11
0
 public Category_Merchandise_DAL()
 {
     db = new PBL3_QLTraSuaEntities();
 }
예제 #12
0
 public CHI_TIET_HOA_DON_DAL()
 {
     db = new PBL3_QLTraSuaEntities();
 }
예제 #13
0
 public Account_DAL()
 {
     db = new PBL3_QLTraSuaEntities();
 }
예제 #14
0
 public Merchandise_DAL()
 {
     db = new PBL3_QLTraSuaEntities();
 }
예제 #15
0
 public Customer_DAL()
 {
     db = new PBL3_QLTraSuaEntities();
 }
예제 #16
0
 public HOA_DON_DAL()
 {
     db = new PBL3_QLTraSuaEntities();
 }
예제 #17
0
 public BillInfo_DAL()
 {
     db = new PBL3_QLTraSuaEntities();
 }