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";
    }
    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);
    }
    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);
        }
    }
Пример #4
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)
        {
        }
    }
Пример #5
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));
    }
Пример #6
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);
    }
    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);
    }
    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);
    }
Пример #9
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);
    }
Пример #10
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);
    }
Пример #11
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);
    }
Пример #12
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);
    }
Пример #13
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);
    }
Пример #14
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);
    }
    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);
    }
Пример #16
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);
    }
    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 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);
    }
Пример #19
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);
    }
Пример #20
0
    private static Patient[] _GetPatientsOf(int register_referrer_id, bool onlyActive)
    {
        DataTable tbl = onlyActive ? GetDataTable_ActivePatientsOf(register_referrer_id) : GetDataTable_PatientsOf(register_referrer_id);

        Patient[] list = new Patient[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            Patient patient = PatientDB.Load(tbl.Rows[i]);
            patient.Person       = PersonDB.Load(tbl.Rows[i]);
            patient.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_id", "descr");
            list[i] = patient;
        }
        return(list);
    }
Пример #21
0
    public static HealthCard LoadAll(DataRow row)
    {
        HealthCard hc = Load(row);

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

        return(hc);
    }
Пример #22
0
    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);
    }
Пример #23
0
    public static SMSHistoryData LoadAll(DataRow row)
    {
        SMSHistoryData s = Load(row);

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

        return(s);
    }
Пример #24
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);
    }
Пример #25
0
    public static InvoiceLine LoadAll(DataRow row)
    {
        InvoiceLine line = Load(row);

        if (row["offering_id"] != DBNull.Value)
        {
            line.Offering = OfferingDB.Load(row);
        }
        if (row["patient_id"] != DBNull.Value)
        {
            line.Patient              = PatientDB.Load(row, "patient_");
            line.Patient.Person       = PersonDB.Load(row, "patient_person_");
            line.Patient.Person.Title = IDandDescrDB.Load(row, "title_patient_title_id", "title_patient_descr");
        }

        return(line);
    }
Пример #26
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);
        }
    }
Пример #27
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);
        }
    }
Пример #28
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);
    }
Пример #29
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);
    }
Пример #30
0
    public static Credit LoadAll(DataRow row)
    {
        Credit credit = Load(row, "credit_");

        credit.CreditType = new IDandDescr(Convert.ToInt32(row["credittype_credit_type_id"]), Convert.ToString(row["credittype_descr"]));

        if (row["vouchercredit_credit_id"] != DBNull.Value)
        {
            credit.VoucherCredit            = CreditDB.Load(row, "vouchercredit_");
            credit.VoucherCredit.CreditType = new IDandDescr(Convert.ToInt32(row["vouchercredittype_credit_type_id"]), Convert.ToString(row["vouchercredittype_descr"]));
        }

        if (row["added_by_staff_id"] != DBNull.Value)
        {
            credit.AddedBy = StaffDB.Load(row, "added_by_");
        }
        if (row["person_added_by_person_id"] != DBNull.Value)
        {
            credit.AddedBy.Person       = PersonDB.Load(row, "person_added_by_");
            credit.AddedBy.Person.Title = IDandDescrDB.Load(row, "title_added_by_title_id", "title_added_by_descr");
        }

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

        if (row["modified_by_staff_id"] != DBNull.Value)
        {
            credit.ModifiedBy = StaffDB.Load(row, "modified_by_");
        }
        if (row["person_modified_by_person_id"] != DBNull.Value)
        {
            credit.ModifiedBy.Person.Title = IDandDescrDB.Load(row, "title_modified_by_title_id", "title_modified_by_descr");
            credit.ModifiedBy.Person       = PersonDB.Load(row, "person_modified_by_");
        }

        return(credit);
    }