Example #1
0
        public IEnumerable<Rent> Get(Employee employee)
        {            
			/*using (*/IDbConnection conn = this.Connection;//)
			{
                return conn.Query<Rent>(cSelectRentsForEmployee_SQL, new { EmployeeID = employee.EmployeeID });
            }
        }
Example #2
0
 internal static IEnumerable<DailyGross> GetDailyGrosses(IDatabase db, Employee emp, DateTime start, DateTime end)
 {
     using (IDbConnection conn = db.Create())
     {
         conn.Open();
         var rent = conn.Query<Rent>("SELECT * FROM Rent WHERE EmployeeID = @ID", new { ID = emp.EmployeeID }).First();
         return conn.Query<DailyGross>("SELECT * FROM DailyGross WHERE RentID = @RentID AND GrossTDS between @StartTDS and @EndTDS", new { RentID = rent.RentID, StartTDS = start, EndTDS = end });
     }
 }
Example #3
0
 internal static IEnumerable<DailyGross> GetDailyGrosses(IDatabase db, Employee emp)
 {
     using (IDbConnection conn = db.Create())
     {
         conn.Open();                
         var rent = conn.Query<Rent>("SELECT * FROM Rent WHERE EmployeeID = @ID", new { ID = emp.EmployeeID }).First();
         return conn.Query<DailyGross>("SELECT * FROM DailyGross WHERE RentID = @RentID", new { RentID = rent.RentID});                
     }
 }
        public IEnumerable<DailyGross> Get(Employee employee, DateTime start, DateTime end)
        {            
			/*using (*/IDbConnection conn = this.Connection;//)
			{
                Rent r = employee.EffectiveRent(start);
                return conn.Query<DailyGross>(cSelectDailyGrossesForEmployee_SQL, new {
                    RentID = r.RentID, StartTDS = start, EndTDS = end
                });
			}
         
        }
        public void Update(Employee employee, DailyGross dg)
        {
			/*using (*/IDbConnection conn = this.Connection;//)
			{
                conn.Execute(cUpdateDailyGrossForEmployee_SQL, new {
                    DailyGrossID = dg.DailyGrossID,
                    RentID = employee.EffectiveRent(dg.GrossTDS).RentID,
                    Gross = dg.Gross,
                    GrossTDS = dg.GrossTDS,
                    ModifiedBy = dg.ModifiedBy,
                    ModifiedTDS = dg.ModifiedTDS
                });
			}
        }
Example #6
0
        private IEnumerable<DailyGross> LoadDailyGrosses(Employee emp, DateTime start, DateTime end)
        {
            var list = _dgrepos.Get(emp, start, end);
            var grosses = new List<DailyGross>();
            for (var s = start; s <= end; s = s.AddDays(1)) 
            {
                var gross = list.Count() > 0
                    ? list.Where((g) => { return g.GrossTDS.Year == s.Year && g.GrossTDS.Month == s.Month && g.GrossTDS.Day == s.Day; }).FirstOrDefault()
                    : null;
                if (gross == null)
                {
                    gross = new DailyGross {
                        GrossTDS = s,
                        Gross = 0,
                        ModifiedTDS = DateTime.Now,
                        ModifiedBy = "admin",
                        Dirty = true
                    };
                }
                grosses.Add(gross);
            }

            return grosses;
        }
Example #7
0
 public EmployeePayroll(Employee emp, DateTime start) 
 {
     this.Employee = emp;
     _start = start;
 }