Esempio n. 1
0
 public EmployeeClassification?GetByKey(int employeeClassificationKey)
 {
     using (var db = new OrmCookbook())
     {
         return(db.EmployeeClassification.Where(d => d.EmployeeClassificationKey == employeeClassificationKey).SingleOrDefault());
     }
 }
Esempio n. 2
0
 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());
     }
 }
Esempio n. 8
0
 public async Task <IList <EmployeeClassification> > GetAllAsync()
 {
     using (var context = new OrmCookbook())
     {
         return(await context.EmployeeClassifications.ToListAsync());
     }
 }
Esempio n. 9
0
 public async Task <EmployeeClassification> GetByKeyAsync(int employeeClassificationKey)
 {
     using (var context = new OrmCookbook())
     {
         return(await context.EmployeeClassifications.FindAsync(employeeClassificationKey));
     }
 }
Esempio n. 10
0
 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());
     }
 }
Esempio n. 20
0
 public IReadOnlyList <ReadOnlyEmployeeClassification> GetAll()
 {
     using (var db = new OrmCookbook())
     {
         return(db.EmployeeClassification
                .Select(x => new ReadOnlyEmployeeClassification(x)).ToImmutableArray());
     }
 }
Esempio n. 21
0
 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();
     }
 }
Esempio n. 23
0
 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();
     }
 }
Esempio n. 25
0
 public EmployeeClassification?GetEmployeeClassifications(int employeeClassificationKey)
 {
     using (var db = new OrmCookbook())
     {
         return(db.QueryProc <EmployeeClassification>("HR.GetEmployeeClassifications",
                                                      new DataParameter("@EmployeeClassificationKey", employeeClassificationKey)
                                                      ).SingleOrDefault());
     }
 }
Esempio n. 26
0
 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());
 }
Esempio n. 27
0
 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);
        }