private void ShowAllFilter() { List<Listing> output = new List<Listing>(); string SelectedValue = ""; switch (tcTabs.ActiveTabIndex) { case 0: SelectedValue = ddlApps.SelectedValue.ToString(); ListingFilter.getAdvanceFilterResult(SelectedValue, ListingFilter.Filter.Type, ref output); Mode = ListingFilter.Filter.Type; ViewState["filter"] = Mode; break; case 1: SelectedValue = lstbxTitle.SelectedValue.ToString(); ListingFilter.getAdvanceFilterResult(SelectedValue, ListingFilter.Filter.Title, ref output); Mode = ListingFilter.Filter.Title; ViewState["filter"] = Mode; break; //case 2: // SelectedValue = ddlStatus.SelectedValue.ToString(); // ListingFilter.getAdvanceFilterResult(SelectedValue, ListingFilter.Filter.Status, ref output); // Mode = ListingFilter.Filter.Status; // ViewState["filter"] = Mode; // break; //case 3: // SelectedValue = ddlSAP.SelectedValue.ToString(); // ListingFilter.getAdvanceFilterResult(SelectedValue, ListingFilter.Filter.SAP, ref output); // Mode = ListingFilter.Filter.SAP; // ViewState["filter"] = Mode; // break; //case 4: // SelectedValue = ddlUndefined.SelectedValue.ToString(); // ListingFilter.getAdvanceFilterResult(SelectedValue, ListingFilter.Filter.NotDefined, ref output); // Mode = ListingFilter.Filter.NotDefined; // ViewState["filter"] = Mode; // break; case 2: SelectedValue = lstbxSupervisors.SelectedValue.ToString(); ListingFilter.getAdvanceFilterResult(SelectedValue, ListingFilter.Filter.Supervisors, ref output); Mode = ListingFilter.Filter.Supervisors; ViewState["filter"] = Mode; break; } gvAdminList.DataSource = output; gvAdminList.DataBind(); switch (Mode) { case ListingFilter.Filter.Type: ViewState["lstApps"] = output; break; case ListingFilter.Filter.Status: ViewState["lstStatus"] = output; break; case ListingFilter.Filter.SAP: ViewState["lstSAPStatus"] = output; break; case ListingFilter.Filter.Title: ViewState["lstTitle"] = output; break; case ListingFilter.Filter.NotDefined: ViewState["lstNotDefined"] = output; break; case ListingFilter.Filter.Supervisors: ViewState["lstSupervisors"] = output; break; } lblTotListedVal.Text = output.Count.ToString(); }
private void ShowAll() { List<Listing> AdminTrainingLst = Listing.getAll(); var sortedList = AdminTrainingLst.OrderBy(staff => staff.StaffName); sortedList.ToList(); sortedList.Distinct<Listing>().ToList<Listing>(); List<Listing> FilteredList = sortedList.ToList<Listing>(); gvAdminList.DataSource = FilteredList; gvAdminList.DataBind(); ViewState["lstTraining"] = FilteredList; this.lblTotListedVal.Text = FilteredList.Count.ToString(); //Load Training Title List<string> TitleLst = ListingFilter.LoadTrainingTitle(FilteredList); ddlTitle.DataSource = TitleLst; ddlTitle.DataBind(); ddlTitle.Items.Insert(0, "All"); ddlTitle.SelectedIndex = 0; //set filter type Mode = ListingFilter.Filter.All; ViewState["filter"] = Mode; //Load ddlSupervisors LoadSupervisors(FilteredList); //Load TrainingDate LoadSortDate(FilteredList); }
protected void ddlUndefined_SelectedIndexChanged(object sender, EventArgs e) { string SelectedValue = ddlUndefined.SelectedValue.ToString().ToUpper(); if (SelectedFilterMode == FilterMode.Advance) { ShowAllFilter(); } else { if (SelectedValue == "ALL") { gvAdminList.DataSource = lstTraining; gvAdminList.DataBind(); this.lblTotListedVal.Text = lstTraining.Count.ToString(); Mode = ListingFilter.Filter.All; ViewState["filter"] = Mode; } else { string SearchItem = ddlUndefined.SelectedValue.ToString(); ViewState["lstTraining"] = lstTraining; List<Listing> lstResult = new List<Listing>(); lstResult.Clear(); ListingFilter.getResultFilter(ref lstResult, lstTraining, SearchItem, ListingFilter.Filter.NotDefined); gvAdminList.DataSource = lstResult; gvAdminList.DataBind(); ViewState["lstNotDefined"] = lstResult; this.lblTotListedVal.Text = lstResult.Count.ToString(); Mode = ListingFilter.Filter.NotDefined; ViewState["filter"] = Mode; } } }
protected void ddlSortDate_SelectedIndexChanged(object sender, EventArgs e) { DateTime SelectedDate = DateTime.Parse(ddlSortDate.SelectedValue.ToString()); List<Listing> DateRequestedList = new List<Listing>(); ListingFilter.FilterbyDateRequested(SelectedDate, lstTraining, ref DateRequestedList); gvAdminList.DataSource = DateRequestedList; gvAdminList.DataBind(); this.lblTotListedVal.Text = DateRequestedList.Count.ToString(); ViewState["lstDates"] = DateRequestedList; Mode = ListingFilter.Filter.Date; ViewState["filter"] = Mode; }
protected void ddlMonths_SelectedIndexChanged(object sender, EventArgs e) { int SelectedMonth = Convert.ToInt32(ddlMonths.SelectedValue.ToString()); List<Listing> MonthFilteredList = new List<Listing>(); ListingFilter.FilterbyMonth(SelectedMonth, lstTraining, ref MonthFilteredList); gvAdminList.DataSource = MonthFilteredList; gvAdminList.DataBind(); this.lblTotListedVal.Text = MonthFilteredList.Count.ToString(); ViewState["lstMonths"] = MonthFilteredList; //set filter type Mode = ListingFilter.Filter.Month; ViewState["filter"] = Mode; }
protected void btnSearch_Click(object sender, EventArgs e) { if (!CheckEmptyTextBox()) { divFilter.Visible = false; divgv.Visible = true; tdSortDate.Visible = true; //ViewState["lstTraining"] = lstTraining; List<Listing> output = new List<Listing>(); //string SelecteddllItem = ddlSearch.SelectedValue.ToString().ToUpper(); string SerachTerm = txtSearch.Text; if (!string.IsNullOrEmpty(txtSearchMultiple.Text)) { char[] delimiter = { '\n' }; string[] split = txtSearchMultiple.Text.Split(delimiter); foreach (string part in split) { List<string> lstStaff = new List<string>(); List<Staff> staff = Staff.Search(part); foreach (Staff s in staff) { lstStaff.Add(s.Username); } foreach (string StaffUsername in lstStaff) { output = Listing.Search(StaffUsername, ref output); } } } else { List<string> lstStaff = new List<string>(); List<Staff> staff = Staff.Search(SerachTerm); foreach (Staff s in staff) { lstStaff.Add(s.Username); } foreach (string StaffUsername in lstStaff) { output = Listing.Search(StaffUsername, ref output); } } gvAdminList.DataSource = output; gvAdminList.DataBind(); this.lblTotListedVal.Text = output.Count.ToString(); ViewState["lstTraining"] = output; List<string> TitleLst = ListingFilter.LoadTrainingTitle(output); ddlTitle.DataSource = TitleLst; ddlTitle.DataBind(); ddlTitle.Items.Add("All"); ddlTitle.SelectedValue = "All"; Mode = ListingFilter.Filter.All; ViewState["filter"] = Mode; //Load TrainingDate LoadSortDate(output); } }