/// <summary>
        /// GetTotalHoursByEmployeeIdPeriodId
        /// </summary>
        /// <param name="employeeId">employeeId</param>
        /// <param name="date">date</param>
        /// <param name="projectTimeId">projectTimeId</param>
        /// <returns>total</returns>
        private double GetTotalHoursByEmployeeIdPeriodId(int employeeId, DateTime date, int projectTimeId)
        {
            double total = 0;
            PayPeriodGateway payPeriodGateway = new PayPeriodGateway(new DataSet());
            int periodId = payPeriodGateway.GetPayPeriodId(date);

            TimesheetNavigatorGateway timesheetNavigatorGateway = new TimesheetNavigatorGateway();
            timesheetNavigatorGateway.LoadByEmployeIdPayPeriodId(employeeId, periodId);

            foreach (TimesheetNavigatorTDS.LFS_PROJECT_TIMERow row in (TimesheetNavigatorTDS.LFS_PROJECT_TIMEDataTable)timesheetNavigatorGateway.Table)
            {
                if ((!row.IsStartTimeNull() && (!row.IsEndTimeNull())))
                {
                    if ((row.Date_ <= date) && (row.ProjectTimeID != projectTimeId))
                    {
                        if (!row.Deleted)
                        {
                            total = total + row.ProjectTime;
                        }
                    }
                    else
                    {
                        return total;
                    }
                }
            }

            return total;
        }
コード例 #2
0
        private TimesheetNavigatorTDS SubmitSearch()
        {
            // Load data
            TimesheetNavigatorGateway timesheetNavigatorGateway = new TimesheetNavigatorGateway();
            timesheetNavigatorGateway.LoadByEmployeIdPayPeriodId((int)ViewState["employee_id"], (int)ViewState["period_id"]);

            return (TimesheetNavigatorTDS)timesheetNavigatorGateway.Data;
        }
        /// <summary>
        /// GetTotalHoursByEmployeeIdPeriodId
        /// </summary>
        /// <param name="employeeId">employeeId</param>
        /// <param name="date">date</param>
        /// <returns>total</returns>
        private double GetTotalHoursByEmployeeIdPeriodId(int employeeId, DateTime date)
        {
            double total = 0;
            PayPeriodGateway payPeriodGateway = new PayPeriodGateway(new DataSet());
            int periodId = payPeriodGateway.GetPayPeriodId(date);

            TimesheetNavigatorGateway timesheetNavigatorGateway = new TimesheetNavigatorGateway();
            timesheetNavigatorGateway.LoadByEmployeIdPayPeriodId(employeeId, periodId);

            foreach (TimesheetNavigatorTDS.LFS_PROJECT_TIMERow row in (TimesheetNavigatorTDS.LFS_PROJECT_TIMEDataTable)timesheetNavigatorGateway.Table)
            {
                if (row.Date_ < date)
                {
                    if (!row.Deleted)
                    {
                        total = total + double.Parse(row.ProjectTime.ToString());
                    }
                }
            }

            return total;
        }