예제 #1
0
 public EmployeeClassification?GetEmployeeClassifications(int employeeClassificationKey)
 {
     using (var db = new OrmCookbook())
     {
         return(db.QueryProc <EmployeeClassification>("HR.GetEmployeeClassifications",
                                                      new DataParameter("@EmployeeClassificationKey", employeeClassificationKey)
                                                      ).SingleOrDefault());
     }
 }
예제 #2
0
        public int CreateEmployeeClassification(EmployeeClassification employeeClassification)
        {
            if (employeeClassification == null)
            {
                throw new ArgumentNullException(nameof(employeeClassification), $"{nameof(employeeClassification)} is null.");
            }

            //Notes:
            //LINQ to DB cannot return scalar values from stored procedures. A holder class is needed to receive the results.
            using (var db = new OrmCookbook())
                return(db.QueryProc <EmployeeClassificationKeyHolder>("HR.CreateEmployeeClassification",
                                                                      new DataParameter("@EmployeeClassificationName", employeeClassification.EmployeeClassificationName),
                                                                      new DataParameter("@IsExempt", employeeClassification.IsExempt),
                                                                      new DataParameter("@IsEmployee", employeeClassification.IsEmployee)
                                                                      ).Single().EmployeeClassificationKey);
        }
예제 #3
0
 public IList <EmployeeClassification> GetEmployeeClassifications()
 {
     using (var db = new OrmCookbook())
         return(db.QueryProc <EmployeeClassification>("HR.GetEmployeeClassifications").ToList());
 }
예제 #4
0
 public IList <EmployeeClassificationWithCount> CountEmployeesByClassification()
 {
     using (var db = new OrmCookbook())
         return(db.QueryProc <EmployeeClassificationWithCount>("HR.CountEmployeesByClassification").ToList());
 }