예제 #1
0
        public TimesheetCollection FetchByQuery(Query qry)
        {
            TimesheetCollection coll = new TimesheetCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
예제 #2
0
        public TimesheetCollection FetchAll()
        {
            TimesheetCollection coll = new TimesheetCollection();
            Query qry = new Query(Timesheet.Schema);

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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));
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        public TimesheetCollection FetchByID(object Id)
        {
            TimesheetCollection coll = new TimesheetCollection().Where("id", Id).Load();

            return(coll);
        }