示例#1
0
    protected Tuple <Booking, PatientReferrer, bool, string, HealthCard> LoadRow(DataRow row)
    {
        Booking booking = BookingDB.Load(row, "booking_", true, false);

        booking.Offering = OfferingDB.Load(row, "offering_");

        PatientReferrer pr = PatientReferrerDB.Load(row, "pr_");

        pr.RegisterReferrer                       = RegisterReferrerDB.Load(row, "regref_");
        pr.RegisterReferrer.Referrer              = ReferrerDB.Load(row, "referrer_");
        pr.RegisterReferrer.Referrer.Person       = PersonDB.Load(row, "referrer_person_");
        pr.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(row, "referrer_person_title_title_id", "referrer_person_title_descr");
        if (row["organisation_organisation_id"] != DBNull.Value)
        {
            pr.RegisterReferrer.Organisation = OrganisationDB.Load(row, "organisation_");
        }
        pr.Patient              = PatientDB.Load(row, "patient_");
        pr.Patient.Person       = PersonDB.Load(row, "patient_person_");
        pr.Patient.Person.Title = IDandDescrDB.Load(row, "patient_person_title_title_id", "patient_person_title_descr");

        bool   refHasEmail = Convert.ToInt32(row["ref_has_email"]) == 1;
        string refEmail    = row["ref_email"] == DBNull.Value ? null : Convert.ToString(row["ref_email"]);

        HealthCard hc = HealthCardDB.Load(row, "hc_");

        return(new Tuple <Booking, PatientReferrer, bool, string, HealthCard>(booking, pr, refHasEmail, refEmail, hc));
    }
    public static PatientReferrer GetByID(int patient_referrer_id)
    {
        //string sql = "SELECT patient_referrer_id,patient_id,register_referrer_id,patient_referrer_date_added,is_debtor,is_active FROM PatientReferrer WHERE patient_referrer_id = " + patient_referrer_id.ToString();
        string    sql = JoinedSQL() + " AND patient_referrer_id = " + patient_referrer_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        if (tbl.Rows.Count == 0)
        {
            return(null);
        }
        else
        {
            PatientReferrer pr = Load(tbl.Rows[0]);
            pr.Patient              = PatientDB.Load(tbl.Rows[0]);
            pr.Patient.Person       = PersonDB.Load(tbl.Rows[0], "patient_person_");
            pr.Patient.Person.Title = IDandDescrDB.Load(tbl.Rows[0], "patient_person_title_title_id", "patient_person_title_descr");

            if (tbl.Rows[0]["pr_register_referrer_id"] != DBNull.Value)
            {
                pr.RegisterReferrer                       = RegisterReferrerDB.Load(tbl.Rows[0]);
                pr.RegisterReferrer.Referrer              = ReferrerDB.Load(tbl.Rows[0]);
                pr.RegisterReferrer.Referrer.Person       = PersonDB.Load(tbl.Rows[0], "referrer_person_");
                pr.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(tbl.Rows[0], "referrer_person_title_title_id", "referrer_person_title_descr");
                pr.RegisterReferrer.Organisation          = OrganisationDB.Load(tbl.Rows[0], "organisation_");
            }
            if (tbl.Rows[0]["pr_organisation_id"] != DBNull.Value)
            {
                pr.Organisation = OrganisationDB.Load(tbl.Rows[0], "nonepcorg_");
            }

            return(pr);
        }
    }
    public static Hashtable GetHashtableByReferrer(bool incDeleted = false)
    {
        Hashtable hashtable = new Hashtable();

        DataTable tbl = DBBase.ExecuteQuery(JoinedSql(incDeleted, incDeleted, incDeleted)).Tables[0];

        foreach (DataRow row in tbl.Rows)
        {
            if (row["organisation_id"] == DBNull.Value)
            {
                continue;
            }

            Referrer r = ReferrerDB.Load(row);
            r.Person       = PersonDB.Load(row, "", "person_entity_id");
            r.Person.Title = IDandDescrDB.Load(row, "title_id", "descr");
            Organisation o = OrganisationDB.Load(row, "", "organisation_entity_id", "organisation_is_deleted");

            if (hashtable[r.ReferrerID] == null)
            {
                hashtable[r.ReferrerID] = new ArrayList();
            }
            ((ArrayList)hashtable[r.ReferrerID]).Add(o);
        }

        return(hashtable);
    }
示例#4
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);
    }
示例#5
0
    public static Organisation[] GetOrganisationsOf(int staff_id)
    {
        DataTable tbl = GetDataTable_OrganisationsOf(staff_id);

        Organisation[] list = new Organisation[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i] = OrganisationDB.Load(tbl.Rows[i], "", "organisation_entity_id", "organisation_is_deleted");
        }
        return(list);
    }
示例#6
0
    public static Organisation[] GetAllNotInc(Organisation[] excList, bool exclGroupOrg = true, bool exclIns = true)
    {
        DataTable tbl = GetDataTable_AllNotInc(excList, exclGroupOrg, false, false, exclIns);

        Organisation[] list = new Organisation[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i] = OrganisationDB.Load(tbl.Rows[i]);
        }

        return(list);
    }
示例#7
0
    public static Letter LoadAll(DataRow row)
    {
        Letter letter = Load(row, "letter_");

        letter.LetterType = IDandDescrDB.Load(row, "lettertype_letter_type_id", "lettertype_descr");
        letter.Site       = SiteDB.Load(row, "site_");
        if (row["letterorg_organisation_id"] != DBNull.Value)
        {
            letter.Organisation = OrganisationDB.Load(row, "letterorg_");
        }
        return(letter);
    }
示例#8
0
    public static Organisation[] GetChildrenOf(int parent_organisation_id)
    {
        string    sql = JoinedSql + @"  WHERE o.is_deleted = 0 AND o.parent_organisation_id = " + parent_organisation_id.ToString() + " ORDER BY o.name";
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        Organisation[] list = new Organisation[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i] = OrganisationDB.Load(tbl.Rows[i]);
        }

        return(list);
    }
    public static RegisterReferrer LoadAll(DataRow row)
    {
        RegisterReferrer rr = Load(row);

        rr.Referrer              = ReferrerDB.Load(row);
        rr.Referrer.Person       = PersonDB.Load(row, "", "person_entity_id");
        rr.Referrer.Person.Title = IDandDescrDB.Load(row, "title_id", "descr");
        if (row["organisation_id"] != DBNull.Value)
        {
            rr.Organisation = OrganisationDB.Load(row, "", "organisation_entity_id", "organisation_is_deleted");
        }
        return(rr);
    }
    public static LetterTreatmentTemplate LoadAll(DataRow row)
    {
        LetterTreatmentTemplate letters = Load(row, "lettertreatmenttemplate_");

        letters.Field = IDandDescrDB.Load(row, "field_field_id", "field_descr");

        letters.FirstLetter            = LetterDB.Load(row, "firstletter_");
        letters.FirstLetter.LetterType = IDandDescrDB.Load(row, "firstlettertype_letter_type_id", "firstlettertype_descr");
        letters.FirstLetter.Site       = SiteDB.Load(row, "firstsite_");
        if (row["firstletterorg_organisation_id"] != DBNull.Value)
        {
            letters.FirstLetter.Organisation = OrganisationDB.Load(row, "firstletterorg_");
        }

        letters.TreatmentNotesLetter            = LetterDB.Load(row, "treatmentnotesletter_");
        letters.TreatmentNotesLetter.LetterType = IDandDescrDB.Load(row, "treatmentnoteslettertype_letter_type_id", "treatmentnoteslettertype_descr");
        letters.TreatmentNotesLetter.Site       = SiteDB.Load(row, "treatmentnotessite_");
        if (row["treatmentnotesletterorg_organisation_id"] != DBNull.Value)
        {
            letters.TreatmentNotesLetter.Organisation = OrganisationDB.Load(row, "treatmentnotesletterorg_");
        }

        letters.LastLetter            = LetterDB.Load(row, "lastletter_");
        letters.LastLetter.LetterType = IDandDescrDB.Load(row, "lastlettertype_letter_type_id", "lastlettertype_descr");
        letters.LastLetter.Site       = SiteDB.Load(row, "lastsite_");
        if (row["lastletterorg_organisation_id"] != DBNull.Value)
        {
            letters.LastLetter.Organisation = OrganisationDB.Load(row, "lastletterorg_");
        }

        letters.LastLetterPT            = LetterDB.Load(row, "lastletterpt_");
        letters.LastLetterPT.LetterType = IDandDescrDB.Load(row, "lastlettertypept_letter_type_id", "lastlettertypept_descr");
        letters.LastLetterPT.Site       = SiteDB.Load(row, "lastsitept_");
        if (row["lastletterorgpt_organisation_id"] != DBNull.Value)
        {
            letters.LastLetterPT.Organisation = OrganisationDB.Load(row, "lastletterorgpt_");
        }

        letters.LastLetterWhenReplacingEPC            = LetterDB.Load(row, "lastletterwhenreplacingepc_");
        letters.LastLetterWhenReplacingEPC.LetterType = IDandDescrDB.Load(row, "lastletterwhenreplacingepctype_letter_type_id", "lastletterwhenreplacingepctype_descr");
        letters.LastLetterWhenReplacingEPC.Site       = SiteDB.Load(row, "lastwhenreplacingepcsite_");
        if (row["lastletterorg_organisation_id"] != DBNull.Value)
        {
            letters.LastLetterWhenReplacingEPC.Organisation = OrganisationDB.Load(row, "lastletterwhenreplacingepcorg_");
        }

        letters.Site = SiteDB.Load(row, "site_");

        return(letters);
    }
    private static RegisterReferrer[] _GetEPCReferrersOf(int patient_id, bool onlyActive)
    {
        DataTable tbl = onlyActive ? GetDataTable_ActiveEPCReferrersOf(patient_id) : GetDataTable_EPCReferrersOf(patient_id);

        RegisterReferrer[] list = new RegisterReferrer[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            RegisterReferrer rr = RegisterReferrerDB.Load(tbl.Rows[i], "regref_");
            rr.Referrer              = ReferrerDB.Load(tbl.Rows[i], "referrer_");
            rr.Referrer.Person       = PersonDB.Load(tbl.Rows[i], "referrer_person_");
            rr.Referrer.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "referrer_person_title_title_id", "referrer_person_title_descr");
            rr.Organisation          = OrganisationDB.Load(tbl.Rows[i], "organisation_");
            list[i] = rr;
        }
        return(list);
    }
示例#12
0
    // returns 2d hashtable
    // get by:  hash[new Hashtable2D.Key(staffID, (int)DayOfWeek.Sunday)]
    public static Hashtable Get2DHashByStaffIDDayID(int[] staff_ids = null)
    {
        string    sql = JoinedSql + (staff_ids != null && staff_ids.Length > 0 ? @" AND r.staff_id IN(" + string.Join(",", staff_ids) + ")" : "");
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        Hashtable hash = new Hashtable();

        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            RegisterStaff rr = Load(tbl.Rows[i], "registration_provider_number");
            rr.Staff        = StaffDB.Load(tbl.Rows[i], "staff_");
            rr.Staff.Person = PersonDB.Load(tbl.Rows[i], "", "person_entity_id");
            rr.Organisation = OrganisationDB.Load(tbl.Rows[i], "organisation_");

            if (!rr.ExclSun)
            {
                AddToStaffIDDayIDHash(ref hash, ref rr, DayOfWeek.Sunday);
            }
            if (!rr.ExclMon)
            {
                AddToStaffIDDayIDHash(ref hash, ref rr, DayOfWeek.Monday);
            }
            if (!rr.ExclTue)
            {
                AddToStaffIDDayIDHash(ref hash, ref rr, DayOfWeek.Tuesday);
            }
            if (!rr.ExclWed)
            {
                AddToStaffIDDayIDHash(ref hash, ref rr, DayOfWeek.Wednesday);
            }
            if (!rr.ExclThu)
            {
                AddToStaffIDDayIDHash(ref hash, ref rr, DayOfWeek.Thursday);
            }
            if (!rr.ExclFri)
            {
                AddToStaffIDDayIDHash(ref hash, ref rr, DayOfWeek.Friday);
            }
            if (!rr.ExclSat)
            {
                AddToStaffIDDayIDHash(ref hash, ref rr, DayOfWeek.Saturday);
            }
        }

        return(hash);
    }
示例#13
0
    public static RegisterStaff GetByID(int register_staff_id)
    {
        string    sql = JoinedSql + " AND register_staff_id = " + register_staff_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        if (tbl.Rows.Count == 0)
        {
            return(null);
        }
        else
        {
            RegisterStaff rr = Load(tbl.Rows[0], "registration_provider_number");
            rr.Staff        = StaffDB.Load(tbl.Rows[0], "staff_");
            rr.Staff.Person = PersonDB.Load(tbl.Rows[0], "", "person_entity_id");
            rr.Organisation = OrganisationDB.Load(tbl.Rows[0], "organisation_");
            return(rr);
        }
    }
示例#14
0
    public static RegisterStaff[] GetAll()
    {
        DataTable tbl = GetDataTable_All();

        RegisterStaff[] list = new RegisterStaff[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i] = RegisterStaffDB.Load(tbl.Rows[i]);

            list[i].Staff              = StaffDB.Load(tbl.Rows[i], "staff_");
            list[i].Staff.Person       = PersonDB.Load(tbl.Rows[i], "", "person_entity_id");
            list[i].Staff.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_id", "descr");

            list[i].Organisation = OrganisationDB.Load(tbl.Rows[i], "organisation_");
        }

        return(list);
    }
示例#15
0
    public static RegisterStaff GetByStaffIDAndOrganisationID(int staff_id, int organisation_id, bool inc_deleted = false)
    {
        string    sql = JoinedSql + " AND r.staff_id = " + staff_id + " AND r.organisation_id = " + organisation_id + (inc_deleted ? "" : " AND r.is_deleted = 0 ");
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        if (tbl.Rows.Count == 0)
        {
            return(null);
        }
        else
        {
            RegisterStaff rr = Load(tbl.Rows[0], "registration_provider_number");
            rr.Staff        = StaffDB.Load(tbl.Rows[0], "staff_");
            rr.Staff.Person = PersonDB.Load(tbl.Rows[0], "", "person_entity_id");
            rr.Organisation = OrganisationDB.Load(tbl.Rows[0], "organisation_");
            return(rr);
        }
    }
示例#16
0
    // returns 2d hashtable
    // get by:  hash[new Hashtable2D.Key(staffID, orgID)]
    public static Hashtable Get2DHashByStaffIDOrgID(int[] staff_ids = null)
    {
        string    sql = JoinedSql + (staff_ids != null && staff_ids.Length > 0 ? @" AND r.staff_id IN(" + string.Join(",", staff_ids) + ")" : "");
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        Hashtable hash = new Hashtable();

        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            RegisterStaff rr = Load(tbl.Rows[i], "registration_provider_number");
            rr.Staff        = StaffDB.Load(tbl.Rows[i], "staff_");
            rr.Staff.Person = PersonDB.Load(tbl.Rows[i], "", "person_entity_id");
            rr.Organisation = OrganisationDB.Load(tbl.Rows[i], "organisation_");
            hash[new Hashtable2D.Key(rr.Staff.StaffID, rr.Organisation.OrganisationID)] = rr;
        }

        return(hash);
    }
示例#17
0
    protected string GetLine(int id, Person p, string colSep, string rowSep, bool incRowSep, bool incDOB, bool incAddresses, bool incPhoneNbrs, bool incRefInfo)
    {
        string result = string.Empty;

        if (incRowSep)
        {
            result += rowSep;
        }
        result += id.ToString() + colSep + p.Firstname + colSep + p.Middlename + colSep + p.Surname;
        if (incDOB)
        {
            result += colSep + (p.Dob == DateTime.MinValue ? "" : p.Dob.ToString("dd-MM-yyyy"));
        }
        if (incAddresses)
        {
            result += colSep + GetAddresses(p.EntityID);
        }
        if (incPhoneNbrs)
        {
            result += colSep + GetPhoneNbrs(p.EntityID);
        }

        if (incRefInfo)
        {
            string orgNames = string.Empty;
            string provNbrs = string.Empty;

            System.Data.DataTable tbl  = RegisterReferrerDB.GetDataTable_OrganisationsOf(id);
            RegisterReferrer[]    list = new RegisterReferrer[tbl.Rows.Count];
            for (int i = 0; i < tbl.Rows.Count; i++)
            {
                list[i] = RegisterReferrerDB.Load(tbl.Rows[i]);
                list[i].Organisation = OrganisationDB.Load(tbl.Rows[i], "", "organisation_entity_id", "organisation_is_deleted");
                orgNames            += (orgNames.Length == 0 ? "" : "\r\n") + list[i].Organisation.Name;
                provNbrs            += (provNbrs.Length == 0 ? "" : "\r\n") + list[i].ProviderNumber;
            }

            result += colSep + orgNames;
            result += colSep + provNbrs;
        }

        return(result);
    }
    protected void GrdReferrer_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label        lblId         = (Label)GrdReferrer.Rows[e.RowIndex].FindControl("lblId");
        DropDownList ddlTitle      = (DropDownList)GrdReferrer.Rows[e.RowIndex].FindControl("ddlTitle");
        TextBox      txtFirstname  = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtFirstname");
        TextBox      txtMiddlename = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtMiddlename");
        TextBox      txtSurname    = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtSurname");
        DropDownList ddlGender     = (DropDownList)GrdReferrer.Rows[e.RowIndex].FindControl("ddlGender");

        TextBox txtName = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtName");
        TextBox txtABN  = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtABN");
        TextBox txtACN  = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtACN");

        TextBox      txtProviderNumber     = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtProviderNumber");
        DropDownList ddlIsClinic           = (DropDownList)GrdReferrer.Rows[e.RowIndex].FindControl("ddlIsClinic");
        CheckBox     chkIsReportEveryVisit = (CheckBox)GrdReferrer.Rows[e.RowIndex].FindControl("chkIsReportEveryVisit");
        CheckBox     chkIsBatchSendAllPatientsTreatmentNotes = (CheckBox)GrdReferrer.Rows[e.RowIndex].FindControl("chkIsBatchSendAllPatientsTreatmentNotes");


        int registger_referrer_id = Convert.ToInt32(lblId.Text);

        DataTable dt = Session["referrerinfolist_data"] as DataTable;

        DataRow[] foundRows = dt.Select("register_referrer_id=" + registger_referrer_id.ToString());
        DataRow   row       = foundRows[0];

        RegisterReferrer rr = RegisterReferrerDB.Load(row);

        rr.Referrer              = ReferrerDB.Load(row);
        rr.Referrer.Person       = PersonDB.Load(row, "", "person_entity_id");
        rr.Referrer.Person.Title = IDandDescrDB.Load(row, "title_id", "descr");
        if (row["organisation_id"] != DBNull.Value)
        {
            rr.Organisation = OrganisationDB.Load(row, "", "organisation_entity_id", "organisation_is_deleted");
        }

        PersonDB.Update(rr.Referrer.Person.PersonID, Convert.ToInt32(ddlTitle.SelectedValue), Utilities.FormatName(txtFirstname.Text), Utilities.FormatName(txtMiddlename.Text), Utilities.FormatName(txtSurname.Text), row["nickname"].ToString(), ddlGender.SelectedValue, row["dob"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(row["dob"]), DateTime.Now);
        OrganisationDB.UpdateExtOrg(rr.Organisation.OrganisationID, rr.Organisation.OrganisationType.OrganisationTypeID, txtName.Text, txtACN.Text, txtABN.Text, DateTime.Now, rr.Organisation.IsDebtor, rr.Organisation.IsCreditor, rr.Organisation.BpayAccount, rr.Organisation.Comment);
        RegisterReferrerDB.Update(rr.RegisterReferrerID, rr.Organisation.OrganisationID, rr.Referrer.ReferrerID, txtProviderNumber.Text, chkIsReportEveryVisit.Checked, chkIsBatchSendAllPatientsTreatmentNotes.Checked, rr.DateLastBatchSendAllPatientsTreatmentNotes);

        GrdReferrer.EditIndex = -1;
        FillGrid();
    }
    // hashtable: patient_id => RegisterReferrer[]
    public static Hashtable GetEPCReferrersOf(int[] patient_ids, bool onlyActive)
    {
        string sql = JoinedSQL() + @" 
                        AND " + (patient_ids != null && patient_ids.Length > 0 ? " pat.patient_id IN (" + string.Join(",", patient_ids) + @")" : "1 <> 1") + @"
                        " + (onlyActive ? " AND pr.is_active = 1 " : "") + @"
                        ORDER BY patient_referrer_date_added";

        DataTable tbl  = DBBase.ExecuteQuery(sql).Tables[0];
        Hashtable hash = new Hashtable();

        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            RegisterReferrer rr = RegisterReferrerDB.Load(tbl.Rows[i], "regref_");
            rr.Referrer              = ReferrerDB.Load(tbl.Rows[i], "referrer_");
            rr.Referrer.Person       = PersonDB.Load(tbl.Rows[i], "referrer_person_");
            rr.Referrer.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "referrer_person_title_title_id", "referrer_person_title_descr");
            rr.Organisation          = OrganisationDB.Load(tbl.Rows[i], "organisation_");

            int patient_id = Convert.ToInt32(tbl.Rows[i]["pr_patient_id"]);
            if (hash[patient_id] == null)
            {
                hash[patient_id] = new System.Collections.ArrayList();
            }
            ((System.Collections.ArrayList)hash[patient_id]).Add(rr);
        }


        // convert from arraylists to arrays
        ArrayList keys = new ArrayList();

        foreach (System.Collections.DictionaryEntry de in hash)
        {
            keys.Add(de.Key);
        }
        foreach (int key in keys)
        {
            hash[key] = (RegisterReferrer[])((ArrayList)hash[key]).ToArray(typeof(RegisterReferrer));
        }
        ;

        return(hash);
    }
示例#20
0
    public static Referral LoadAll(DataRow row)
    {
        Referral referral = Load(row);

        referral.HealthCard         = HealthCardDB.Load(row);
        referral.MedicalServiceType = IDandDescrDB.Load(row, "mct_medical_service_type_id", "mct_descr");


        referral.RegisterReferrer                       = RegisterReferrerDB.Load(row, "regref_");
        referral.RegisterReferrer.Referrer              = ReferrerDB.Load(row, "referrer_");
        referral.RegisterReferrer.Referrer.Person       = PersonDB.Load(row, "referrer_person_");
        referral.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(row, "referrer_person_title_title_id", "referrer_person_title_descr");
        if (row["organisation_organisation_id"] != DBNull.Value)
        {
            referral.RegisterReferrer.Organisation = OrganisationDB.Load(row, "organisation_");
        }


        if (row["added_or_last_modified_by_staff_id"] != DBNull.Value)
        {
            referral.AddedOrLastModifiedBy = StaffDB.Load(row, "added_or_last_modified_by_");
        }
        if (row["person_added_or_last_modified_by_person_id"] != DBNull.Value)
        {
            referral.AddedOrLastModifiedBy.Person       = PersonDB.Load(row, "person_added_or_last_modified_by_");
            referral.AddedOrLastModifiedBy.Person.Title = IDandDescrDB.Load(row, "title_added_or_last_modified_by_title_id", "title_added_or_last_modified_by_descr");
        }

        if (row["deleted_by_staff_id"] != DBNull.Value)
        {
            referral.AddedOrLastModifiedBy = StaffDB.Load(row, "deleted_by_");
        }
        if (row["person_deleted_by_person_id"] != DBNull.Value)
        {
            referral.AddedOrLastModifiedBy.Person       = PersonDB.Load(row, "person_deleted_by_");
            referral.AddedOrLastModifiedBy.Person.Title = IDandDescrDB.Load(row, "title_deleted_by_title_id", "title_deleted_by_descr");
        }


        return(referral);
    }
    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);
    }
    public static PatientReferrer LoadAll(DataRow row)
    {
        PatientReferrer pr = PatientReferrerDB.Load(row, "pr_");

        pr.RegisterReferrer                       = RegisterReferrerDB.Load(row, "regref_");
        pr.RegisterReferrer.Referrer              = ReferrerDB.Load(row, "referrer_");
        pr.RegisterReferrer.Referrer.Person       = PersonDB.Load(row, "referrer_person_");
        pr.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(row, "referrer_person_title_title_id", "referrer_person_title_descr");
        if (row["organisation_organisation_id"] != DBNull.Value)
        {
            pr.RegisterReferrer.Organisation = OrganisationDB.Load(row, "organisation_");
        }
        pr.Patient              = PatientDB.Load(row, "patient_");
        pr.Patient.Person       = PersonDB.Load(row, "patient_person_");
        pr.Patient.Person.Title = IDandDescrDB.Load(row, "patient_person_title_title_id", "patient_person_title_descr");
        if (row["nonepcorg_entity_id"] != DBNull.Value)
        {
            pr.Organisation = OrganisationDB.Load(row, "nonepcorg_");
        }

        return(pr);
    }
    private static PatientReferrer[] _GetEPCPatientReferrersOf(int patient_id, bool onlyActive)
    {
        DataTable tbl = onlyActive ? GetDataTable_ActiveEPCReferrersOf(patient_id) : GetDataTable_EPCReferrersOf(patient_id);

        PatientReferrer[] list = new PatientReferrer[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            PatientReferrer pr = Load(tbl.Rows[i], "pr_");
            pr.RegisterReferrer                       = RegisterReferrerDB.Load(tbl.Rows[i], "regref_");
            pr.RegisterReferrer.Referrer              = ReferrerDB.Load(tbl.Rows[i], "referrer_");
            pr.RegisterReferrer.Referrer.Person       = PersonDB.Load(tbl.Rows[i], "referrer_person_");
            pr.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "referrer_person_title_title_id", "referrer_person_title_descr");
            if (tbl.Rows[i]["organisation_organisation_id"] != DBNull.Value)
            {
                pr.RegisterReferrer.Organisation = OrganisationDB.Load(tbl.Rows[i], "organisation_");
            }
            pr.Patient              = PatientDB.Load(tbl.Rows[i], "patient_");
            pr.Patient.Person       = PersonDB.Load(tbl.Rows[i], "patient_person_");
            pr.Patient.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "patient_person_title_title_id", "patient_person_title_descr");
            list[i] = pr;
        }
        return(list);
    }
示例#24
0
    public static LetterPrintHistory LoadAll(DataRow row)
    {
        LetterPrintHistory lph = Load(row, "lph_");

        lph.Letter = LetterDB.Load(row, "letter_");

        lph.SendMethod = new IDandDescr(Convert.ToInt32(row["lph_send_method_letter_print_history_send_method_id"]), Convert.ToString(row["lph_send_method_descr"]));

        lph.Letter.LetterType = IDandDescrDB.Load(row, "lettertype_letter_type_id", "lettertype_descr");
        if (row["letterorg_organisation_id"] != DBNull.Value)
        {
            lph.Letter.Organisation = OrganisationDB.Load(row, "letterorg_");
        }

        if (row["organisation_organisation_id"] != DBNull.Value)
        {
            lph.Organisation = OrganisationDB.Load(row, "organisation_");
        }

        if (row["patient_patient_id"] != DBNull.Value)
        {
            lph.Patient = PatientDB.Load(row, "patient_");
        }
        if (row["patient_patient_id"] != DBNull.Value)
        {
            lph.Patient.Person       = PersonDB.Load(row, "person_patient_");
            lph.Patient.Person.Title = IDandDescrDB.Load(row, "title_patient_title_id", "title_patient_descr");
        }

        if (row["staff_staff_id"] != DBNull.Value)
        {
            lph.Staff = StaffDB.Load(row, "staff_");
        }
        if (row["staff_staff_id"] != DBNull.Value)
        {
            lph.Staff.Person       = PersonDB.Load(row, "person_staff_");
            lph.Staff.Person.Title = IDandDescrDB.Load(row, "title_staff_title_id", "title_staff_descr");
        }

        if (row["regref_register_referrer_id"] != DBNull.Value)
        {
            lph.RegisterReferrer = RegisterReferrerDB.Load(row, "regref_");
        }
        if (row["regreforg_organisation_id"] != DBNull.Value)
        {
            lph.RegisterReferrer.Organisation = OrganisationDB.Load(row, "regreforg_");
        }
        if (row["referrer_referrer_id"] != DBNull.Value)
        {
            lph.RegisterReferrer.Referrer = ReferrerDB.Load(row, "referrer_");
        }
        if (row["referrer_referrer_id"] != DBNull.Value)
        {
            lph.RegisterReferrer.Referrer.Person       = PersonDB.Load(row, "person_referrer_");
            lph.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(row, "title_referrer_title_id", "title_referrer_descr");
        }

        if (row["lph_health_card_action_id"] != DBNull.Value)
        {
            lph.HealthCardAction = HealthCardActionDB.Load(row, "hca_");
            lph.HealthCardAction.healthCardActionType = IDandDescrDB.Load(row, "hcat_health_card_action_type_id", "hcat_descr");
            lph.HealthCardAction.HealthCard           = HealthCardDB.Load(row, "hc_");
        }

        if (row["lph_booking_id"] != DBNull.Value)
        {
            lph.Booking = BookingDB.Load(row, "booking_");
        }

        return(lph);
    }
    protected void GrdRegistration_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        UserView userView = UserView.GetInstance();

        Organisation org = null;

        if (IsValidFormID())
        {
            org = OrganisationDB.GetByID(GetFormID());
        }

        DataTable dt       = Session["registerofferingtoorg_data"] as DataTable;
        bool      tblEmpty = (dt.Rows.Count == 1 && dt.Rows[0][0] == DBNull.Value);

        if (!tblEmpty && e.Row.RowType == DataControlRowType.DataRow)
        {
            Label     lblId     = (Label)e.Row.FindControl("lblId");
            DataRow[] foundRows = dt.Select("oo_organisation_offering_id=" + lblId.Text);
            DataRow   thisRow   = foundRows[0];


            DropDownList ddlOffering = (DropDownList)e.Row.FindControl("ddlOffering");
            if (ddlOffering != null)
            {
                //Offering[] incList_orig = OrganisationOfferingsDB.GetOfferingsByOrg(false, Convert.ToInt32(thisRow["organisation_organisation_id"]));
                //Offering[] incList = Offering.RemoveByID(incList_orig, Convert.ToInt32(thisRow["o_offering_id"]));
                //DataTable offering = OfferingDB.GetDataTable_AllNotInc(incList);
                //DataTable offering = OfferingDB.GetDataTable_AllNotInc(incList);

                string offering_invoice_type_ids = "-1";
                if (userView.IsAgedCareView)
                {
                    offering_invoice_type_ids = "3,4"; // 4 = AC
                }
                else if (userView.IsClinicView)
                {
                    offering_invoice_type_ids = "1,3"; // 1 = Clinic
                }
                else
                {
                    throw new Exception("Logged in to neither clinic nor aged care");
                }

                bool      isAgedCareResidentTypes = IsValidIsAgedCareResidentTypes() ? GetFormIsAgedCareResidentTypes() : false;
                DataTable offering = OfferingDB.GetDataTable(isAgedCareResidentTypes, offering_invoice_type_ids);

                offering.DefaultView.Sort = "o_name ASC";
                foreach (DataRowView row in offering.DefaultView)
                {
                    ddlOffering.Items.Add(new ListItem(row["o_name"].ToString(), row["o_offering_id"].ToString()));
                }
                ddlOffering.SelectedValue = thisRow["o_offering_id"].ToString();
            }

            Utilities.AddConfirmationBox(e);
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow);
            }
        }
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            Label lblOrganisation = (Label)e.Row.FindControl("lblNewOrganisation");
            if (lblOrganisation != null)
            {
                lblOrganisation.Text = org.Name;
            }

            DropDownList ddlOffering = (DropDownList)e.Row.FindControl("ddlNewOffering");
            if (ddlOffering != null)
            {
                DropDownList ddlOrganisation = (DropDownList)e.Row.FindControl("ddlNewOrganisation");
                DataTable    organisation    = OrganisationDB.GetDataTable(0, false, true, !userView.IsClinicView, !userView.IsAgedCareView, true, true);
                DataView     dataView        = new DataView(organisation);
                dataView.Sort = "name";
                organisation  = dataView.ToTable();
                for (int i = 0; i < organisation.Rows.Count; i++)
                {
                    Organisation o = OrganisationDB.Load(organisation.Rows[i]);
                    ddlOrganisation.Items.Add(new ListItem(o.Name, o.OrganisationID.ToString()));
                }
                if (org != null)
                {
                    ddlOrganisation.SelectedValue = org.OrganisationID.ToString();
                }



                //Offering[] incList = OrganisationOfferingsDB.GetOfferingsByOrg(false, org.OrganisationID);
                //DataTable offering = OfferingDB.GetDataTable_AllNotInc(incList);

                string offering_invoice_type_ids = "-1";
                if (userView.IsAgedCareView)
                {
                    offering_invoice_type_ids = "1,2,3,4"; // 4 = AC
                }
                else if (userView.IsClinicView)
                {
                    offering_invoice_type_ids = "1,2,3"; // 1 = Clinic
                }
                else
                {
                    throw new Exception("Logged in to neither clinic nor aged care");
                }


                bool isAgedCareResidentTypes = IsValidIsAgedCareResidentTypes() ? GetFormIsAgedCareResidentTypes() : false;

                DataTable offering = OfferingDB.GetDataTable(isAgedCareResidentTypes, offering_invoice_type_ids);
                DataView  dv       = new DataView(offering);
                dv.Sort  = "o_name ASC";
                offering = dv.ToTable();

                foreach (DataRow row in offering.Rows)
                {
                    ddlOffering.Items.Add(new ListItem(row["o_name"].ToString(), row["o_offering_id"].ToString()));
                }


                if (offering.Rows.Count == 0 || organisation.Rows.Count == 0)
                {
                    hideFotter = true;
                }
            }
        }
    }