예제 #1
0
        public void ApplyFilter()
        {
            string filter = string.Empty;

            Facade.Job facJob = new Facade.Job();
            DataSet    ds     = null;

            // Build Filter String
            // Client
            if (cboClient.SelectedValue != string.Empty)
            {
                filter = "IdentityId = " + cboClient.SelectedValue;
            }

            // Control Area
            if (cboTrafficeArea.SelectedValue != string.Empty)
            {
                if (filter != string.Empty)
                {
                    filter += " AND CancellationControlArea = " + cboTrafficeArea.SelectedValue;
                }
                else
                {
                    filter = "CancellationControlArea = " + cboTrafficeArea.SelectedValue;
                }
            }

            if (dteStartDate.SelectedDate == DateTime.MinValue || dteEndDate.SelectedDate == DateTime.MinValue)
            {
                ds = facJob.GetMarkedForCancellation();
            }
            else
            {
                DateTime start = dteStartDate.SelectedDate.Value;
                start = start.Subtract(start.TimeOfDay);
                DateTime end = dteEndDate.SelectedDate.Value;
                end = end.Subtract(end.TimeOfDay);
                end = end.Add(new TimeSpan(0, 23, 59, 59));

                ds = facJob.GetMarkedForCancellationByDate(start, end);
            }

            DataView dv = new DataView(ds.Tables[0], "", "", DataViewRowState.CurrentRows);

            // Apply dataview filter
            dv.RowFilter = filter;

            m_dsJobsData = ds;

            //dgJobs.GroupBy = "OrganisationName";
            dgJobs.DataSource = dv;
            dgJobs.DataBind();

            if (dgJobs.Items.Count != 0)
            {
                dgJobs.Visible = true;
            }
            else
            {
                dgJobs.Visible          = false;
                pnlConfirmation.Visible = true;
                imgIcon.ImageUrl        = "~/images/ico_warning.gif";
                lblNote.Text            = "No results for given criteria.";
                lblNote.ForeColor       = Color.Red;
            }
        }