public static System.Collections.Hashtable GetHashActiveByOrg(int org_id) { System.Collections.Hashtable activeOrgOfferings = new System.Collections.Hashtable(); DataTable dt_activeOrgOfferings = OrganisationOfferingsDB.GetDataTable_ByOrg(org_id); dt_activeOrgOfferings = OrganisationOfferingsDB.AddIsActiveFieldToRows(dt_activeOrgOfferings); for (int i = dt_activeOrgOfferings.Rows.Count - 1; i >= 0; i--) { if (Convert.ToBoolean(dt_activeOrgOfferings.Rows[i]["is_active"])) { OrganisationOfferings curOrgOffering = OrganisationOfferingsDB.Load(dt_activeOrgOfferings.Rows[i], "oo_"); curOrgOffering.Offering = OfferingDB.Load(dt_activeOrgOfferings.Rows[i], "o_"); activeOrgOfferings[curOrgOffering.Offering.OfferingID] = curOrgOffering; } } return(activeOrgOfferings); }
protected void FillGrid() { bool isAgedCareResidentTypes = IsValidIsAgedCareResidentTypes() ? GetFormIsAgedCareResidentTypes() : false; if (isAgedCareResidentTypes) { lblHeading.Text = "Aged Care Resident Types - Specific Prices Per Facility/Wing/Unit"; } Organisation org = null; if (IsValidFormID()) { org = OrganisationDB.GetByID(GetFormID()); } DataTable dt = org == null ? dt = OrganisationOfferingsDB.GetDataTable(false, UserView.GetInstance().IsClinicView ? 5 : 6) : OrganisationOfferingsDB.GetDataTable_ByOrg(org.OrganisationID); for (int i = dt.Rows.Count - 1; i >= 0; i--) { Offering o = OfferingDB.Load(dt.Rows[i], "o_"); if ((isAgedCareResidentTypes && o.AgedCarePatientType.ID == 1) || (!isAgedCareResidentTypes && o.AgedCarePatientType.ID != 1)) { dt.Rows.RemoveAt(i); } } dt = OrganisationOfferingsDB.AddIsActiveFieldToRows(dt); Session["registerofferingtoorg_data"] = dt; if (dt.Rows.Count > 0) { if (IsPostBack && Session["registerofferingtoorg_sortexpression"] != null && Session["registerofferingtoorg_sortexpression"].ToString().Length > 0) { DataView dataView = new DataView(dt); dataView.Sort = Session["registerofferingtoorg_sortexpression"].ToString(); GrdRegistration.DataSource = dataView; } else { GrdRegistration.DataSource = dt; } try { GrdRegistration.DataBind(); } catch (Exception ex) { SetErrorMessage("", ex.ToString()); } } else { dt.Rows.Add(dt.NewRow()); GrdRegistration.DataSource = dt; GrdRegistration.DataBind(); int TotalColumns = GrdRegistration.Rows[0].Cells.Count; GrdRegistration.Rows[0].Cells.Clear(); GrdRegistration.Rows[0].Cells.Add(new TableCell()); GrdRegistration.Rows[0].Cells[0].ColumnSpan = TotalColumns; GrdRegistration.Rows[0].Cells[0].Text = "No Record Found"; } if (hideFotter) { GrdRegistration.FooterRow.Visible = false; } }