private void setLoadFilter() { if (loadingData == false) { string sFilter = ""; if (cboFilter.SelectedItem != null) { parmType pt = (parmType)cboFilter.SelectedItem; if (pt.ID > 0) { sFilter = "ItemType = " + pt.ID.ToString(); if (chkIncludeNotAvailable.Checked == false) { sFilter += " AND NotAvailable =0"; } } else if (chkIncludeNotAvailable.Checked == false) { sFilter += " NotAvailable =0"; } } else if (chkIncludeNotAvailable.Checked == false) { sFilter += " NotAvailable =0"; } clsSvcItems.openWhere(sFilter); loadList("", false); } }
/// <summary> /// Retrives all distinct values for a given column Name in the Household Table /// </summary> /// <param name="colName">The Name of the Column to get distincts for</param> private void getDistints(string colName) { bool foundMatch = false; bLoadingCombo = true; cboFilter.Items.Clear(); cboFilter.Items.Add("No Filter"); cboFilter.SelectedIndex = 0; //Gets And Adds to the filter combo the distinct values of the column from the household table string whereClause = ""; if (chkIncludeInactive.Checked == false) { whereClause = " WHERE Inactive=0 "; } clsVolunteers.getDistincts(colName, whereClause); string sVal = ""; System.Collections.ArrayList typesVolunteer = CCFBGlobal.TypeCodesArray(CCFBGlobal.parmTbl_VolType); int iD = 0; for (int i = 0; i < clsVolunteers.RowCount; i++) { sVal = clsVolunteers.DSet.Tables[0].Rows[i][0].ToString(); foundMatch = true; if (colName == "RcdType") { iD = Convert.ToInt32(sVal); sVal = CCFBGlobal.formatNumberWithLeadingZero(iD); foundMatch = false; for (int j = 0; j < typesVolunteer.Count; j++) { parmType pt = (parmType)typesVolunteer[j]; if (pt.ID == iD) { sVal += " = " + pt.LongName; foundMatch = true; break; } } } if (foundMatch == true) { cboFilter.Items.Add(sVal + new String((char)32, (30 - sVal.Length)) + "[ " + clsVolunteers.DSet.Tables[0].Rows[i][1].ToString() + " ]"); } } bLoadingCombo = false; }
/// <summary> /// Retrives and loads the donors into the Store Combo Box /// </summary> private void LoadcboDonor() { Donors clsDonors = new Donors(CCFBGlobal.connectionString); cboStore.Items.Clear(); if (donorID > -1) { clsDonors.openWhere(" Where ID=" + donorID.ToString()); } else { clsDonors.openWhere(" Where DefaultDonationType=6"); } for (int i = 0; i < clsDonors.RowCount; i++) { clsDonors.setDataRow(i); parmType clsPT = new parmType(clsDonors.ID, clsDonors.Name, i, clsDonors.Name); listDonors.Add(clsPT); } try { clsDonors.setDataRow(0); cboStore.DataSource = listDonors; cboStore.DisplayMember = "LongName"; cboStore.ValueMember = "UID"; cboStore.SelectedIndex = 0; cboDonationType.SelectedValue = clsDonors.DefaultDonationType.ToString(); } catch { } if (donorID > -1) { cboStore.Enabled = false; } }