Beispiel #1
0
        private void BindJobData(eTrafficSheetGrouping grouping)
        {
            var trafficAreaIDs = m_trafficSheetFilter.TrafficAreaIDs.ToArray();

            var jobStates = new int[m_trafficSheetFilter.JobStates.Count];

            for (int i = 0; i < m_trafficSheetFilter.JobStates.Count; i++)
            {
                if (m_trafficSheetFilter.JobStates[i] is eJobState)
                {
                    jobStates[i] = (int)(eJobState)m_trafficSheetFilter.JobStates[i];
                }
                else
                {
                    jobStates[i] = (int)(long)m_trafficSheetFilter.JobStates[i];
                }
            }

            // Refilter the jobs normally
            using (Facade.IJob facJob = new Facade.Job())
                m_dsJobsData = facJob.GetJobsForControlAreaPeriod(m_trafficSheetFilter.ControlAreaId, trafficAreaIDs, jobStates, false, m_trafficSheetFilter.OnlyShowMyJobs, m_trafficSheetFilter.OnlyShowJobsWithPCVs, m_trafficSheetFilter.OnlyShowJobsWithDemurrage, m_trafficSheetFilter.OnlyShowJobsWithDemurrageAwaitingAcceptance, ((Entities.CustomPrincipal)Page.User).IdentityId, m_trafficSheetFilter.FilterStartDate, m_trafficSheetFilter.FilterEnddate, m_trafficSheetFilter.BusinessTypes);

            // Sort and Bind
            DataView dvJobsData = new DataView(m_dsJobsData.Tables[0]);

            switch (grouping)
            {
            case eTrafficSheetGrouping.Organisation:
                dgBasicJobs.GroupBy = "OrganisationName";
                break;

            case eTrafficSheetGrouping.DepotCode:
                dgBasicJobs.GroupBy = "DepotCode";
                break;

            default:
                dgBasicJobs.GroupBy = "OrganisationName";
                break;
            }

            //if (((SortCriteria + " " + SortDirection).Trim().Length > 0) && (SortCriteria.StartsWith(dgBasicJobs.GroupingColumn)))
//				dvJobsData.Sort = SortCriteria + " " + SortDirection;
//			else
//				dvJobsData.Sort = dgBasicJobs.GroupingColumn + ", JobStartsAt";

            dgBasicJobs.DataSource = dvJobsData;
            dgBasicJobs.DataBind();

            // Display job count
            lblJobCount.Visible = true;
            lblJobCount.Text    = "You have <b>" + dvJobsData.Table.Rows.Count + "</b> run" + (dvJobsData.Table.Rows.Count == 1 ? "" : "s") + " displayed.";
        }