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);
    }
Ejemplo n.º 2
0
    public static HealthCardEPCRemaining LoadAll(DataRow row)
    {
        HealthCardEPCRemaining epcremaining = Load(row, "epcremaining_");

        epcremaining.Field = IDandDescrDB.Load(row, "field_field_id", "field_descr");
        return(epcremaining);
    }
Ejemplo n.º 3
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));
    }
Ejemplo n.º 4
0
    public static ContactType LoadAll(DataRow row)
    {
        ContactType at = Load(row, "at_");

        at.ContactTypeGroup = IDandDescrDB.Load(row, "atg_contact_type_group_id", "atg_descr");
        return(at);
    }
Ejemplo n.º 5
0
    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);
        }
    }
Ejemplo n.º 6
0
    public static LetterBest LoadAll(DataRow row)
    {
        LetterBest letter = Load(row, "letter_");

        letter.LetterType = IDandDescrDB.Load(row, "lettertype_letter_type_id", "lettertype_descr");
        return(letter);
    }
    public static ReferralRemaining LoadAll(DataRow row)
    {
        ReferralRemaining epcremaining = Load(row, "epcremaining_");

        epcremaining.Field = IDandDescrDB.Load(row, "field_field_id", "field_descr");
        return(epcremaining);
    }
Ejemplo n.º 8
0
    public static Person LoadAll(DataRow row)
    {
        Person p = Load(row);

        p.Title = IDandDescrDB.Load(row, "title_id", "descr");
        return(p);
    }
Ejemplo n.º 9
0
    public static Contact LoadAll(DataRow row)
    {
        Contact a = Load(row, "ad_");

        a.ContactType = ContactTypeDB.Load(row, "at_");
        a.ContactType.ContactTypeGroup = IDandDescrDB.Load(row, "atg_contact_type_group_id", "atg_descr");
        if (row["act_address_channel_type_id"] != DBNull.Value)
        {
            a.AddressChannel = AddressChannelDB.Load(row, "ac_");
            a.AddressChannel.AddressChannelType = IDandDescrDB.Load(row, "act_address_channel_type_id", "act_descr");
        }
        if (row["s_suburb_id"] != DBNull.Value)
        {
            a.Suburb = SuburbDB.Load(row, "s_");
        }
        if (row["c_country_id"] != DBNull.Value)
        {
            a.Country = IDandDescrDB.Load(row, "c_country_id", "c_descr");
        }
        if (row["ad_site_id"] != DBNull.Value)
        {
            a.Site.Name = Convert.ToString(row["site_name"]);
        }
        return(a);
    }
Ejemplo n.º 10
0
    protected void UpdateReferrersAtOrgList()
    {
        if (ddlOrgsList.SelectedIndex == -1)
        {
            return;
        }

        lblProvidersOf.Visible = true;

        lblSelectedOrg.Text = ddlOrgsList.Items[ddlOrgsList.SelectedIndex].Text;

        DataTable tbl = RegisterReferrerDB.GetDataTable_ReferrersOf(Convert.ToInt32(ddlOrgsList.Items[ddlOrgsList.SelectedIndex].Value));

        RegisterReferrer[] regRefs = new RegisterReferrer[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            regRefs[i]                       = RegisterReferrerDB.Load(tbl.Rows[i]);
            regRefs[i].Referrer              = ReferrerDB.Load(tbl.Rows[i]);
            regRefs[i].Referrer.Person       = PersonDB.Load(tbl.Rows[i], "", "person_entity_id");
            regRefs[i].Referrer.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_id", "descr");
        }
        string list = tbl.Rows.Count == 0 ? string.Empty : @"<table cellpadding=""0"" cellspacing=""0"">";

        foreach (RegisterReferrer regRef in regRefs)
        {
            string url  = "ReferrerList_DoctorClinicV2.aspx?surname_search=" + regRef.Referrer.Person.Surname + @"&surname_starts_with=1" + (regRef.ProviderNumber.Length > 0 ? "&provider_nbr_search=" + regRef.ProviderNumber + "&provider_nbr_starts_with=1" : "");
            string href = @"<a href=""" + url + @""">" + regRef.Referrer.Person.FullnameWithoutMiddlename + "</a>";
            list += "<tr><td>" + href + @"</td><td style=""width:8px;"">&nbsp;</td><td> Prov Nbr: " + (regRef.ProviderNumber.Trim().Length == 0 ? "[None]" : regRef.ProviderNumber) + "</td></tr>";
        }
        list += tbl.Rows.Count == 0 ? string.Empty : "</table>";

        lblProvidersOfSelectedOrg.Text = list.Length > 0 ? list : "None";
    }
Ejemplo n.º 11
0
    protected void GrdSummaryReport_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataTable dt       = Session["data_bookingswithoutsmsoremail"] 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("patient_id=" + lblId.Text);
            DataRow   thisRow   = foundRows[0];

            Patient patient = PatientDB.Load(thisRow);
            patient.Person       = PersonDB.Load(thisRow);
            patient.Person.Title = IDandDescrDB.Load(thisRow, "t_title_id", "t_descr");



            Utilities.AddConfirmationBox(e);
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow);
            }
        }
        if (e.Row.RowType == DataControlRowType.Footer)
        {
        }
    }
Ejemplo n.º 12
0
    public static AddressChannel LoadAll(DataRow row)
    {
        AddressChannel ac = Load(row, "ac_");

        ac.AddressChannelType = IDandDescrDB.Load(row, "act_address_channel_type_id", "act_descr");
        return(ac);
    }
Ejemplo n.º 13
0
    public static Referrer LoadAll(DataRow row, string staff_prefix = "", string person_prefix = "", string person_title_id = "title_id", string person_title_descr = "descr")
    {
        Referrer r = Load(row, staff_prefix);

        r.Person       = PersonDB.Load(row, person_prefix);
        r.Person.Title = IDandDescrDB.Load(row, person_title_id, person_title_descr);
        return(r);
    }
Ejemplo n.º 14
0
    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);
    }
Ejemplo n.º 15
0
    public static Offering LoadAll(DataRow row)
    {
        Offering o = Load(row, "o_");

        o.OfferingType        = IDandDescrDB.Load(row, "type_offering_type_id", "type_descr");
        o.Field               = IDandDescrDB.Load(row, "fld_field_id", "fld_descr");
        o.AgedCarePatientType = IDandDescrDB.Load(row, "acpatientcat_aged_care_patient_type_id", "acpatientcat_descr");
        o.OfferingInvoiceType = IDandDescrDB.Load(row, "invtype_offering_invoice_type_id", "invtype_descr");
        return(o);
    }
Ejemplo n.º 16
0
    public static PatientCondition LoadAll(DataRow row)
    {
        PatientCondition patientCondition = Load(row, "patient_condition_");

        patientCondition.Condition            = ConditionDB.Load(row, "condition_");
        patientCondition.Patient              = PatientDB.Load(row, "patient_");
        patientCondition.Patient.Person       = PersonDB.Load(row, "person_", "entity_id");
        patientCondition.Patient.Person.Title = IDandDescrDB.Load(row, "title_title_id", "title_descr");
        return(patientCondition);
    }
Ejemplo n.º 17
0
    public static ReferrerAdditionalEmail LoadAll(DataRow row)
    {
        ReferrerAdditionalEmail rae = Load(row);

        rae.DeletedBy              = StaffDB.Load(row, "deleted_by_");
        rae.DeletedBy.Person       = PersonDB.Load(row, "person_deleted_by_");
        rae.DeletedBy.Person.Title = IDandDescrDB.Load(row, "title_deleted_by_title_id", "title_deleted_by_descr");

        return(rae);
    }
Ejemplo n.º 18
0
    public static CreditNote LoadAll(DataRow row)
    {
        CreditNote creditNote = Load(row);

        creditNote.Staff              = StaffDB.Load(row, "staff_");
        creditNote.Staff.Person       = PersonDB.Load(row, "person_");
        creditNote.Staff.Person.Title = IDandDescrDB.Load(row, "title_title_id", "title_descr");

        return(creditNote);
    }
Ejemplo n.º 19
0
    public static Staff LoadAll(DataRow row)
    {
        Staff staff = Load(row, "staff_");

        staff.Person        = PersonDB.Load(row, "person_");
        staff.Person.Title  = IDandDescrDB.Load(row, "title_title_id", "title_descr");
        staff.Field         = IDandDescrDB.Load(row, "field_field_id", "field_descr");
        staff.StaffPosition = StaffPositionDB.Load(row, "staff_position_");
        staff.CostCentre    = CostCentreDB.Load(row, "cost_centre_");
        return(staff);
    }
Ejemplo n.º 20
0
    public static PatientHistory LoadAll(DataRow row)
    {
        PatientHistory p = Load(row);

        p.Title = IDandDescrDB.Load(row, "title_id", "descr");

        p.ModifiedFromThisBy              = StaffDB.Load(row, "staff_person_");
        p.ModifiedFromThisBy.Person       = PersonDB.Load(row, "staff_person_");
        p.ModifiedFromThisBy.Person.Title = IDandDescrDB.Load(row, "title_staff_title_id", "title_staff_descr");

        return(p);
    }
Ejemplo n.º 21
0
    public static Refund LoadAll(DataRow row)
    {
        Refund refund = Load(row);

        refund.RefundReason = IDandDescrDB.Load(row, "refund_reason_id", "descr");

        refund.Staff              = StaffDB.Load(row, "staff_");
        refund.Staff.Person       = PersonDB.Load(row, "staff_person_");
        refund.Staff.Person.Title = IDandDescrDB.Load(row, "title_title_id", "title_descr");

        return(refund);
    }
Ejemplo n.º 22
0
    public static Referrer[] LoadFull(DataTable tbl, string staff_prefix = "", string person_prefix = "", string person_title_id = "title_id", string person_title_descr = "descr")
    {
        Referrer[] list = new Referrer[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i]              = Load(tbl.Rows[i], staff_prefix);
            list[i].Person       = PersonDB.Load(tbl.Rows[i], person_prefix);
            list[i].Person.Title = IDandDescrDB.Load(tbl.Rows[i], person_title_id, person_title_descr);
        }

        return(list);
    }
Ejemplo n.º 23
0
    public static Receipt LoadAll(DataRow row)
    {
        Receipt receipt = Load(row);

        receipt.Staff              = StaffDB.Load(row, "staff_");
        receipt.Staff.Person       = PersonDB.Load(row, "person_");
        receipt.Staff.Person.Title = IDandDescrDB.Load(row, "title_title_id", "title_descr");

        receipt.ReceiptPaymentType = IDandDescrDB.Load(row, "receipt_payment_type_id", "descr");

        return(receipt);
    }
Ejemplo n.º 24
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);
    }
    public static HealthCardEPCRemainingChangeHistory[] GetByHealthCardID(int health_card_id)
    {
        string sql = @"
            SELECT  
                    health_card_epc_remaining_change_history_id,HealthCardEPCRemainingChangeHistory.health_card_epc_remaining_id,HealthCardEPCRemainingChangeHistory.staff_id,date,
                    pre_num_services_remaining,post_num_services_remaining,
                    health_card_id,HealthCardEPCRemaining.field_id,num_services_remaining,deleted_by,date_deleted,
                    Field.descr,

                    staff.staff_id as staff_staff_id, staff.person_id as staff_person_id, staff.login as staff_login, staff.pwd as staff_pwd, 
                    staff.staff_position_id as staff_staff_position_id, staff.field_id as staff_field_id, staff.costcentre_id as staff_costcentre_id, 
                    staff.is_contractor as staff_is_contractor, staff.tfn as staff_tfn, staff.provider_number as staff_provider_number, 
                    staff.is_fired as staff_is_fired, staff.is_commission as staff_is_commission, staff.commission_percent as staff_commission_percent, 
                    staff.is_stakeholder as staff_is_stakeholder,staff.is_master_admin as staff_is_master_admin,staff.is_admin as staff_is_admin,staff.is_principal as staff_is_principal,staff.is_provider as staff_is_provider, staff.is_external as staff_is_external,
                    staff.staff_date_added as staff_staff_date_added, staff.start_date as staff_start_date, staff.end_date as staff_end_date, 
                    staff.comment as staff_comment, 
                    staff.num_days_to_display_on_booking_screen as staff_num_days_to_display_on_booking_screen,
                    staff.show_header_on_booking_screen as staff_show_header_on_booking_screen,
                    staff.bk_screen_field_id as staff_bk_screen_field_id, staff.bk_screen_show_key as staff_bk_screen_show_key,
                    staff.enable_daily_reminder_sms as staff_enable_daily_reminder_sms, 
                    staff.enable_daily_reminder_email as staff_enable_daily_reminder_email,
                    staff.hide_booking_notes as staff_hide_booking_notes,

                    " + PersonDB.GetFields("person_", "person") + @",
                    title.title_id as title_title_id, title.descr as title_descr

            FROM    
                    HealthCardEPCRemainingChangeHistory 
                    LEFT OUTER JOIN HealthCardEPCRemaining ON HealthCardEPCRemainingChangeHistory.health_card_epc_remaining_id  = HealthCardEPCRemaining.health_card_epc_remaining_id
                    LEFT OUTER JOIN Field                  ON HealthCardEPCRemaining.field_id = Field.field_id

                    LEFT OUTER JOIN Staff  staff   ON staff.staff_id   = HealthCardEPCRemainingChangeHistory.staff_id
                    LEFT OUTER JOIN Person person  ON person.person_id = staff.person_id
                    LEFT OUTER JOIN Title  title   ON title.title_id   = person.title_id

            WHERE   
                    HealthCardEPCRemaining.health_card_id = " + health_card_id;

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

        HealthCardEPCRemainingChangeHistory[] histories = new HealthCardEPCRemainingChangeHistory[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            histories[i] = Load(tbl.Rows[i]);
            histories[i].HealthCardEpcRemaining       = HealthCardEPCRemainingDB.Load(tbl.Rows[i]);
            histories[i].HealthCardEpcRemaining.Field = IDandDescrDB.Load(tbl.Rows[i], "field_id", "descr");

            histories[i].Staff              = StaffDB.Load(tbl.Rows[i], "staff_");
            histories[i].Staff.Person       = PersonDB.Load(tbl.Rows[i], "person_");
            histories[i].Staff.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_title_id", "title_descr");
        }
        return(histories);
    }
Ejemplo n.º 26
0
    public static Referrer[] GetReferrersOf(int organistion_id, bool showDeletedRefs = false, bool showDeletedRegRefs = false)
    {
        DataTable tbl = GetDataTable_ReferrersOf(organistion_id, showDeletedRefs, showDeletedRegRefs);

        Referrer[] list = new Referrer[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i]              = ReferrerDB.Load(tbl.Rows[i]);
            list[i].Person       = PersonDB.Load(tbl.Rows[i], "", "person_entity_id");
            list[i].Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_id", "descr");
        }
        return(list);
    }
Ejemplo n.º 27
0
    public static Staff[] GetWorkingStaffOf(int organistion_id, DateTime date)
    {
        DataTable tbl = GetDataTable_WorkingStaffOf(organistion_id, date);

        Staff[] list = new Staff[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i]              = StaffDB.Load(tbl.Rows[i]);
            list[i].Person       = PersonDB.Load(tbl.Rows[i], "", "person_entity_id");
            list[i].Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_id", "descr");
        }
        return(list);
    }
Ejemplo n.º 28
0
    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);
    }
Ejemplo n.º 29
0
    public static Referrer[] GetAllNotInc(Referrer[] excList)
    {
        DataTable tbl = GetDataTable_AllNotInc(excList);

        Referrer[] list = new Referrer[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i]              = ReferrerDB.Load(tbl.Rows[i]);
            list[i].Person       = PersonDB.Load(tbl.Rows[i]);
            list[i].Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_id", "descr");
        }

        return(list);
    }
    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);
    }