public TimesheetCollection FetchByQuery(Query qry) { TimesheetCollection coll = new TimesheetCollection(); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public TimesheetCollection FetchAll() { TimesheetCollection coll = new TimesheetCollection(); Query qry = new Query(Timesheet.Schema); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public TimesheetCollection FetchAllByPeriodAccountId(int periodAccountId) { TimesheetCollection coll = new TimesheetCollection(); Query qry = new Query(Timesheet.Schema); qry.WHERE(Timesheet.Columns.Periodaccountid, periodAccountId); coll.LoadAndCloseReader(qry.ExecuteReader()); return(coll); }
public TimesheetCollection FetchORCreateByUsernamePeriodID(String Username, Int32 PeriodAccountID) { TimesheetCollection col = FetchByUsernamePeriodID(Username, PeriodAccountID); var user = new UserController().ByUsername(Username); if (col.Count == 0 && user != null) { Insert(Username, PeriodAccountID, user.Rategroup); } return(FetchByUsernamePeriodID(Username, PeriodAccountID)); }
public Double GetMileageCountByBillingPeriodAccountID(Int32 BillingPeriodAccountID) { Double total = 0; TimesheetCollection col = this.FetchAll(); foreach (Timesheet timesheet in col) { if (timesheet.Periodaccountid == BillingPeriodAccountID) { total += timesheet.Mileageclaimed; } } return(total); }
public Double GetPerDiemCountByBillingPeriodAccountID(Int32 BillingPeriodAccountID) { var timesheetBillingRateCityJoin = new TimesheetBillingCityRateJoinController(); var cityPerdiemCountTotal = 0; Double total = 0; TimesheetCollection col = this.FetchAllByPeriodAccountId(BillingPeriodAccountID); foreach (Timesheet timesheet in col) { cityPerdiemCountTotal += timesheetBillingRateCityJoin.CityPerDiemCountGrandTotalByTimesheetId(timesheet.Id); total += timesheet.Perdiemcount; } return(cityPerdiemCountTotal > 0 ? cityPerdiemCountTotal : total); }
public Double GetPerCityDiemRateAverageByBillingPeriodAccountID(Int32 BillingPeriodAccountID) { var timesheetBillingRateCityJoin = new TimesheetBillingCityRateJoinController(); var cityPerdiemRateAverageTotal = 0.00; Double total = 0; TimesheetCollection col = this.FetchAllByPeriodAccountId(BillingPeriodAccountID); foreach (Timesheet timesheet in col) { cityPerdiemRateAverageTotal += timesheetBillingRateCityJoin.CityPerDiemHourlyRateAverageByTimesheetId(timesheet.Id); } if (col.Count > 0) { cityPerdiemRateAverageTotal = cityPerdiemRateAverageTotal / col.Count; } return(cityPerdiemRateAverageTotal); }
public TimesheetCollection FetchByID(object Id) { TimesheetCollection coll = new TimesheetCollection().Where("id", Id).Load(); return(coll); }