public NHANVIEN Staff_ID_DAL(int id) { using (var staff = new PBL3_QLTraSuaEntities()) { return(staff.NHANVIENs.Where(p => (p.ID_NV) == id).FirstOrDefault()); } }
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); } }
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); } }
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); } }
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); } }
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); }
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); } }
public BAN gettable(int idban) { db = new PBL3_QLTraSuaEntities(); return(db.BANs.FirstOrDefault(p => p.ID_BAN == idban)); }
Table_DAL() { db = new PBL3_QLTraSuaEntities(); }
public Staff_DAL() { db = new PBL3_QLTraSuaEntities(); }
public Category_Merchandise_DAL() { db = new PBL3_QLTraSuaEntities(); }
public CHI_TIET_HOA_DON_DAL() { db = new PBL3_QLTraSuaEntities(); }
public Account_DAL() { db = new PBL3_QLTraSuaEntities(); }
public Merchandise_DAL() { db = new PBL3_QLTraSuaEntities(); }
public Customer_DAL() { db = new PBL3_QLTraSuaEntities(); }
public HOA_DON_DAL() { db = new PBL3_QLTraSuaEntities(); }
public BillInfo_DAL() { db = new PBL3_QLTraSuaEntities(); }