public static Organisation LoadAll(DataRow row) { Organisation org = Load(row); org.OrganisationType = OrganisationTypeDB.Load(row, "type_"); org.OrganisationType.OrganisationTypeGroup = IDandDescrDB.Load(row, "typegroup_organisation_type_group_id", "typegroup_descr"); org.OrganisationCustomerTypeID = Convert.ToInt32(row["ct_organisation_customer_type_id"]); return(org); }
public static Organisation[] Get_ByType(int[] types, Organisation[] excList) { DataTable tbl = GetDataTable_ByType(types, excList); Organisation[] list = new Organisation[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { list[i] = Load(tbl.Rows[i]); list[i].OrganisationType = OrganisationTypeDB.Load(tbl.Rows[0], "type_"); } return(list); }
public static Organisation GetByID(int organisation_id) { string sql = JoinedSql + @" WHERE o.organisation_id = " + organisation_id.ToString(); DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0]; if (tbl.Rows.Count == 0) { return(null); } else { Organisation org = Load(tbl.Rows[0]); org.OrganisationType = OrganisationTypeDB.Load(tbl.Rows[0], "type_"); return(org); } }
public static OfferingOrder LoadAll(DataRow row) { OfferingOrder o = Load(row, "offeringorder_"); if (row["organisation_organisation_id"] != DBNull.Value) { o.Organisation = OrganisationDB.Load(row, "organisation_"); o.Organisation.OrganisationType = OrganisationTypeDB.Load(row, "org_type_"); o.Organisation.OrganisationType.OrganisationTypeGroup = IDandDescrDB.Load(row, "typegroup_organisation_type_group_id", "typegroup_descr"); } if (row["staff_staff_id"] != DBNull.Value) { o.Staff = StaffDB.Load(row, "staff_"); } if (row["staff_staff_id"] != DBNull.Value) { o.Staff.Person = PersonDB.Load(row, "person_staff_"); o.Staff.Person.Title = IDandDescrDB.Load(row, "title_staff_title_id", "title_staff_descr"); } if (row["patient_patient_id"] != DBNull.Value) { o.Patient = PatientDB.Load(row, "patient_"); } if (row["patient_patient_id"] != DBNull.Value) { o.Patient.Person = PersonDB.Load(row, "person_patient_"); o.Patient.Person.Title = IDandDescrDB.Load(row, "title_patient_title_id", "title_patient_descr"); } if (row["offering_offering_id"] != DBNull.Value) { o.Offering = OfferingDB.Load(row, "offering_"); } if (row["offeringfield_field_id"] != DBNull.Value) { o.Offering.Field = IDandDescrDB.Load(row, "offeringfield_field_id", "offeringfield_descr"); } return(o); }
protected void GrdOrganisation_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Insert")) { DropDownList ddlParent = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewParent"); DropDownList ddlUseParentOffernigPrices = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlUseParentOffernigPrices"); TextBox txtName = (TextBox)GrdOrganisation.FooterRow.FindControl("txtNewName"); DropDownList ddlType = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewType"); DropDownList ddlCustType = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewCustType"); TextBox txtABN = (TextBox)GrdOrganisation.FooterRow.FindControl("txtNewABN"); TextBox txtACN = (TextBox)GrdOrganisation.FooterRow.FindControl("txtNewACN"); TextBox txtBPayAccount = (TextBox)GrdOrganisation.FooterRow.FindControl("txtNewBPayAccount"); DropDownList ddlServiceCycle = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewServiceCycle"); DropDownList ddlIsDebtor = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewIsDebtor"); DropDownList ddlIsCreditor = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewIsCreditor"); DropDownList ddlFreeServices = (DropDownList)GrdOrganisation.FooterRow.FindControl("ddlNewFreeServices"); TimeSpan defaultDayStartTime = new TimeSpan(8, 0, 0); TimeSpan defaultDayEndTime = new TimeSpan(20, 0, 0); TimeSpan defaultDayLunchStartTime = new TimeSpan(12, 0, 0); TimeSpan defaultDayLunchEndTime = new TimeSpan(12, 0, 0); UrlParamType urlParamType = GetUrlParamType(); if (urlParamType == UrlParamType.External) { if (urlParamType == UrlParamType.External && IsValidFormOrgTypeIDs() && GetFormOrgTypeIDs() == "191") { OrganisationDB.InsertExtOrg(Convert.ToInt32(GetFormOrgTypeIDs()), txtName.Text, txtACN.Text, txtABN.Text, OrganisationTypeDB.IsDebtor(191), OrganisationTypeDB.IsCreditor(191), "", ""); } else { OrganisationDB.Insert(Convert.ToInt32(ddlParent.SelectedValue), false, Convert.ToInt32(ddlType.SelectedValue), Convert.ToInt32(ddlCustType.SelectedValue), txtName.Text, txtACN.Text, txtABN.Text, OrganisationTypeDB.IsDebtor(Convert.ToInt32(ddlType.SelectedValue)), OrganisationTypeDB.IsCreditor(Convert.ToInt32(ddlType.SelectedValue)), "", 0, DateTime.MinValue, DateTime.MinValue, "", 0, //txtBPayAccount.Text, Convert.ToInt32(ddlServiceCycle.SelectedValue), //DateTime.MinValue DateTime.MinValue, "", Convert.ToInt32(ddlFreeServices.SelectedValue), false, false, false, false, false, false, false, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, DateTime.MinValue); } } else { OrganisationDB.Insert(Convert.ToInt32(ddlParent.SelectedValue), Convert.ToBoolean(ddlUseParentOffernigPrices.SelectedValue), Convert.ToInt32(ddlType.SelectedValue), Convert.ToInt32(ddlCustType.SelectedValue), txtName.Text, txtACN.Text, txtABN.Text, OrganisationTypeDB.IsDebtor(Convert.ToInt32(ddlType.SelectedValue)), OrganisationTypeDB.IsCreditor(Convert.ToInt32(ddlType.SelectedValue)), txtBPayAccount.Text, Convert.ToInt32(ddlServiceCycle.SelectedValue), DateTime.MinValue, DateTime.MinValue, "", Convert.ToInt32(ddlFreeServices.SelectedValue), true, false, false, false, false, false, true, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayStartTime, defaultDayEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, defaultDayLunchStartTime, defaultDayLunchEndTime, DateTime.MinValue); } FillGrid(); } if (e.CommandName.Equals("_Delete") || e.CommandName.Equals("_UnDelete")) { int organisation_id = Convert.ToInt32(e.CommandArgument); try { if (e.CommandName.Equals("_Delete")) { OrganisationDB.UpdateInactive(organisation_id); } else { OrganisationDB.UpdateActive(organisation_id); } } catch (ForeignKeyConstraintException fkcEx) { if (Utilities.IsDev()) { SetErrorMessage("Can not delete because other records depend on this : " + fkcEx.Message); } else { SetErrorMessage("Can not delete because other records depend on this"); } } FillGrid(); } }
protected void GrdOrganisation_RowDataBound(object sender, GridViewRowEventArgs e) { DataTable types = null; switch (GetUrlParamType()) { case UrlParamType.Clinic: types = OrganisationTypeDB.GetDataTable_Clinics(); break; case UrlParamType.AgedCare: types = OrganisationTypeDB.GetDataTable_AgedCareFacs(); break; case UrlParamType.External: if (IsValidFormOrgTypeIDs()) { types = OrganisationTypeDB.GetDataTable_External(GetFormOrgTypeIDs().ToString()); } else { types = OrganisationTypeDB.GetDataTable_External(); } break; default: types = OrganisationTypeDB.GetDataTable(); break; } //DataTable custTypes2 = DBBase.GetGenericDataTable(null, "OrganisationCustomerType", "organisation_customer_type_id", "descr"); DataTable custTypes = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "OrganisationCustomerType", "organisation_customer_type_id NOT IN (139,275)", "", "organisation_customer_type_id", "descr"); DataTable dt = Session["organisationinfo_data"] as DataTable; bool tblEmpty = (dt.Rows.Count == 1 && dt.Rows[0][0] == DBNull.Value); if (!tblEmpty && e.Row.RowType == DataControlRowType.DataRow) { bool hasData = dt.Rows[0][0].ToString() != string.Empty; Label lblId = (Label)e.Row.FindControl("lblId"); DataRow[] foundRows = dt.Select("organisation_id=" + lblId.Text); DataRow thisRow = foundRows[0]; HyperLink lnkRegistraterReferrers = (HyperLink)e.Row.FindControl("lnkRegistraterReferrers"); if (lnkRegistraterReferrers != null) { lnkRegistraterReferrers.Visible = (dt.Rows[e.Row.RowIndex]["organisation_type_id"].ToString() == "191"); } ImageButton lnkFullEdit = (ImageButton)e.Row.FindControl("lnkFullEdit"); if (lnkFullEdit != null) { if (Request.QueryString["type"] == null || !hasData) { lnkFullEdit.Visible = false; } else { lnkFullEdit.PostBackUrl = "~/OrganisationDetailV2.aspx?type=view&id=" + Convert.ToInt32(lblId.Text) + "&orgtype=" + Request.QueryString["type"]; } } DropDownList ddlParent = (DropDownList)e.Row.FindControl("ddlParent"); if (ddlParent != null) { /* * Organisation[] thisOrg = new Organisation[] { OrganisationDB.GetByID(Convert.ToInt32(lblId.Text)) }; * * bool exclClinics = GetUrlParamType() != UrlParamType.None && GetUrlParamType() != UrlParamType.Clinic; * bool exclAgedCareFacs = GetUrlParamType() != UrlParamType.None && GetUrlParamType() != UrlParamType.AgedCare; * bool exclExternal = GetUrlParamType() != UrlParamType.None && GetUrlParamType() != UrlParamType.External; * bool exclIns = GetUrlParamType() != UrlParamType.None && GetUrlParamType() != UrlParamType.Insurance; * DataTable parentList = OrganisationDB.GetDataTable_AllNotInc(thisOrg, false, exclClinics, exclAgedCareFacs, exclIns, exclExternal); * * ddlParent.Items.Add(new ListItem("--","0")); * foreach (DataRow row in parentList.Rows) * ddlParent.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); * ddlParent.SelectedValue = thisRow["parent_organisation_id"].ToString(); */ ddlParent.Items.Clear(); ddlParent.Items.Add(new ListItem("--", "0")); foreach (DataRow row in GetOrgsDaTatable(GetUrlParamType(), true).Rows) { bool isThisOrg = Convert.ToInt32(row["organisation_id"]) == Convert.ToInt32(thisRow["organisation_id"]); bool isDeleted = Convert.ToBoolean(row["is_deleted"]); bool isParentOrg = thisRow["parent_organisation_id"] != DBNull.Value && Convert.ToInt32(row["organisation_id"]) == Convert.ToInt32(thisRow["parent_organisation_id"]); if (!isThisOrg && (!isDeleted || isParentOrg)) { ddlParent.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); } } ddlParent.SelectedValue = thisRow["parent_organisation_id"].ToString(); } DropDownList ddlType = (DropDownList)e.Row.FindControl("ddlType"); if (ddlType != null) { foreach (DataRow row in types.Rows) { string prefix = Convert.ToInt32(row["organisation_type_group_id"]) == 4 ? "Ext. " : ""; ddlType.Items.Add(new ListItem(prefix + row["descr"].ToString(), row["organisation_type_id"].ToString())); } ddlType.SelectedValue = thisRow["organisation_type_id"].ToString(); } DropDownList ddlCustType = (DropDownList)e.Row.FindControl("ddlCustType"); if (ddlCustType != null) { ddlCustType.DataSource = custTypes; ddlCustType.DataTextField = "descr"; ddlCustType.DataValueField = "organisation_customer_type_id"; ddlCustType.DataBind(); if (ddlCustType.Items.FindByValue(thisRow["ct_organisation_customer_type_id"].ToString()) == null) { ddlCustType.Items.Add(new ListItem(thisRow["ct_descr"].ToString(), thisRow["ct_organisation_customer_type_id"].ToString())); } ddlCustType.SelectedValue = thisRow["ct_organisation_customer_type_id"].ToString(); } DropDownList ddlServiceCycle = (DropDownList)e.Row.FindControl("ddlServiceCycle"); if (ddlServiceCycle != null) { for (int i = 0; i <= 52; i++) { ddlServiceCycle.Items.Add(new ListItem(i.ToString(), i.ToString())); } ddlServiceCycle.SelectedValue = thisRow["weeks_per_service_cycle"].ToString(); } DropDownList ddlFreeServices = (DropDownList)e.Row.FindControl("ddlFreeServices"); if (ddlFreeServices != null) { for (int i = 0; i <= 5; i++) { ddlFreeServices.Items.Add(new ListItem(i.ToString(), i.ToString())); } ddlFreeServices.SelectedValue = thisRow["free_services"].ToString(); } HyperLink lnkBookings = (HyperLink)e.Row.FindControl("lnkBookings"); HyperLink lnkBookingList = (HyperLink)e.Row.FindControl("lnkBookingList"); if (lnkBookings != null && lnkBookingList != null && hasData && (Convert.ToInt32(dt.Rows[e.Row.RowIndex]["type_organisation_type_group_id"]) == 5 || Convert.ToInt32(dt.Rows[e.Row.RowIndex]["type_organisation_type_group_id"]) == 6)) { int organisation_type_id = Convert.ToInt32(thisRow["organisation_type_id"]); int organisation_id = Convert.ToInt32(thisRow["organisation_id"]); if (organisation_type_id == 367 || organisation_type_id == 372 || organisation_type_id == 139) { lnkBookings.NavigateUrl = String.Format("~/BookingsV2.aspx?orgs={0}", organisation_id); lnkBookingList.NavigateUrl = String.Format("~/BookingsListV2.aspx?org={0}", organisation_id); } else if (organisation_type_id == 218) { lnkBookings.NavigateUrl = String.Format("~/BookingsV2.aspx?orgs={0}", organisation_id); lnkBookingList.NavigateUrl = String.Format("~/BookingsListV2.aspx?org={0}", organisation_id); } else { lnkBookings.Visible = false; lnkBookingList.Visible = false; } } ImageButton btnDelete = (ImageButton)e.Row.FindControl("btnDelete"); if (btnDelete != null) { bool is_deleted = Convert.ToBoolean(thisRow["is_deleted"]); if (is_deleted) { btnDelete.CommandName = "_UnDelete"; btnDelete.ImageUrl = "~/images/tick-24.png"; btnDelete.AlternateText = "UnDelete"; btnDelete.ToolTip = "UnDelete"; } } Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlParent = (DropDownList)e.Row.FindControl("ddlNewParent"); if (ddlParent != null) { /* * bool exclClinics = GetUrlParamType() != UrlParamType.None && GetUrlParamType() != UrlParamType.Clinic; * bool exclAgedCareFacs = GetUrlParamType() != UrlParamType.None && GetUrlParamType() != UrlParamType.AgedCare; * bool exclExternal = GetUrlParamType() != UrlParamType.None && GetUrlParamType() != UrlParamType.External; * bool exclIns = GetUrlParamType() != UrlParamType.None && GetUrlParamType() != UrlParamType.Insurance; * DataTable parentList = OrganisationDB.GetDataTable(false, exclClinics, exclAgedCareFacs, exclIns, exclExternal); * ddlParent.Items.Clear(); * ddlParent.Items.Add(new ListItem("--", "-1")); * foreach (DataRow row in parentList.Rows) * ddlParent.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); */ ddlParent.Items.Clear(); ddlParent.Items.Add(new ListItem("--", "0")); foreach (DataRow row in GetOrgsDaTatable(GetUrlParamType(), false).Rows) { ddlParent.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); } } DropDownList ddlNewType = (DropDownList)e.Row.FindControl("ddlNewType"); foreach (DataRow row in types.Rows) { string prefix = Convert.ToInt32(row["organisation_type_group_id"]) == 5 || Convert.ToInt32(row["organisation_type_group_id"]) == 6 || GetUrlParamType() == UrlParamType.External ? "" : "Ext. "; if (Convert.ToInt32(row["organisation_type_group_id"]) == 1) { prefix = ""; } ddlNewType.Items.Add(new ListItem(prefix + row["descr"].ToString(), row["organisation_type_id"].ToString())); } DropDownList ddlCustType = (DropDownList)e.Row.FindControl("ddlNewCustType"); ddlCustType.DataSource = custTypes; ddlCustType.DataTextField = "descr"; ddlCustType.DataValueField = "organisation_customer_type_id"; ddlCustType.DataBind(); DropDownList ddlServiceCycle = (DropDownList)e.Row.FindControl("ddlNewServiceCycle"); for (int i = 0; i <= 52; i++) { ddlServiceCycle.Items.Add(new ListItem(i.ToString(), i.ToString())); } DropDownList ddlFreeServices = (DropDownList)e.Row.FindControl("ddlNewFreeServices"); for (int i = 0; i <= 5; i++) { ddlFreeServices.Items.Add(new ListItem(i.ToString(), i.ToString())); } } }