public EmployeeClassification?GetByKey(int employeeClassificationKey) { using (var db = new OrmCookbook()) { return(db.EmployeeClassification.Where(d => d.EmployeeClassificationKey == employeeClassificationKey).SingleOrDefault()); } }
public async Task <EmployeeClassification> FindByNameAsync(string employeeClassificationName) { using (var context = new OrmCookbook()) { return(await context.EmployeeClassifications.Where(ec => ec.EmployeeClassificationName == employeeClassificationName).SingleOrDefaultAsync()); } }
public EmployeeClassification GetByKeyOrException(int employeeClassificationKey) { using (var db = new OrmCookbook()) { return(db.EmployeeClassification.Where(ec => ec.EmployeeClassificationKey == employeeClassificationKey).Single()); } }
public IList <EmployeeClassification> GetAll() { using (var db = new OrmCookbook()) { return(db.EmployeeClassification.ToList()); } }
public EmployeeClassification?FindByNameOrNull(string employeeClassificationName) { using (var db = new OrmCookbook()) { return(db.EmployeeClassification.Where(ec => ec.EmployeeClassificationName == employeeClassificationName).SingleOrDefault()); } }
public EmployeeClassification FindByNameOrException(string employeeClassificationName) { using (var db = new OrmCookbook()) { return(db.EmployeeClassification.Where(ec => ec.EmployeeClassificationName == employeeClassificationName).Single()); } }
public bool DeleteByKeyWithStatus(int employeeClassificationKey) { using (var db = new OrmCookbook()) { return(1 == db.EmployeeClassification.Where(d => d.EmployeeClassificationKey == employeeClassificationKey).Delete()); } }
public async Task <IList <EmployeeClassification> > GetAllAsync() { using (var context = new OrmCookbook()) { return(await context.EmployeeClassifications.ToListAsync()); } }
public async Task <EmployeeClassification> GetByKeyAsync(int employeeClassificationKey) { using (var context = new OrmCookbook()) { return(await context.EmployeeClassifications.FindAsync(employeeClassificationKey)); } }
public IList <Employee> PaginateWithSkipTake(string lastName, int skip, int take) { using (var db = new OrmCookbook()) return(db.Employee.Where(e => e.LastName == lastName) .OrderBy(e => e.FirstName).ThenBy(e => e.EmployeeKey) .Skip(skip).Take(take).ToList()); }
public async Task <IList <EmployeeClassification> > GetAllAsync(CancellationToken cancellationToken = default) { using (var db = new OrmCookbook()) { return(await db.EmployeeClassification.ToListAsync().ConfigureAwait(false)); } }
public IList <Division> GetAllDivisions() { using (var context = new OrmCookbook()) { return(context.Divisions.ToList()); } }
public Department GetByKey(int departmentKey) { using (var context = new OrmCookbook()) { return(context.Departments.Include(d => d.Division).Where(d => d.DepartmentKey == departmentKey).SingleOrDefault()); } }
public async Task <EmployeeClassification?> GetByKeyAsync(int employeeClassificationKey, CancellationToken cancellationToken = default) { using (var db = new OrmCookbook()) { return(await db.EmployeeClassification.Where(d => d.EmployeeClassificationKey == employeeClassificationKey).SingleAsync().ConfigureAwait(false)); } }
public IList <Department> GetAll() { using (var context = new OrmCookbook()) { return(context.Departments.Include(d => d.Division).ToList()); } }
public override void Delete(int employeeClassificationKey) { using (var context = new OrmCookbook()) { context.Database.ExecuteSqlCommand("DELETE FROM HR.EmployeeClassification WHERE EmployeeClassificationKey = @p0", employeeClassificationKey); } }
public virtual EmployeeClassification GetByKey(int employeeClassificationKey) { using (var context = new OrmCookbook()) { return(context.EmployeeClassifications.Find(employeeClassificationKey)); } }
public virtual IList <EmployeeClassification> GetAll() { using (var context = new OrmCookbook()) { return(context.EmployeeClassifications.ToList()); } }
public virtual EmployeeClassification FindByName(string employeeClassificationName) { using (var context = new OrmCookbook()) { return(context.EmployeeClassifications.Where(ec => ec.EmployeeClassificationName == employeeClassificationName).SingleOrDefault()); } }
public IReadOnlyList <ReadOnlyEmployeeClassification> GetAll() { using (var db = new OrmCookbook()) { return(db.EmployeeClassification .Select(x => new ReadOnlyEmployeeClassification(x)).ToImmutableArray()); } }
public ReadOnlyEmployeeClassification GetByKey(int employeeClassificationKey) { using (var db = new OrmCookbook()) { return(db.EmployeeClassification.Where(d => d.EmployeeClassificationKey == employeeClassificationKey) .Select(x => new ReadOnlyEmployeeClassification(x)).Single()); } }
public override void Update(EmployeeClassification classification) { using (var context = new OrmCookbook()) { context.Entry(classification).State = EntityState.Modified; context.SaveChanges(); } }
public void Warmup() { //Make sure we can connect to the database. This will also pool a connection for future use. using (var db = new OrmCookbook()) { db.EmployeeClassification.ToList(); } }
public virtual void Update(EmployeeClassification classification) { using (var context = new OrmCookbook()) { var temp = context.EmployeeClassifications.Find(classification.EmployeeClassificationKey); temp.EmployeeClassificationName = classification.EmployeeClassificationName; context.SaveChanges(); } }
public EmployeeClassification?GetEmployeeClassifications(int employeeClassificationKey) { using (var db = new OrmCookbook()) { return(db.QueryProc <EmployeeClassification>("HR.GetEmployeeClassifications", new DataParameter("@EmployeeClassificationKey", employeeClassificationKey) ).SingleOrDefault()); } }
public IList <Employee> SortBy(string lastName, string sortByColumnA, bool isDescendingA, string sortByColumnB, bool isDescendingB) { using (var db = new OrmCookbook()) return(db.Employee.Where(x => x.LastName == lastName) .OrderBy(sortByColumnA, isDescendingA) .ThenBy(sortByColumnB, isDescendingB) .ToList()); }
public virtual void DeleteByKey(int employeeClassificationKey) { using (var db = new OrmCookbook()) { db.EmployeeClassification .Where(d => d.EmployeeClassificationKey == employeeClassificationKey) .Delete(); } }
public async Task DeleteByKeyAsync(int employeeClassificationKey) { using (var db = new OrmCookbook()) { await db.EmployeeClassification .Where(d => d.EmployeeClassificationKey == employeeClassificationKey) .DeleteAsync().ConfigureAwait(false); } }
public virtual int Create(EmployeeClassification classification) { using (var context = new OrmCookbook()) { context.EmployeeClassifications.Add(classification); context.SaveChanges(); return(classification.EmployeeClassificationKey); } }
public void InsertBatch(IList <Employee> employees) { var options = new BulkCopyOptions() { BulkCopyType = BulkCopyType.MultipleRows }; using (var db = new OrmCookbook()) db.BulkCopy(options, employees); }