/// <summary> /// todoComment /// </summary> public void SpecialInitUserControl(IndividualDataTDS AMainDS) { FMainDS = AMainDS; LoadDataOnDemand(); grdDetails.Columns.Clear(); grdDetails.AddDateColumn(Catalog.GetString("Date entered"), FMainDS.PmGeneralApplication.Columns[PmGeneralApplicationTable.GetDateCreatedDBName()]); grdDetails.AddTextColumn(Catalog.GetString("Applied for"), FMainDS.PmGeneralApplication.ColumnApplicationForEventOrField); grdDetails.AddTextColumn(Catalog.GetString("Field / Event Name"), FMainDS.PmGeneralApplication.ColumnEventOrFieldName); grdDetails.AddTextColumn(Catalog.GetString("Status"), FMainDS.PmGeneralApplication.Columns[PmGeneralApplicationTable.GetGenApplicationStatusDBName()], 100); // initialize tab controls ucoApplicationEvent.InitialiseUserControl(); ucoApplicationField.InitialiseUserControl(); // Hook up DataSavingStarted Event to be able to run code before SaveChanges is doing anything FPetraUtilsObject.DataSavingStarted += new TDataSavingStartHandler(this.DataSavingStarted); // enable grid to react to insert and delete keyboard keys //WB grdDetails.InsertKeyPressed += new TKeyPressedEventHandler(grdDetails_InsertKeyPressed); // enable grid to react to modified event or field key in details part ucoApplicationEvent.ApplicationEventChanged += new TUC_Application_Event.TDelegateApplicationEventChanged( ProcessApplicationEventOrFieldChanged); ucoApplicationField.ApplicationFieldChanged += new TUC_Application_Field.TDelegateApplicationFieldChanged( ProcessApplicationEventOrFieldChanged); if (grdDetails.Rows.Count <= 1) { pnlDetails.Visible = false; } }
// update the grid once the filter is changed private void FilterChange(System.Object sender, EventArgs e) { List <string> Filters = new List <string>(); string FiltersString = ""; DataView MyDataView = FMainDS.PmGeneralApplication.DefaultView; MyDataView.RowFilter = null; if (rbtGeneral.Checked) { if (!chkAccepted.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'A'"); } if (!chkCancelled.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'C'"); } if (!chkEnquiry.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'E'"); } if (!chkHold.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'H'"); } if (!chkRejected.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'R'"); } for (int i = 0; i < Filters.Count; i++) { if ((i != 0) || (FiltersString.Length > 0)) { FiltersString += " AND " + Filters[i]; } else { FiltersString += Filters[i]; } } } else if (rbtDetailed.Checked) { string[] DetailedStatuses = FDetailedStatuses.Split(','); foreach (string Status in DetailedStatuses) { Filters.Add(PmGeneralApplicationTable.GetGenApplicationStatusDBName() + " = '" + Status + "'"); } for (int i = 0; i < Filters.Count; i++) { if ((i == 0) && (FiltersString.Length > 0)) { FiltersString += " AND (" + Filters[i]; } else if ((i == 0) && (FiltersString.Length == 0)) { FiltersString += "(" + Filters[i]; } else { FiltersString += " OR " + Filters[i]; } if (i == Filters.Count - 1) { FiltersString += ")"; } } } MyDataView.RowFilter = FiltersString; grdApplications.DataSource = new DevAge.ComponentModel.BoundDataView(MyDataView); UpdateRecordNumberDisplay(); }
// update the grid once the filter is changed private void FilterChange(System.Object sender, EventArgs e) { List <string> Filters = new List <string>(); string FiltersString = ""; DataView MyDataView = FMainDS.PmShortTermApplication.DefaultView; MyDataView.RowFilter = null; if (chkShowAllOutreaches.Enabled && !chkShowAllOutreaches.Checked) { // filter rows so only showing applicants for selected outreach rather than the entire conference FiltersString = PmShortTermApplicationTable.GetConfirmedOptionCodeDBName() + " = '" + FOutreachCode + "'"; } if (rbtGeneral.Checked) { if (!chkAccepted.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'A'"); } if (!chkCancelled.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'C'"); } if (!chkEnquiry.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'E'"); } if (!chkHold.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'H'"); } if (!chkRejected.Checked) { Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'R'"); } Filters.Add("SUBSTRING(" + PmGeneralApplicationTable.GetGenApplicationStatusDBName() + ",1,1) <> 'P'"); for (int i = 0; i < Filters.Count; i++) { if ((i != 0) || (FiltersString.Length > 0)) { FiltersString += " AND " + Filters[i]; } else { FiltersString += Filters[i]; } } } else if (rbtDetailed.Checked) { string[] DetailedStatuses = txtDetailedStatuses.Text.Split(','); foreach (string Status in DetailedStatuses) { Filters.Add(PmGeneralApplicationTable.GetGenApplicationStatusDBName() + " = '" + Status + "'"); } for (int i = 0; i < Filters.Count; i++) { if ((i == 0) && (FiltersString.Length > 0)) { FiltersString += " AND (" + Filters[i]; } else if ((i == 0) && (FiltersString.Length == 0)) { FiltersString += "(" + Filters[i]; } else { FiltersString += " OR " + Filters[i]; } if (i == Filters.Count - 1) { FiltersString += ")"; } } } MyDataView.RowFilter = FiltersString; grdApplications.DataSource = new DevAge.ComponentModel.BoundDataView(MyDataView); UpdateRecordNumberDisplay(); }