Пример #1
0
    protected static Hashtable GetPatientRegOrgCache(Patient[] patients)
    {
        ArrayList patientIDArrayList = new ArrayList();

        foreach (Patient patient in patients)
        {
            patientIDArrayList.Add(patient.PatientID);
        }
        int[] patientIDs = (int[])patientIDArrayList.ToArray(typeof(int));

        Hashtable regOrgHash = new Hashtable();

        System.Data.DataTable tbl = RegisterPatientDB.GetDataTable_OrganisationsOf(patientIDs, true, false, false, true, true);
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            int          patientID = Convert.ToInt32(tbl.Rows[i]["patient_id"]);
            Organisation org       = OrganisationDB.Load(tbl.Rows[i], "", "organisation_entity_id", "organisation_is_deleted");

            if (regOrgHash[patientID] == null)
            {
                regOrgHash[patientID] = new System.Collections.ArrayList();
            }
            ((System.Collections.ArrayList)regOrgHash[patientID]).Add(org);
        }

        return(regOrgHash);
    }
    protected void FillOrganisationGrid()
    {
        UserView userView = UserView.GetInstance();

        lblHeading.Text = !userView.IsAgedCareView ? "Facilitys" : "Clinics";

        int       patientID = IsValidFormPatient() ? GetFormPatient(false) : -1;
        DataTable dt        = patientID == -1 ?
                              OrganisationDB.GetDataTable(0, false, true, !userView.IsClinicView && !userView.IsGPView, !userView.IsAgedCareView, true, true, txtSearchOrganisation.Text.Trim(), chkOrganisationSearchOnlyStartWith.Checked) :
                              RegisterPatientDB.GetDataTable_OrganisationsOf(patientID, true, !userView.IsClinicView && !userView.IsGPView, !userView.IsAgedCareView, true, true, txtSearchOrganisation.Text.Trim(), chkOrganisationSearchOnlyStartWith.Checked);

        Session["organisationlist_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["organisationlist_sortexpression"] != null && Session["organisationlist_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort = Session["organisationlist_sortexpression"].ToString();
                GrdOrganisation.DataSource = dataView;
            }
            else
            {
                GrdOrganisation.DataSource = dt;
            }


            try
            {
                GrdOrganisation.DataBind();
                GrdOrganisation.PagerSettings.FirstPageText = "1";
                GrdOrganisation.PagerSettings.LastPageText  = GrdOrganisation.PageCount.ToString();
                GrdOrganisation.DataBind();
            }
            catch (Exception ex)
            {
                this.lblErrorMessage.Visible = true;
                this.lblErrorMessage.Text    = ex.ToString();
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdOrganisation.DataSource = dt;
            GrdOrganisation.DataBind();

            int TotalColumns = GrdOrganisation.Rows[0].Cells.Count;
            GrdOrganisation.Rows[0].Cells.Clear();
            GrdOrganisation.Rows[0].Cells.Add(new TableCell());
            GrdOrganisation.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdOrganisation.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            main_content.Style["background"] = (Session["SystemVariables"] == null) ? "url(../imagesV2/login_bg.png) center top no-repeat #EDEDED" : "url(../imagesV2/" + ((SystemVariables)Session["SystemVariables"])["MainLogoBackground"].Value + ") center top no-repeat #EDEDED";
        }

        bool showPageHeader = Request.QueryString["show_header"] == null || Request.QueryString["show_header"] == "1";

        if (!showPageHeader)
        {
            Utilities.UpdatePageHeader(Page.Master, true, true);
        }

        int type_group_id = -1;

        if (Session["SiteTypeID"] != null && (Convert.ToInt32(Session["SiteTypeID"]) == 1 || Convert.ToInt32(Session["SiteTypeID"]) == 3))
        {
            lblHeading.InnerHtml = "Select A Clinic";
            type_group_id        = 5;
        }
        else if (Session["SiteTypeID"] != null && Convert.ToInt32(Session["SiteTypeID"]) == 2)
        {
            lblHeading.InnerHtml = "Select A Facility/Wing";
            type_group_id        = 6;
        }
        else
        {
            throw new Exception("Unknown SiteTypeID in session");
        }


        if (Session["PatientID"] != null)
        {
            DataTable dt = RegisterPatientDB.GetDataTable_OrganisationsOf(Convert.ToInt32(Session["PatientID"]), true, false, true, true, true);

            if (dt.Rows.Count == 1)  // if only org, auto select it
            {
                Session["IsMultipleOrgs"] = false;
                Select(Convert.ToInt32(dt.Rows[0]["organisation_id"]));
            }
            else
            {
                Session["IsMultipleOrgs"] = true;
                lstOrgs.DataSource        = dt;
                lstOrgs.DataBind();
            }
        }
        else // if (Session["StaffID"] != null)
        {
            DataTable dt = RegisterStaffDB.GetDataTable_OrganisationsOf(Convert.ToInt32(Session["StaffID"]), type_group_id.ToString());

            if (dt.Rows.Count == 1)  // if only org, auto select it
            {
                Session["IsMultipleOrgs"] = false;
                Select(Convert.ToInt32(dt.Rows[0]["organisation_id"]));
            }
            else
            {
                Session["IsMultipleOrgs"] = true;
                lstOrgs.DataSource        = dt;
                lstOrgs.DataBind();
            }
        }
    }
Пример #4
0
    protected void FillGrid()
    {
        if (!IsValidFormID())
        {
            HideTableAndSetErrorMessage("", "Invalid URL Parameters");
            return;
        }

        Patient patient = PatientDB.GetByID(GetFormID());

        if (patient == null)
        {
            HideTableAndSetErrorMessage(Utilities.IsDev() ? "No patient exists with this ID" : "");
            return;
        }
        patient.Person = PersonDB.GetByID(patient.Person.PersonID);

        lblHeading.Text = Page.Title = "Manage Registrations For :  " + patient.Person.Firstname + " " + patient.Person.Surname;
        this.lnkThisPatient.NavigateUrl = "~/PatientDetailV2.aspx?type=view&id=" + GetFormID().ToString();
        this.lnkThisPatient.Text        = "Back to details for " + patient.Person.FullnameWithoutMiddlename;


        DataTable dt = RegisterPatientDB.GetDataTable_OrganisationsOf(patient.PatientID);

        Session["registerorgtopatient_data"] = dt;


        spn_booking_screen_link.Visible   = UserView.GetInstance().IsAdminView;
        lblSelectOrgBeforeBooking.Visible = dt.Rows.Count == 0 && GetUrlParamType() == UrlParamType.SelectToGoToBookings;
        lnkBookingScreen.Visible          = dt.Rows.Count > 0;
        lnkBookingScreen.NavigateUrl      = String.Format("~/BookingScreenGetPatientOrgsV2.aspx?patient_id={0}", Request["id"]);
        lnkBookingScreen.Text             = "Make Booking";


        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["registerorgtopatient_sortexpression"] != null && Session["registerorgtopatient_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort = Session["registerorgtopatient_sortexpression"].ToString();
                GrdRegistration.DataSource = dataView;
            }
            else
            {
                GrdRegistration.DataSource = dt;
            }


            try
            {
                GrdRegistration.DataBind();
            }
            catch (Exception ex)
            {
                HideTableAndSetErrorMessage("", 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;
        }
    }