public static bool AddOrUpdate(SalaryLevel input) { try { using (var _context = new DBOLabManagementEntities()) { _context.SalaryLevels.AddOrUpdate(input); _context.SaveChanges(); return(true); } } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { foreach (var ve in eve.ValidationErrors) { System.Windows.Forms.MessageBox.Show(ve.PropertyName.ToString() + eve.Entry.CurrentValues.GetValue <object>(ve.PropertyName).ToString() + ve.ErrorMessage.ToString()); } } return(false); } }
public static List <SalaryLevel> GetList() { using (var _context = new DBOLabManagementEntities()) { return((from u in _context.SalaryLevels select u).ToList()); } }
public static List <Project> GetList() { using (var _context = new DBOLabManagementEntities()) { return((from u in _context.Projects select u).ToList()); } }
public static void clearAllData() { using (var _context = new DBOLabManagementEntities()) { var temp = (from u in _context.SalaryLevels select u).ToList(); _context.SalaryLevels.RemoveRange(temp); _context.SaveChanges(); } }
public static void Delete(string MaCV) { using (var _context = new DBOLabManagementEntities()) { var find = (from u in _context.Jobs where u.MaCV == MaCV select u).ToList(); if (find.Count == 0) { return; } _context.Jobs.Remove(find[0]); _context.SaveChanges(); } }
public static decimal Salary(string Level) { using (var _context = new DBOLabManagementEntities()) { var temp = (from u in _context.SalaryLevels where u.HocVan.Trim() == Level select u).ToList(); if (temp.Count == 1) { return(temp[0].Luong); } else { return(0); }; } }
public static decimal Salary(string Positon) { using (var _context = new DBOLabManagementEntities()) { var temp = (from u in _context.SalaryPositions where u.ChucVu.Contains(Positon) == true select u).ToList(); if (temp.Count == 1) { return(temp[0].Luong); } else { return(0); }; } }
public static Member Get(string MaTV) { using (var _context = new DBOLabManagementEntities()) { var temp = (from u in _context.Members where u.MaTV == MaTV select u).ToList(); if (temp.Count == 1) { return(temp[0]); } else { return(null); }; } }