Ejemplo n.º 1
0
    public static DataTable GetDataTableByStaffID(int staff_id, bool only_active)
    {
        string sql = JoinedSql + " AND so.staff_id = " + staff_id + (only_active ? "  AND so.date_active <= GETDATE() " : "");

        sql += " ORDER BY p.surname, p.firstname, p.middlename, o.name ";
        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }
    public static BookingChangeHistory GetByID(int booking_change_history_id)
    {
        string    sql = JoinedSql + "  WHERE booking_change_history.booking_change_history_id = " + booking_change_history_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
Ejemplo n.º 3
0
    public static SMSCreditData GetByID(int sms_credit_id)
    {
        string    sql = "SELECT sms_credit_id,amount,datetime_added FROM SMSCredit WHERE sms_credit_id = " + sms_credit_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
Ejemplo n.º 4
0
    public static LetterFile GetLetterFile(int letter_print_history_id)
    {
        string    sql = @"SELECT doc_name, doc_contents FROM LetterPrintHistory WHERE letter_print_history_id = " + letter_print_history_id;
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : new LetterFile((string)tbl.Rows[0]["doc_name"], (tbl.Rows[0]["doc_contents"] == DBNull.Value) ? null : (byte[])tbl.Rows[0]["doc_contents"]));
    }
Ejemplo n.º 5
0
    public static LetterPrintHistory GetByID(int letter_print_history_id)
    {
        string    sql = JoinedSql + " WHERE lph.letter_print_history_id = " + letter_print_history_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : LoadAll(tbl.Rows[0]));
    }
Ejemplo n.º 6
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);
        }
    }
    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.º 8
0
    public static OrganisationType GetByID(int organisation_type_id)
    {
        string    sql = "SELECT organisation_type_id,descr,organisation_type_group_id FROM OrganisationType WHERE organisation_type_id = " + organisation_type_id.ToString() + " ORDER BY display_order";
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
    public static DataTable GetDataTable_ReferrersOf(int organistion_id, bool showDeletedRefs = false, bool showDeletedRegRefs = false, string matchSurname = "", bool searchSurnameOnlyStartsWith = false)
    {
        matchSurname = matchSurname.Replace("'", "''");

        string sql = @"SELECT 
                         rr.register_referrer_id, rr.organisation_id, rr.referrer_id, rr.provider_number, rr.report_every_visit_to_referrer,rr.batch_send_all_patients_treatment_notes,rr.date_last_batch_send_all_patients_treatment_notes,rr.register_referrer_date_added, 
                         r.person_id, r.referrer_date_added, r.is_deleted as referrer_is_deleted,
                         " + PersonDB.GetFields("", "p").Replace("p.entity_id", "p.entity_id AS person_entity_id") + @", 
                         t.title_id, t.descr,
                         r.is_deleted as referrer_is_deleted, rr.is_deleted as register_referrer_is_deleted
                       FROM
                         RegisterReferrer AS rr 
                         LEFT OUTER JOIN Referrer AS r ON rr.referrer_id = r.referrer_id 
                         LEFT OUTER JOIN Person   AS p ON r.person_id = p.person_id
                         LEFT OUTER JOIN Title       t   ON t.title_id        = p.title_id
                       WHERE 
                       " + (showDeletedRegRefs ? "" : "rr.is_deleted = 0 AND ") +
                     (showDeletedRefs    ? "" : "r.is_deleted  = 0 AND ") +
                     "rr.organisation_id = " + organistion_id.ToString() +
                     ((matchSurname.Length > 0 && !searchSurnameOnlyStartsWith) ? " AND p.surname LIKE '%" + matchSurname + "%'" : "") +
                     ((matchSurname.Length > 0 && searchSurnameOnlyStartsWith)  ? " AND p.surname LIKE '" + matchSurname + "%'" : "") + @"
                       ORDER BY 
                         p.surname, p.firstname, p.middlename";

        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }
Ejemplo n.º 10
0
    public static Hashtable GetMostRecentRecallHashByPatients(int[] patient_ids)
    {
        if (patient_ids == null || patient_ids.Length == 0)
        {
            return(new Hashtable());
        }

        string sql = JoinedSql + @" 

                        --SELECT * from LetterPrintHistory lph
                        WHERE lph.patient_id in (" + string.Join(",", patient_ids) + @")
                          and lph.letter_print_history_id = (
	                        SELECT TOP 1 letter_print_history_id 
	                        FROM   LetterPrintHistory lph2 
		                           INNER JOIN Letter l ON lph2.letter_id = l.letter_id
	                        WHERE  lph2.patient_id = lph.patient_id
	                           AND l.letter_type_id = 390
	                        ORDER BY lph2.date DESC
                          )";

        Hashtable hash = new Hashtable();

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

        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            LetterPrintHistory lph = LoadAll(tbl.Rows[i]);
            hash[lph.Patient.PatientID] = lph;
        }

        return(hash);
    }
Ejemplo n.º 11
0
    public static DataTable GetDataTable_OrganisationsOf(int referrer_id, bool showDeletedOrgs = false, bool showDeletedRegRefs = false, string matchName = "", bool searchNameOnlyStartsWith = false)
    {
        matchName = matchName.Replace("'", "''");

        string sql = @"SELECT 
                         r.register_referrer_id, r.organisation_id, r.referrer_id, r.provider_number, r.report_every_visit_to_referrer, r.batch_send_all_patients_treatment_notes, r.date_last_batch_send_all_patients_treatment_notes, r.register_referrer_date_added, 
                         o.organisation_id, o.entity_id as organisation_entity_id, o.parent_organisation_id, o.use_parent_offernig_prices, o.organisation_type_id, o.organisation_customer_type_id, o.name, o.acn, o.abn, o.organisation_date_added, o.organisation_date_modified, o.is_debtor, o.is_creditor, o.bpay_account, 
                         o.weeks_per_service_cycle, o.start_date, o.end_date, o.comment, o.free_services, o.excl_sun, o.excl_mon, o.excl_tue, o.excl_wed, o.excl_thu, o.excl_fri, o.excl_sat, 
                         o.sun_start_time, o.sun_end_time, o.mon_start_time, o.mon_end_time, o.tue_start_time, o.tue_end_time, o.wed_start_time, o.wed_end_time, o.thu_start_time, o.thu_end_time, o.fri_start_time, o.fri_end_time, o.sat_start_time, o.sat_end_time, 
                         o.sun_lunch_start_time, o.sun_lunch_end_time, o.mon_lunch_start_time, o.mon_lunch_end_time, o.tue_lunch_start_time, o.tue_lunch_end_time, o.wed_lunch_start_time, o.wed_lunch_end_time, o.thu_lunch_start_time, o.thu_lunch_end_time, o.fri_lunch_start_time, o.fri_lunch_end_time, o.sat_lunch_start_time, o.sat_lunch_end_time, 
                         o.last_batch_run, 
                         o.is_deleted as organisation_is_deleted, r.is_deleted as register_referrer_is_deleted
                       FROM 
                         RegisterReferrer AS r 
                         LEFT OUTER JOIN Organisation AS o ON r.organisation_id = o.organisation_id 
                       WHERE 
                         r.organisation_id IS NOT null AND " +
                     (showDeletedRegRefs ? "" : "r.is_deleted = 0 AND ") +
                     (showDeletedOrgs    ? "" : "o.is_deleted = 0 AND ") +
                     "r.referrer_id = " + referrer_id.ToString() +
                     ((matchName.Length > 0 && !searchNameOnlyStartsWith) ? " AND o.name LIKE '%" + matchName + "%'" : "") +
                     ((matchName.Length > 0 && searchNameOnlyStartsWith)  ? " AND o.name LIKE '" + matchName + "%'" : "") + @"
                       ORDER BY o.name";

        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }
Ejemplo n.º 12
0
    public static Note GetByID(int note_id)
    {
        string    sql = JoniedSql + " WHERE note_id = " + note_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : LoadAll(tbl.Rows[0]));
    }
Ejemplo n.º 13
0
    public static Referral GetByID(int referral_id)
    {
        string    sql = JoinedSql + "WHERE referral_id = " + referral_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
Ejemplo n.º 14
0
    public static Hashtable GetNoteHash(int[] entity_ids, bool incDeleted = false)
    {
        string entity_ids_text = (entity_ids.Length == 0) ? "0" : string.Join(",", entity_ids);

        string    sql = JoniedSql + " WHERE n.entity_id in (" + entity_ids_text + ")" + (incDeleted ? "" : " AND deleted_by IS NULL AND date_deleted IS NULL");
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        Hashtable hash = new Hashtable();

        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            Note note = LoadAll(tbl.Rows[i]);
            note.BodyPart.Descr = Convert.ToString(tbl.Rows[i]["body_part_descr"]);

            if (hash[note.EntityID] == null)
            {
                hash[note.EntityID] = new ArrayList();
            }
            ((ArrayList)hash[note.EntityID]).Add(note);
        }

        ArrayList keys = new ArrayList();

        foreach (int key in hash.Keys)
        {
            keys.Add(key);
        }
        for (int i = 0; i < keys.Count; i++)
        {
            ArrayList item = (ArrayList)hash[(int)keys[i]];
            hash[(int)keys[i]] = (Note[])item.ToArray(typeof(Note));
        }

        return(hash);
    }
    public static DataTable GetDataTable_SitesNotRestricted(int staff_id = -1, int site_id = -1, bool only_clinic = false)
    {
        string whereClause = string.Empty;

        if (staff_id != -1)
        {
            whereClause += (whereClause.Length == 0 ? " WHERE " : " AND ") + "site_id NOT IN (SELECT site_id FROM StaffSiteRestriction WHERE (staff_id = " + staff_id + "))";
        }
        if (site_id != -1)
        {
            whereClause += (whereClause.Length == 0 ? " WHERE " : " AND ") + "site_id NOT IN (SELECT site_id FROM StaffSiteRestriction WHERE (site_id = " + site_id + "))";
        }
        if (only_clinic)
        {
            whereClause += (whereClause.Length == 0 ? " WHERE " : " AND ") + "Site.site_type_id = 1";
        }

        string sql = @"
            SELECT
                    site_id,entity_id,name,Site.site_type_id,abn,acn,tfn,asic,is_provider,bank_bpay,bank_bsb,bank_account,bank_direct_debit_userid,bank_username,oustanding_balance_warning,print_epc,excl_sun,excl_mon,excl_tue,excl_wed,excl_thu,excl_fri,excl_sat,day_start_time,lunch_start_time,lunch_end_time,day_end_time,fiscal_yr_end,num_booking_months_to_get,
                    SiteType.descr as site_type_descr
            FROM 
                    Site 
                    LEFT JOIN SiteType ON Site.site_type_id = SiteType.site_type_id " + whereClause;

        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }
    public static StaffSiteRestriction GetByID(int staff_site_restriction_id)
    {
        string    sql = JoinedSql + " WHERE staff_site_restriction_id = " + staff_site_restriction_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
Ejemplo n.º 17
0
    public static DataTable GetDataTable_StaffOf(int organistion_id, bool inc_deleted = false, bool only_providers = false, bool excl_external = true)
    {
        string sql = @"SELECT 
                         r.register_staff_id,r.register_staff_date_added,r.organisation_id,r.provider_number AS registration_provider_number,r.main_provider_for_clinic,
                         r.excl_sun, r.excl_mon, r.excl_tue, r.excl_wed, r.excl_thu, r.excl_fri, r.excl_sat, r.is_deleted as registration_is_deleted,
                         s.staff_id, s.person_id, s.login, s.pwd, s.staff_position_id, s.field_id, s.costcentre_id, s.is_contractor, s.tfn, s.provider_number, 
                         s.is_fired, s.is_commission, s.commission_percent, 
                         s.is_stakeholder, s.is_master_admin, s.is_admin, s.is_principal, s.is_provider, s.is_external,
                         s.staff_date_added,  s.start_date, s.end_date, s.comment, 
                         s.num_days_to_display_on_booking_screen,
                         s.show_header_on_booking_screen,
                         s.bk_screen_field_id,
                         s.bk_screen_show_key,
                         s.enable_daily_reminder_sms, 
                         s.enable_daily_reminder_email,

                         sr.field_id as field_field_id,sr.descr as field_descr,

                         " + PersonDB.GetFields("", "p").Replace("p.entity_id", "p.entity_id AS person_entity_id") + @", 
                         t.title_id, t.descr
                       FROM
                         RegisterStaff AS r 
                         LEFT OUTER JOIN Staff  s  ON r.staff_id  = s.staff_id 
                         LEFT OUTER JOIN Person p  ON s.person_id = p.person_id
                         LEFT OUTER JOIN Title  t  ON t.title_id  = p.title_id
                         LEFT OUTER  JOIN Field sr ON s.field_id  = sr.field_id
                       WHERE
                         s.staff_id > 0 AND s.is_fired = 0 " + (inc_deleted ? "" : " AND r.is_deleted = 0 ") + (!only_providers ? "" : " AND s.is_provider = 1 ") + (!excl_external ? "" : " AND s.is_external = 0 ") + " AND r.organisation_id = " + organistion_id.ToString() + @" 
                       ORDER BY 
                         p.surname, p.firstname, p.middlename";

        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }
Ejemplo n.º 18
0
    public static DataTable GetDataTable_AllNotInc(RegisterReferrer[] excList)
    {
        string notInList = string.Empty;

        foreach (RegisterReferrer p in excList)
        {
            notInList += p.RegisterReferrerID.ToString() + ",";
        }
        if (notInList.Length > 0)
        {
            notInList = notInList.Substring(0, notInList.Length - 1);
        }

        string sql = JoinedSql();

        if (notInList.Length > 0)
        {
            sql += @" AND register_referrer_id NOT IN (" + notInList + @") ";
        }

        sql += @" ORDER BY 
                         p.surname, p.firstname, p.middlename, o.name";

        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }
Ejemplo n.º 19
0
    public static DataTable GetDataTable_WorkingStaffOf(int organistion_id, DateTime date)
    {
        string sql = @"SELECT Distinct
                         --r.register_staff_id,r.register_staff_date_added,r.organisation_id,r.provider_number AS registration_provider_number,
                         --r.excl_sun, r.excl_mon, r.excl_tue, r.excl_wed, r.excl_thu, r.excl_fri, r.excl_sat, r.main_provider_for_clinic,
                         s.staff_id, s.person_id, s.login, s.pwd, s.staff_position_id, s.field_id, s.costcentre_id, s.is_contractor, s.tfn, s.provider_number, 
                         s.is_fired, s.is_commission, s.commission_percent, s.is_stakeholder, s.is_master_admin, s.is_admin, s.is_principal, s.is_provider, s.is_external,
                         s.staff_date_added, s.start_date, s.end_date, s.comment, 
                         s.num_days_to_display_on_booking_screen, 
                         s.show_header_on_booking_screen,
                         s.bk_screen_field_id,
                         s.bk_screen_show_key,
                         s.enable_daily_reminder_sms, 
                         s.enable_daily_reminder_email,
                         s.hide_booking_notes,

                         " + PersonDB.GetFields("", "p").Replace("p.entity_id", "p.entity_id AS person_entity_id") + @", 
                         t.title_id, t.descr
                       FROM
                         RegisterStaff AS r 
                         LEFT OUTER JOIN Staff  s  ON r.staff_id  = s.staff_id 
                         LEFT OUTER JOIN Person p  ON s.person_id = p.person_id
                         LEFT OUTER JOIN Title  t  ON t.title_id  = p.title_id
                       WHERE
                         s.staff_id > 0 AND s.is_fired = 0 AND r.is_deleted = 0 AND r.organisation_id = " + organistion_id + @" 

                         -- get unavail bookings for whole day .... and make sure there are none
                         AND (SELECT COUNT(*) FROM Booking 
                               WHERE
                                     (
                                      (booking_type_id = 341 AND (organisation_id IS NULL OR organisation_id = r.organisation_id)  AND ( (is_recurring = 0 AND CONVERT(TIME,Booking.date_start) = '00:00' AND CONVERT(TIME,Booking.date_end) >= '23:59') OR (is_recurring = 1 AND recurring_start_time = '00:00' AND recurring_end_time >= '23:59')   )) OR
                                      (booking_type_id = 342 AND (organisation_id = r.organisation_id)                             AND ( (is_recurring = 0 AND CONVERT(TIME,Booking.date_start) = '00:00' AND CONVERT(TIME,Booking.date_end) >= '23:59') OR (is_recurring = 1 AND recurring_start_time = '00:00' AND recurring_end_time >= '23:59')   ))
                                     ) 

                                     AND

                                     (date_deleted IS  NULL) 

                                     AND

                                     (
                                      (is_recurring = 0 AND (SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, Booking.date_start)))  = '" + date.ToString("yyyy-MM-dd") + " 00:00:00" + @"') OR

                                      (is_recurring = 1 AND (SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, Booking.date_start))) <= '" + date.ToString("yyyy-MM-dd") + " 00:00:00" + @"'    
                                                        AND (SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, Booking.date_end)))   >= '" + date.ToString("yyyy-MM-dd") + " 00:00:00" + @"'
                                                        AND (Booking.recurring_weekday_id = " + WeekDayDB.GetWeekDayID(date.DayOfWeek) + @"))
                                     )

                                     AND

                                     (provider = r.staff_id) ) = 0

                         AND (SELECT COUNT(*) FROM Staff WHERE (staff_id = r.staff_id) AND (excl_" + date.DayOfWeek.ToString().Substring(0, 3).ToLower() + @" = 0)) > 0

                       ORDER BY 
                         p.surname, p.firstname, p.middlename";

        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }
Ejemplo n.º 20
0
    public static DataTable GetDataTable_ByPatientID(int patient_id, bool only_active = true, int organisation_id = 0)
    {
        string    sql = JoinedSql + (only_active ? @" AND hc.is_active = 1 " : "") + @" AND patient_id = " + patient_id.ToString() + (organisation_id == 0 ? "" : " AND hc.organisation_id = " + organisation_id) + " ORDER BY health_card_id DESC";
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        RemoveAllButLastCards(ref tbl);
        return(tbl);
    }
Ejemplo n.º 21
0
    public static SystemVariable GetByDescr(string descr)
    {
        descr = descr.Replace("'", "''");
        string    sql = "SELECT descr,value,editable_in_gui,viewable_in_gui FROM SystemVariable WHERE descr = '" + descr.ToString() + "'";
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
    public static TyroPaymentPending GetByByTyroTransactionID(string DB, string tyro_transaction_id)
    {
        tyro_transaction_id = tyro_transaction_id.Replace("'", "''");
        string    sql = JoinedSql + " WHERE tyro_transaction_id = '" + tyro_transaction_id.ToString() + "'";
        DataTable tbl = DBBase.ExecuteQuery(sql, DB).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
    public static BookingPatientOffering GetByID(int booking_patient_offering_id)
    {
        //string sql = "SELECT booking_patient_offering_id,booking_patient_id,offering_id,quantity,added_by,added_date,is_deleted,deleted_by,deleted_date FROM BookingPatientOffering WHERE booking_patient_offering_id = " + booking_patient_offering_id.ToString();
        string    sql = JoinedSql() + " WHERE booking_patient_offering_id = " + booking_patient_offering_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : LoadAll(tbl.Rows[0]));
    }
Ejemplo n.º 24
0
    public static StaffPosition GetByDescr(string descr)
    {
        descr = descr.Replace("'", "''");
        string    sql = "SELECT staff_position_id,descr FROM StaffPosition WHERE descr = '" + descr.ToString() + "'";
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
Ejemplo n.º 25
0
    public static DataTable GetDataTable_OfferingsByOrg(int organisation_id)
    {
        string sql = JoinedSql_Offerings + "  AND Stock.organisation_id = " + organisation_id;

        sql += " ORDER BY o.name";

        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }
Ejemplo n.º 26
0
    public static SetupNewCustomer GetByRandomString(string random_string)
    {
        random_string = random_string.Replace("'", "''");
        string    sql = "SELECT setup_new_customer_id,company_name,firstname,surname,company_email,address_line1,address_line2,city,state_province_region,postcode,country,phone_nbr,max_nbr_providers,field1,field2,field3,field4,setasprov_field1,setasprov_field2,setasprov_field3,setasprov_field4,random_string,date_added_info,date_added_db,db_name FROM SetupNewCustomer WHERE random_string = '" + random_string + "'";
        DataTable tbl = DBBase.ExecuteQuery(sql, "Mediclinic_Main").Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
Ejemplo n.º 27
0
    public static DataTable GetDataTable_ByOrg(int organisation_id, int site_id = -1)
    {
        string sql = JoinedSql() + (organisation_id == 0 ? " AND letter.organisation_id IS NULL" : " AND letter.organisation_id = " + organisation_id) +
                     (site_id == -1 ? "" : " AND letter.site_id = " + site_id);

        sql += " ORDER BY lettertype.descr, letter.code, letter.docname";
        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }
Ejemplo n.º 28
0
    public static TyroHealthClaim GetByByTyroTransactionID(string tyro_transaction_id)
    {
        tyro_transaction_id = tyro_transaction_id.Replace("'", "''");
        string    sql = JoinedSql + " WHERE tyro_transaction_id = '" + tyro_transaction_id + "'";
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
Ejemplo n.º 29
0
    public static TyroHealthClaim GetByRefTag(string refTag)
    {
        refTag = refTag.Replace("'", "''");
        string    sql = JoinedSql + " WHERE out_healthpointRefTag = '" + refTag + "'";
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        return((tbl.Rows.Count == 0) ? null : Load(tbl.Rows[0]));
    }
Ejemplo n.º 30
0
    private static DataTable _GetDataTable_EPCReferrersOf(int patient_id, bool onlyActive)
    {
        string sql = JoinedSQL() + @" 
                        AND pat.patient_id = " + patient_id.ToString() + (onlyActive ? " AND pr.is_active = 1 " : "") + @"
                        ORDER BY pr.patient_referrer_date_added";

        return(DBBase.ExecuteQuery(sql).Tables[0]);
    }