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 #2
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;
        }