public Offering(int offering_id, int offering_type_id, int field_id, int aged_care_patient_type_id, int num_clinic_visits_allowed_per_year, int offering_invoice_type_id, string name, string short_name, string descr, bool is_gst_exempt, decimal default_price, int service_time_minutes, int max_nbr_claimable, int max_nbr_claimable_months, string medicare_company_code, string dva_company_code, string tac_company_code, decimal medicare_charge, decimal dva_charge, decimal tac_charge, string popup_message, int reminder_letter_months_later_to_send, int reminder_letter_id, bool use_custom_color, string custom_color) { this.offering_id = offering_id; this.offering_type = new IDandDescr(offering_type_id); this.field = new IDandDescr(field_id); this.aged_care_patient_type = new IDandDescr(aged_care_patient_type_id); this.num_clinic_visits_allowed_per_year = num_clinic_visits_allowed_per_year; this.offering_invoice_type = new IDandDescr(offering_invoice_type_id); this.name = name; this.short_name = short_name; this.descr = descr; this.is_gst_exempt = is_gst_exempt; this.default_price = default_price; this.service_time_minutes = service_time_minutes; this.max_nbr_claimable = max_nbr_claimable; this.max_nbr_claimable_months = max_nbr_claimable_months; this.medicare_company_code = medicare_company_code; this.dva_company_code = dva_company_code; this.tac_company_code = tac_company_code; this.medicare_charge = medicare_charge; this.dva_charge = dva_charge; this.tac_charge = tac_charge; this.popup_message = popup_message; this.reminder_letter_months_later_to_send = reminder_letter_months_later_to_send; this.reminder_letter_id = reminder_letter_id; this.use_custom_color = use_custom_color; this.custom_color = custom_color; }
public static IDandDescr[] Load(DataTable tbl, string id_name, string descr_name) { IDandDescr[] ret = new IDandDescr[tbl.Rows.Count]; for(int i=0; i<tbl.Rows.Count; i++) ret[i] = Load(tbl.Rows[i], id_name, descr_name); return ret; }
public HealthCardAction(int health_card_action_id, int health_card_id, int health_card_action_type_id, DateTime action_date) { this.health_card_action_id = health_card_action_id; this.healthCard = new HealthCard(health_card_id); this.health_card_action_type = new IDandDescr(health_card_action_type_id); this.action_date = action_date; }
public ContactType(int contact_type_id, int contact_type_group_id, string descr, int display_order) { this.contact_type_id = contact_type_id; this.contact_type_group = new IDandDescr(contact_type_group_id); this.descr = descr; this.display_order = display_order; }
public Invoice(int invoice_id, int entity_id, int invoice_type_id, int booking_id, int payer_organisation_id, int payer_patient_id, int non_booking_invoice_organisation_id, string healthcare_claim_number, int reject_letter_id, string message, int staff_id, int site_id, DateTime invoice_date_added, decimal total, decimal gst, decimal receipts_total, decimal vouchers_total, decimal credit_notes_total, decimal refunds_total, bool is_paid, bool is_refund, bool is_batched, int reversed_by, DateTime reversed_date, DateTime last_date_emailed) { this.invoice_id = invoice_id; this.entity_id = entity_id; this.invoice_type = new IDandDescr(invoice_type_id); this.booking = booking_id == -1 ? null : new Booking(booking_id); this.payer_organisation = payer_organisation_id == 0 ? null : new Organisation(payer_organisation_id); this.payer_patient = payer_patient_id == -1 ? null : new Patient(payer_patient_id); this.non_booking_invoice_organisation = non_booking_invoice_organisation_id == -1 ? null : new Organisation(non_booking_invoice_organisation_id); this.healthcare_claim_number = healthcare_claim_number; this.reject_letter = reject_letter_id == -1 ? null : new Letter(reject_letter_id); this.message = message; this.staff = new Staff(staff_id); this.site = site_id == -1 ? null : new Site(site_id); this.invoice_date_added = invoice_date_added; this.total = total; this.gst = gst; this.receipts_total = receipts_total; this.vouchers_total = vouchers_total; this.credit_notes_total = credit_notes_total; this.refunds_total = refunds_total; this.is_paid = is_paid; this.is_refund = is_refund; this.is_batched = is_batched; this.reversed_by = reversed_by == -1 ? null : new Staff(reversed_by); this.reversed_date = reversed_date; this.last_date_emailed = last_date_emailed; }
public AddressChannel(int address_channel_id, string descr, int address_channel_type_id, DateTime address_channel_date_added, DateTime address_channel_date_modified) { this.address_channel_id = address_channel_id; this.descr = descr; this.address_channel_type = new IDandDescr(address_channel_type_id); this.address_channel_date_added = address_channel_date_added; this.address_channel_date_modified = address_channel_date_modified; }
public HealthCardEPCRemaining(int health_card_epc_remaining_id, int health_card_id, int field_id, int num_services_remaining, int deleted_by, DateTime date_deleted) { this.health_card_epc_remaining_id = health_card_epc_remaining_id; this.health_card_id = health_card_id; this.field = new IDandDescr(field_id); this.num_services_remaining = num_services_remaining; this.deleted_by = deleted_by; this.date_deleted = date_deleted; }
public BookingChangeHistory(int booking_change_history_id, int booking_id, int moved_by, DateTime date_moved, int booking_change_history_reason_id, DateTime previous_datetime) { this.booking_change_history_id = booking_change_history_id; this.booking = new Booking(booking_id); this.moved_by = moved_by; this.date_moved = date_moved; this.booking_change_history_reason = new IDandDescr(booking_change_history_reason_id); this.previous_datetime = previous_datetime; }
public ReferralRemaining(int referral_remaining_id, int referral_id, int field_id, int num_services_remaining, int deleted_by, DateTime date_deleted) { this.referral_remaining_id = referral_remaining_id; this.referral = new Referral(referral_id); this.field = new IDandDescr(field_id); this.num_services_remaining = num_services_remaining; this.deleted_by = deleted_by; this.date_deleted = date_deleted; }
public EmailHistoryData(int email_history_id, int sms_and_email_type_id, int patient_id, int booking_id, string email, string message, DateTime datetime_sent) { this.email_history_id = email_history_id; this.sms_and_email_type = new IDandDescr(sms_and_email_type_id); this.patient = patient_id == -1 ? null : new Patient(patient_id); this.booking = booking_id == -1 ? null : new Booking(booking_id); this.email = email; this.message = message; this.datetime_sent = datetime_sent; }
public Refund(int refund_id, int invoice_id, decimal total, int refund_reason_id, string comment, DateTime refund_date_added, int staff_id) { this.refund_id = refund_id; this.invoice = new Invoice(invoice_id); this.total = total; this.refund_reason = new IDandDescr(refund_reason_id); this.comment = comment; this.refund_date_added = refund_date_added; this.staff = new Staff(staff_id); }
public LetterBest(int letter_id, int letter_type_id, string code, string docname, bool is_send_to_medico, bool is_allowed_reclaim, bool is_manual_override, int num_copies_to_print) { this.letter_id = letter_id; this.letter_type = new IDandDescr(letter_type_id); this.code = code; this.docname = docname; this.is_send_to_medico = is_send_to_medico; this.is_allowed_reclaim = is_allowed_reclaim; this.is_manual_override = is_manual_override; this.num_copies_to_print = num_copies_to_print; }
public static IDandDescr[] GetAll() { DataTable dt_MST = DBBase.GetGenericDataTable(null, "MedicalServiceType", "medical_service_type_id", "descr"); IDandDescr[] list = new IDandDescr[dt_MST.Rows.Count]; Hashtable medicalServiceTypeHash = new Hashtable(); for (int i = 0; i < dt_MST.Rows.Count; i++) list[i] = new IDandDescr(Convert.ToInt32(dt_MST.Rows[i]["medical_service_type_id"]), Convert.ToString(dt_MST.Rows[i]["descr"])); return list; }
public LetterTreatmentTemplate(int letter_treatment_template_id, int field_id, int first_letter_id, int last_letter_id, int last_letter_pt_id, int last_letter_when_replacing_epc_id, int treatment_notes_letter_id, int site_id) { this.letter_treatment_template_id = letter_treatment_template_id; this.field = new IDandDescr(field_id); this.first_letter = new Letter(first_letter_id); this.last_letter = new Letter(last_letter_id); this.last_letter_pt = new Letter(last_letter_pt_id); this.last_letter_when_replacing_epc = new Letter(last_letter_when_replacing_epc_id); this.treatment_notes_letter = new Letter(treatment_notes_letter_id); this.site = new Site(site_id); }
public SMSHistoryData(int sms_history_id, int sms_and_email_type_id, int patient_id, int booking_id, string phone_number, string message, decimal cost, DateTime datetime_sent, string smstech_message_id, string smstech_status, DateTime smstech_datetime) { this.sms_history_id = sms_history_id; this.sms_and_email_type = new IDandDescr(sms_and_email_type_id); this.patient = patient_id == -1 ? null : new Patient(patient_id); this.booking = booking_id == -1 ? null : new Booking(booking_id); this.phone_number = phone_number; this.cost = cost; this.message = message; this.datetime_sent = datetime_sent; this.smstech_message_id = smstech_message_id; this.smstech_status = smstech_status; this.smstech_datetime = smstech_datetime; }
public Booking(int booking_id, int entity_id, DateTime date_start, DateTime date_end, int organisation_id, int provider, int patient_id, int offering_id, int booking_type_id, int booking_status_id, int booking_unavailability_reason_id, int added_by, DateTime date_created, int booking_confirmed_by_type_id, int confirmed_by, DateTime date_confirmed, int deleted_by, DateTime date_deleted, int cancelled_by, DateTime date_cancelled, bool is_patient_missed_appt, bool is_provider_missed_appt, bool is_emergency, bool need_to_generate_first_letter, bool need_to_generate_last_letter, bool has_generated_system_letters, DateTime arrival_time, string sterilisation_code, int informed_consent_added_by, DateTime informed_consent_date, bool is_recurring, DayOfWeek recurring_day_of_week, TimeSpan recurring_start_time, TimeSpan recurring_end_time, int note_count, int inv_count) { this.booking_id = booking_id; this.entity_id = entity_id; this.date_start = date_start; this.date_end = date_end; this.organisation = organisation_id == 0 ? null : new Organisation(organisation_id); this.provider = provider == -1 ? null : new Staff(provider); this.patient = patient_id == -1 ? null : new Patient(patient_id); this.offering = offering_id == -1 ? null : new Offering(offering_id); this.booking_type_id = booking_type_id; this.booking_status = booking_status_id == -2 ? null : new IDandDescr(booking_status_id); this.booking_unavailability_reason = booking_unavailability_reason_id == -1 ? null : new IDandDescr(booking_unavailability_reason_id); this.added_by = added_by == -1 ? null :new Staff(added_by); this.date_created = date_created; this.booking_confirmed_by_type = booking_confirmed_by_type_id == -1 ? null : new IDandDescr(booking_confirmed_by_type_id); this.confirmed_by = confirmed_by == -1 ? null : new Staff(confirmed_by); this.date_confirmed = date_confirmed; this.deleted_by = deleted_by == -1 ? null : new Staff(deleted_by); this.date_deleted = date_deleted; this.cancelled_by = cancelled_by == -1 ? null : new Staff(cancelled_by); this.date_cancelled = date_cancelled; this.is_patient_missed_appt = is_patient_missed_appt; this.is_provider_missed_appt = is_provider_missed_appt; this.is_emergency = is_emergency; this.need_to_generate_first_letter = need_to_generate_first_letter; this.need_to_generate_last_letter = need_to_generate_last_letter; this.has_generated_system_letters = has_generated_system_letters; this.arrival_time = arrival_time; this.sterilisation_code = sterilisation_code; this.informed_consent_added_by = informed_consent_added_by == -1 ? null : new Staff(informed_consent_added_by); this.informed_consent_date = informed_consent_date; this.is_recurring = is_recurring; this.recurring_day_of_week = recurring_day_of_week; this.recurring_start_time = recurring_start_time; this.recurring_end_time = recurring_end_time; this.note_count = note_count; this.inv_count = inv_count; }
public Letter(int letter_id, int organisation_id, int letter_type_id, int site_id, string code, string reject_message, string docname, bool is_send_to_medico, bool is_allowed_reclaim, bool is_manual_override, int num_copies_to_print, bool is_deleted) { this.letter_id = letter_id; this.organisation = organisation_id == 0 ? null : new Organisation(organisation_id); this.letter_type = new IDandDescr(letter_type_id); this.site = new Site(site_id); this.code = code; this.reject_message = reject_message; this.docname = docname; this.is_send_to_medico = is_send_to_medico; this.is_allowed_reclaim = is_allowed_reclaim; this.is_manual_override = is_manual_override; this.num_copies_to_print = num_copies_to_print; this.is_deleted = is_deleted; }
public Referral(int referral_id, int health_card_id, int medical_service_type_id, int register_referrer_id, DateTime date_referral_signed, DateTime date_referral_received_in_office, int added_or_last_modified_by, DateTime added_or_last_modified_date, int deleted_by, DateTime date_deleted) { this.referral_id = referral_id; this.health_card = new HealthCard(health_card_id); this.medical_service_type = new IDandDescr(medical_service_type_id); this.registerReferrer = register_referrer_id == -1 ? null : new RegisterReferrer(register_referrer_id); this.date_referral_signed = date_referral_signed; this.date_referral_received_in_office = date_referral_received_in_office; this.added_or_last_modified_by = new Staff(added_or_last_modified_by); this.added_or_last_modified_date = added_or_last_modified_date; this.deleted_by = deleted_by == -1 ? null : new Staff(deleted_by); this.date_deleted = date_deleted; }
public Person(int person_id, int entity_id, int added_by, int title_id, string firstname, string middlename, string surname, string nickname, string gender, DateTime dob, DateTime person_date_added, DateTime person_date_modified) { this.person_id = person_id; this.entity_id = entity_id; this.added_by = added_by; this.title = new IDandDescr(title_id); this.firstname = firstname; this.middlename = middlename; this.surname = surname; this.nickname = nickname; this.gender = gender; this.dob = dob; this.person_date_added = person_date_added; this.person_date_modified = person_date_modified; }
public LetterPrintHistory(int letter_print_history_id, int letter_id, int letter_print_history_send_method_id, int booking_id, int patient_id, int organisation_id, int register_referrer_id, int staff_id, int health_card_action_id, DateTime date, string doc_name, bool has_doc) { this.letter_print_history_id = letter_print_history_id; this.letter = letter_id == -1 ? null : new Letter(letter_id); this.send_method = new IDandDescr(letter_print_history_send_method_id); this.booking = new Booking(booking_id); this.patient = patient_id == -1 ? null : new Patient(patient_id); this.organisation = organisation_id == 0 ? null : new Organisation(organisation_id); this.register_referrer = register_referrer_id == -1 ? null : new RegisterReferrer(register_referrer_id); this.staff = staff_id == -1 ? null : new Staff(staff_id); this.health_card_action = new HealthCardAction(health_card_action_id); this.date = date; this.doc_name = doc_name; this.has_doc = has_doc; }
public Note(int note_id, int entity_id, int note_type_id, int body_part_id, string text, DateTime date_added, DateTime date_modified, DateTime date_deleted, int added_by, int modified_by, int deleted_by, int site_id) { this.note_id = note_id; this.entity_id = entity_id; this.note_type = new IDandDescr(note_type_id); this.body_part = new IDandDescr(body_part_id); this.text = text; this.date_added = date_added; this.date_modified = date_modified; this.date_deleted = date_deleted; this.added_by = added_by == -1 ? null : new Staff(added_by); this.modified_by = modified_by == -1 ? null : new Staff(modified_by); this.deleted_by = deleted_by == -1 ? null : new Staff(deleted_by); this.site = new Site(site_id); }
public Receipt(int receipt_id, int receipt_payment_type_id, int invoice_id, decimal total, decimal amount_reconciled, bool is_failed_to_clear, bool is_overpaid, DateTime receipt_date_added, DateTime reconciliation_date, int staff_id, int reversed_by, DateTime reversed_date, decimal pre_reversed_amount) { this.receipt_id = receipt_id; this.receipt_payment_type = new IDandDescr(receipt_payment_type_id); this.invoice = new Invoice(invoice_id); this.total = total; this.amount_reconciled = amount_reconciled; this.is_failed_to_clear = is_failed_to_clear; this.is_overpaid = is_overpaid; this.receipt_date_added = receipt_date_added; this.reconciliation_date = reconciliation_date; this.staff = new Staff(staff_id); this.reversed_by = reversed_by == -1 ? null : new Staff(reversed_by); this.reversed_date = reversed_date; this.pre_reversed_amount = pre_reversed_amount; }
public PatientHistory(int patient_history_id, int patient_id, bool is_clinic_patient, bool is_gp_patient, bool is_deleted, bool is_deceased, string flashing_text, int flashing_text_added_by, DateTime flashing_text_last_modified_date, string private_health_fund, string concession_card_number, DateTime concession_card_expiry_date, bool is_diabetic, bool is_member_diabetes_australia, DateTime diabetic_assessment_review_date, int ac_inv_offering_id, int ac_pat_offering_id, string login, string pwd, bool is_company, string abn, string next_of_kin_name, string next_of_kin_relation, string next_of_kin_contact_info, int title_id, string firstname, string middlename, string surname, string nickname, string gender, DateTime dob, int modified_from_this_by, DateTime date_added) { this.patient_history_id = patient_history_id; this.patient = new Patient(patient_id); this.is_clinic_patient = is_clinic_patient; this.is_gp_patient = is_gp_patient; this.is_deleted = is_deleted; this.is_deceased = is_deceased; this.flashing_text = flashing_text; this.flashing_text_added_by = new Staff(flashing_text_added_by); this.flashing_text_last_modified_date = flashing_text_last_modified_date; this.private_health_fund = private_health_fund; this.concession_card_number = concession_card_number; this.concession_card_expiry_date = concession_card_expiry_date; this.is_diabetic = is_diabetic; this.is_member_diabetes_australia = is_member_diabetes_australia; this.diabetic_assessment_review_date = diabetic_assessment_review_date; this.ac_inv_offering = ac_inv_offering_id == -1 ? null : new Offering(ac_inv_offering_id); this.ac_pat_offering = ac_pat_offering_id == -1 ? null : new Offering(ac_pat_offering_id); this.login = login; this.pwd = pwd; this.is_company = is_company; this.abn = abn; this.next_of_kin_name = next_of_kin_name; this.next_of_kin_relation = next_of_kin_relation; this.next_of_kin_contact_info = next_of_kin_contact_info; this.title = new IDandDescr(title_id); this.firstname = firstname; this.middlename = middlename; this.surname = surname; this.nickname = nickname; this.gender = gender; this.dob = dob; this.modified_from_this_by = new Staff(modified_from_this_by); this.date_added = date_added; }
public Contact(int contact_id, int entity_id, int contact_type_id, string free_text, string addr_line1, string addr_line2, int address_channel_id, int suburb_id, int country_id, int site_id, bool is_billing, bool is_non_billing, DateTime contact_date_added, DateTime contact_date_modified) { this.contact_id = contact_id; this.entity_id = entity_id; this.contact_type = new ContactType(contact_type_id); this.free_text = free_text; this.addr_line1 = addr_line1; this.addr_line2 = addr_line2; this.address_channel = address_channel_id == -1 ? null : new AddressChannel(address_channel_id); this.suburb = suburb_id == -1 ? null : new Suburb(suburb_id); this.country = country_id == -1 ? null : new IDandDescr(country_id); this.site = site_id == -1 ? null : new Site(site_id); this.is_billing = is_billing; this.is_non_billing = is_non_billing; this.contact_date_added = contact_date_added; this.contact_date_modified = contact_date_modified; }
public Credit(int credit_id, int credit_type_id, int entity_id, decimal amount, decimal amount_used, string voucher_descr, DateTime expiry_date, int voucher_credit_id, int invoice_id, int tyro_payment_pending_id, int added_by, DateTime date_added, int deleted_by, DateTime date_deleted, decimal pre_deleted_amount, int modified_by, DateTime date_modified) { this.credit_id = credit_id; this.credit_type = new IDandDescr(credit_type_id); this.entity_id = entity_id; this.amount = amount; this.amount_used = amount_used; this.voucher_descr = voucher_descr; this.expiry_date = expiry_date; this.voucher_credit = voucher_credit_id == -1 ? null : new Credit(voucher_credit_id); this.invoice_id = invoice_id; this.tyro_payment_pending_id = tyro_payment_pending_id; this.added_by = new Staff(added_by); this.date_added = date_added; this.deleted_by = deleted_by == -1 ? null : new Staff(deleted_by); this.date_deleted = date_deleted; this.pre_deleted_amount = pre_deleted_amount; this.date_modified = date_modified; this.modified_by = modified_by == -1 ? null : new Staff(modified_by); }
public Staff(int staff_id, int person_id, string login, string pwd, int staff_position_id, int field_id, int costcentre_id, bool is_contractor, string tfn, string provider_number, bool is_fired, bool is_commission, decimal commission_percent, bool is_stakeholder, bool is_master_admin, bool is_admin, bool is_principal, bool is_provider, bool is_external, DateTime staff_date_added, DateTime start_date, DateTime end_date, string comment, int num_days_to_display_on_booking_screen, bool show_header_on_booking_screen, int bk_screen_field_id, bool bk_screen_show_key, bool enable_daily_reminder_sms, bool enable_daily_reminder_email, bool hide_booking_notes) { this.staff_id = staff_id; this.person = new Person(person_id); this.login = login; this.pwd = pwd; this.staffPosition = new StaffPosition(staff_position_id); this.field = new IDandDescr(field_id); this.costCentre = new CostCentre(costcentre_id); this.is_contractor = is_contractor; this.tfn = tfn; this.provider_number = provider_number; this.is_fired = is_fired; this.is_commission = is_commission; this.commission_percent = commission_percent; this.is_stakeholder = is_stakeholder; this.is_master_admin = is_master_admin; this.is_admin = is_admin; this.is_principal = is_principal; this.is_provider = is_provider; this.is_external = is_external; this.staff_date_added = staff_date_added; this.start_date = start_date; this.end_date = end_date; this.comment = comment; this.num_days_to_display_on_booking_screen = num_days_to_display_on_booking_screen; this.show_header_on_booking_screen = show_header_on_booking_screen; this.bk_screen_field = bk_screen_field_id == -1 ? null : new IDandDescr(bk_screen_field_id); this.bk_screen_show_key = bk_screen_show_key; this.enable_daily_reminder_sms = enable_daily_reminder_sms; this.enable_daily_reminder_email = enable_daily_reminder_email; this.hide_booking_notes = hide_booking_notes; }
public Site(int site_id, int entity_id, string name, int site_type_id, string abn, string acn, string tfn, string asic, bool is_provider, string bank_bpay, string bank_bsb, string bank_account, string bank_direct_debit_userid, string bank_username, decimal oustanding_balance_warning, bool print_epc, bool excl_sun, bool excl_mon, bool excl_tue, bool excl_wed, bool excl_thu, bool excl_fri, bool excl_sat, TimeSpan day_start_time, TimeSpan lunch_start_time, TimeSpan lunch_end_time, TimeSpan day_end_time, DateTime fiscal_yr_end, int num_booking_months_to_get) { this.site_id = site_id; this.entity_id = entity_id; this.name = name; this.site_type = new IDandDescr(site_type_id); this.abn = abn; this.acn = acn; this.tfn = tfn; this.asic = asic; this.is_provider = is_provider; this.bank_bpay = bank_bpay; this.bank_bsb = bank_bsb; this.bank_account = bank_account; this.bank_direct_debit_userid = bank_direct_debit_userid; this.bank_username = bank_username; this.oustanding_balance_warning = oustanding_balance_warning; this.print_epc = print_epc; this.excl_sun = excl_sun; this.excl_mon = excl_mon; this.excl_tue = excl_tue; this.excl_wed = excl_wed; this.excl_thu = excl_thu; this.excl_fri = excl_fri; this.excl_sat = excl_sat; this.day_start_time = day_start_time; this.lunch_start_time = lunch_start_time; this.lunch_end_time = lunch_end_time; this.day_end_time = day_end_time; this.fiscal_yr_end = fiscal_yr_end; this.num_booking_months_to_get = num_booking_months_to_get; }
protected void btnSubmit_Click(object sender, EventArgs e) { if (!ddlEndDateValidateAllOrNoneSet.IsValid || !ddlStartDateValidateAllOrNoneSet.IsValid || !ddlDOBValidateAllOrNoneSet.IsValid) return; txtPwd.Attributes["value"] = txtPwd.Text; // pwd fields is unset on send back to server, so re-set it if (GetUrlParamType() == UrlParamType.View) { Response.Redirect(UrlParamModifier.AddEdit(Request.RawUrl, "type", "edit")); } else if (GetUrlParamType() == UrlParamType.Edit) { Staff staff = StaffDB.GetByID(Convert.ToInt32(this.lblId.Text)); if (!Convert.ToBoolean(ConfigurationManager.AppSettings["UseConfigDB"]) && staff.Login != txtLogin.Text && UserDatabaseMapperDB.UsernameExists(txtLogin.Text)) { SetErrorMessage("Login name already in use by another user"); return; } if (StaffDB.LoginExists(txtLogin.Text, staff.StaffID)) { SetErrorMessage("Login name already in use by another user"); return; } if (staff.Pwd != txtPwd.Text && txtPwd.Text.Length < 6) { SetErrorMessage(staff.Pwd.Length >= 6 ? "Password must be at least 6 characters" : "New passwords must be at least 6 characters"); return; } bool loggedInUserIsStakeholder = Session["IsStakeholder"] != null && Convert.ToBoolean(Session["IsStakeholder"]); bool loggedInUserIsMasterAdmin = Session["IsMasterAdmin"] != null && Convert.ToBoolean(Session["IsMasterAdmin"]); bool setIsStakeholder = loggedInUserIsStakeholder ? chkIsStakeholder.Checked : staff.IsStakeholder; bool setIsMasterAdmin = loggedInUserIsStakeholder || loggedInUserIsMasterAdmin ? chkIsMasterAdmin.Checked : staff.IsMasterAdmin; if (!staff.IsProvider && chkIsProvider.Checked && (StaffDB.GetCountOfProviders() >= Convert.ToInt32(SystemVariableDB.GetByDescr("MaxNbrProviders").Value))) { SetErrorMessage("You have reached your maximum allowable providers. Please uncheck their status as a provider to update them or hit cancel. Contact Mediclinic if you would like to upgrade your account."); return; } if (chkIsProvider.Checked) { System.Data.DataTable tbl = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Field", "has_offerings=1 AND field_id <> 0", "", "field_id", "descr"); bool roleSetAsProvider = false; IDandDescr[] fields = new IDandDescr[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { fields[i] = new IDandDescr(Convert.ToInt32(tbl.Rows[i]["field_id"]), tbl.Rows[i]["descr"].ToString()); if (Convert.ToInt32(ddlField.SelectedValue) == Convert.ToInt32(tbl.Rows[i]["field_id"])) roleSetAsProvider = true; } if (!roleSetAsProvider) { if (fields.Length == 1) { SetErrorMessage("When setting a staff member as a provider, you need to set their Role as '" + fields[0].Descr + "'."); return; } else if (fields.Length == 2) { SetErrorMessage("When setting a staff member as a provider, you need to set their Role as '" + fields[0].Descr + "' or '" + fields[1].Descr + "'."); return; } else { string providerFields = string.Empty; for (int i = 0; i < fields.Length; i++) providerFields += (providerFields.Length == 0 ? "" : ", ") + (fields.Length >= 2 && i == (fields.Length - 2) ? "or " : "") + fields[i].Descr; SetErrorMessage("When setting a staff member as a provider, you need to set their Role as one of the following: " + providerFields); return; } } } if (chkIsMasterAdmin.Checked) chkIsAdmin.Checked = true; PersonDB.Update(staff.Person.PersonID, Convert.ToInt32(ddlTitle.SelectedValue), Utilities.FormatName(txtFirstname.Text), Utilities.FormatName(txtMiddlename.Text), Utilities.FormatName(txtSurname.Text), staff.Person.Nickname, ddlGender.SelectedValue, GetDOBFromForm(), DateTime.Now); StaffDB.Update(staff.StaffID, staff.Person.PersonID, txtLogin.Text, txtPwd.Text, staff.StaffPosition.StaffPositionID, Convert.ToInt32(ddlField.SelectedValue), staff.CostCentre.CostCentreID, chkContractor.Checked, txtTFN.Text, txtProviderNumber.Text.ToUpper(), ddlStatus.SelectedValue == "Inactive", chkIsCommission.Checked, Convert.ToDecimal(txtCommissionPercent.Text), setIsStakeholder, setIsMasterAdmin, chkIsAdmin.Checked, chkIsPrincipal.Checked, chkIsProvider.Checked, staff.IsExternal, GetStartDateFromForm(), GetEndDateFromForm(), txtComments.Text, chkSMSBKs.Checked, chkEmailBKs.Checked, chkHideBKNotes.Checked); if (!Convert.ToBoolean(ConfigurationManager.AppSettings["UseConfigDB"]) && staff.Login != txtLogin.Text) { UserDatabaseMapper curDBMapper = UserDatabaseMapperDB.GetByLogin(staff.Login, Session["DB"].ToString()); if (curDBMapper == null) UserDatabaseMapperDB.Insert(txtLogin.Text, Session["DB"].ToString()); else UserDatabaseMapperDB.Update(curDBMapper.ID, txtLogin.Text, Session["DB"].ToString()); } Response.Redirect(UrlParamModifier.AddEdit(Request.RawUrl, "type", "view")); } else if (GetUrlParamType() == UrlParamType.Add) { if (chkIsProvider.Checked && (StaffDB.GetCountOfProviders() >= Convert.ToInt32(SystemVariableDB.GetByDescr("MaxNbrProviders").Value))) { SetErrorMessage("You have reached your maximum allowable providers. Please uncheck their status as a provider to add them. Contact Mediclinic if you would like to upgrade your account."); return; } if (chkIsProvider.Checked) { System.Data.DataTable tbl = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Field", "has_offerings=1 AND field_id <> 0", "", "field_id", "descr"); bool roleSetAsProvider = false; IDandDescr[] fields = new IDandDescr[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { fields[i] = new IDandDescr(Convert.ToInt32(tbl.Rows[i]["field_id"]), tbl.Rows[i]["descr"].ToString()); if (Convert.ToInt32(ddlField.SelectedValue) == Convert.ToInt32(tbl.Rows[i]["field_id"])) roleSetAsProvider = true; } if (!roleSetAsProvider) { if (fields.Length == 1) { SetErrorMessage("When setting a staff member as a provider, you need to set their Role as '" + fields[0].Descr + "'."); return; } else if (fields.Length == 2) { SetErrorMessage("When setting a staff member as a provider, you need to set their Role as '" + fields[0].Descr + "' or '" + fields[1].Descr + "'."); return; } else { string providerFields = string.Empty; for (int i = 0; i < fields.Length; i++) providerFields += (providerFields.Length == 0 ? "" : ", ") + (fields.Length >= 2 && i == (fields.Length - 2) ? "or " : "") + fields[i].Descr; SetErrorMessage("When setting a staff member as a provider, you need to set their Role as one of the following: " + providerFields); return; } } } if (!Convert.ToBoolean(ConfigurationManager.AppSettings["UseConfigDB"]) && UserDatabaseMapperDB.UsernameExists(txtLogin.Text)) { lblErrorMessage.Text = "Login name already in use by another user"; lblErrorMessage.Visible = true; return; } if (StaffDB.LoginExists(txtLogin.Text)) { lblErrorMessage.Text = "Login name already in use by another user"; lblErrorMessage.Visible = true; return; } if (txtPwd.Text.Length < 6) { SetErrorMessage("Password must be at least 6 characters"); return; } int person_id = -1; int staff_id = -1; bool staff_added = false; int mainDbUserID = -1; try { if (!Convert.ToBoolean(ConfigurationManager.AppSettings["UseConfigDB"])) mainDbUserID = UserDatabaseMapperDB.Insert(txtLogin.Text, Session["DB"].ToString()); bool loggedInUserIsStakeholder = Session["IsStakeholder"] != null && Convert.ToBoolean(Session["IsStakeholder"]); bool loggedInUserIsMasterAdmin = Session["IsMasterAdmin"] != null && Convert.ToBoolean(Session["IsMasterAdmin"]); bool setIsStakeholder = loggedInUserIsStakeholder ? chkIsStakeholder.Checked : false; bool setIsMasterAdmin = loggedInUserIsStakeholder || loggedInUserIsMasterAdmin ? chkIsMasterAdmin.Checked : false; if (chkIsMasterAdmin.Checked) chkIsAdmin.Checked = true; Staff loggedInStaff = StaffDB.GetByID(Convert.ToInt32(Session["StaffID"])); person_id = PersonDB.Insert(loggedInStaff.Person.PersonID, Convert.ToInt32(ddlTitle.SelectedValue), Utilities.FormatName(txtFirstname.Text), Utilities.FormatName(txtMiddlename.Text), Utilities.FormatName(txtSurname.Text), "", ddlGender.SelectedValue, GetDOBFromForm()); staff_id = StaffDB.Insert(person_id, txtLogin.Text, txtPwd.Text, StaffPositionDB.GetByDescr("Unknown").StaffPositionID, Convert.ToInt32(ddlField.SelectedValue), 59, chkContractor.Checked, txtTFN.Text, txtProviderNumber.Text.ToUpper(), ddlStatus.SelectedValue == "Inactive", chkIsCommission.Checked, Convert.ToDecimal(txtCommissionPercent.Text), setIsStakeholder, setIsMasterAdmin, chkIsAdmin.Checked, chkIsPrincipal.Checked, chkIsProvider.Checked, false, GetStartDateFromForm(), GetEndDateFromForm(), txtComments.Text, chkSMSBKs.Checked, chkEmailBKs.Checked, chkHideBKNotes.Checked); staff_added = true; string url = Request.RawUrl; url = UrlParamModifier.AddEdit(url, "type", "view"); url = UrlParamModifier.AddEdit(url, "id", staff_id.ToString()); Response.Redirect(url); } catch (Exception) { if (staff_added) { string url = Request.RawUrl; url = UrlParamModifier.AddEdit(url, "type", "view"); url = UrlParamModifier.AddEdit(url, "id", staff_id.ToString()); Response.Redirect(url); return; } // roll back - backwards of creation order PersonDB.Delete(person_id); if (!Convert.ToBoolean(ConfigurationManager.AppSettings["UseConfigDB"])) UserDatabaseMapperDB.Delete(mainDbUserID); throw; } } else { HideTableAndSetErrorMessage(); } }
protected void GrdStaff_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lblId = (Label)GrdStaff.Rows[e.RowIndex].FindControl("lblId"); DropDownList ddlTitle = (DropDownList)GrdStaff.Rows[e.RowIndex].FindControl("ddlTitle"); TextBox txtFirstname = (TextBox)GrdStaff.Rows[e.RowIndex].FindControl("txtFirstname"); TextBox txtMiddlename = (TextBox)GrdStaff.Rows[e.RowIndex].FindControl("txtMiddlename"); TextBox txtSurname = (TextBox)GrdStaff.Rows[e.RowIndex].FindControl("txtSurname"); DropDownList ddlGender = (DropDownList)GrdStaff.Rows[e.RowIndex].FindControl("ddlGender"); DropDownList ddlDOB_Day = (DropDownList)GrdStaff.Rows[e.RowIndex].FindControl("ddlDOB_Day"); DropDownList ddlDOB_Month = (DropDownList)GrdStaff.Rows[e.RowIndex].FindControl("ddlDOB_Month"); DropDownList ddlDOB_Year = (DropDownList)GrdStaff.Rows[e.RowIndex].FindControl("ddlDOB_Year"); TextBox txtLogin = (TextBox)GrdStaff.Rows[e.RowIndex].FindControl("txtLogin"); TextBox txtPwd = (TextBox)GrdStaff.Rows[e.RowIndex].FindControl("txtPwd"); //DropDownList ddlStaffPosition = (DropDownList)GrdStaff.Rows[e.RowIndex].FindControl("ddlStaffPosition"); DropDownList ddlField = (DropDownList)GrdStaff.Rows[e.RowIndex].FindControl("ddlField"); CheckBox chkContractor = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkContractor"); TextBox txtTFN = (TextBox)GrdStaff.Rows[e.RowIndex].FindControl("txtTFN"); DropDownList ddlStatus = (DropDownList)GrdStaff.Rows[e.RowIndex].FindControl("ddlStatus"); DropDownList ddlCostCentre = (DropDownList)GrdStaff.Rows[e.RowIndex].FindControl("ddlCostCentre"); TextBox txtProviderNumber = (TextBox)GrdStaff.Rows[e.RowIndex].FindControl("txtProviderNumber"); CheckBox chkIsCommission = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkIsCommission"); TextBox txtCommissionPercent = (TextBox)GrdStaff.Rows[e.RowIndex].FindControl("txtCommissionPercent"); CheckBox chkIsStakeholder = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkIsStakeholder"); CheckBox chkIsAdmin = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkIsAdmin"); CheckBox chkIsMasterAdmin = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkIsMasterAdmin"); CheckBox chkIsPrincipal = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkIsPrincipal"); CheckBox chkIsProvider = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkIsProvider"); CheckBox chkSMSBKs = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkSMSBKs"); CheckBox chkEmailBKs = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkEmailBKs"); CheckBox chkHideBKNotes = (CheckBox)GrdStaff.Rows[e.RowIndex].FindControl("chkHideBKNotes"); int staff_id = Convert.ToInt32(lblId.Text); int person_id = GetPersonID(Convert.ToInt32(lblId.Text)); if (person_id == -1) // happens when back button hit after update .. with option to update again ... but no selected row exists within page data { GrdStaff.EditIndex = -1; FillGrid(); return; } Staff staff = StaffDB.GetByID(staff_id); if (!Convert.ToBoolean(ConfigurationManager.AppSettings["UseConfigDB"]) && staff.Login != txtLogin.Text && UserDatabaseMapperDB.UsernameExists(txtLogin.Text)) { SetErrorMessage("Login name already in use by another user"); return; } if (staff.Login != txtLogin.Text && StaffDB.LoginExists(txtLogin.Text, staff_id)) { SetErrorMessage("Login name already in use by another user"); return; } if (staff.Pwd != txtPwd.Text && txtPwd.Text.Length < 6) { SetErrorMessage(staff.Pwd.Length >= 6 ? "Password must be at least 6 characters" : "New passwords must be at least 6 characters"); return; } DataTable dt = Session["staffinfo_data"] as DataTable; DataRow[] foundRows = dt.Select("person_id=" + person_id.ToString()); DataRow row = foundRows[0]; // Convert.ToInt32(row["person_id"]) if (!Convert.ToBoolean(row["is_provider"]) && chkIsProvider.Checked && (StaffDB.GetCountOfProviders() >= Convert.ToInt32(SystemVariableDB.GetByDescr("MaxNbrProviders").Value))) { SetErrorMessage("You have reached your maximum allowable providers. Please uncheck their status as a provider to update them or hit cancel. Contact Mediclinic if you would like to upgrade your account."); return; } if (chkIsProvider.Checked) { System.Data.DataTable tbl = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Field", "has_offerings=1 AND field_id <> 0", "", "field_id", "descr"); bool roleSetAsProvider = false; IDandDescr[] fields = new IDandDescr[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { fields[i] = new IDandDescr(Convert.ToInt32(tbl.Rows[i]["field_id"]), tbl.Rows[i]["descr"].ToString()); if (Convert.ToInt32(ddlField.SelectedValue) == Convert.ToInt32(tbl.Rows[i]["field_id"])) roleSetAsProvider = true; } if (!roleSetAsProvider) { if (fields.Length == 1) { SetErrorMessage("When setting a staff member as a provider, you need to set their Role as '" + fields[0].Descr + "'."); return; } else if (fields.Length == 2) { SetErrorMessage("When setting a staff member as a provider, you need to set their Role as '" + fields[0].Descr + "' or '" + fields[1].Descr + "'."); return; } else { string providerFields = string.Empty; for (int i=0; i<fields.Length; i++) providerFields += (providerFields.Length == 0 ? "" : ", ") + (fields.Length >= 2 && i == (fields.Length - 2) ? "or " : "") + fields[i].Descr; SetErrorMessage("When setting a staff member as a provider, you need to set their Role as one of the following: " + providerFields); return; } } } if (chkIsMasterAdmin.Checked) chkIsAdmin.Checked = true; PersonDB.Update(person_id, Convert.ToInt32(ddlTitle.SelectedValue), Utilities.FormatName(txtFirstname.Text), Utilities.FormatName(txtMiddlename.Text), Utilities.FormatName(txtSurname.Text), row["nickname"].ToString(), ddlGender.SelectedValue, GetDate(ddlDOB_Day.SelectedValue, ddlDOB_Month.SelectedValue, ddlDOB_Year.SelectedValue), DateTime.Now); StaffDB.Update(staff_id, person_id, txtLogin.Text, txtPwd.Text, Convert.ToInt32(row["staff_position_id"]), Convert.ToInt32(ddlField.SelectedValue), Convert.ToInt32(ddlCostCentre.SelectedValue), chkContractor.Checked, txtTFN.Text, txtProviderNumber.Text.ToUpper(), ddlStatus.SelectedValue == "Inactive", chkIsCommission.Checked, Convert.ToDecimal(txtCommissionPercent.Text), chkIsStakeholder.Checked, chkIsMasterAdmin.Checked, chkIsAdmin.Checked, chkIsPrincipal.Checked, chkIsProvider.Checked, staff.IsExternal, row["start_date"] == DBNull.Value ? DateTime.MinValue : (DateTime)row["start_date"], row["end_date"] == DBNull.Value ? DateTime.MinValue : (DateTime)row["end_date"], row["comment"].ToString(), chkSMSBKs.Checked, chkEmailBKs.Checked, chkHideBKNotes.Checked); if (!Convert.ToBoolean(ConfigurationManager.AppSettings["UseConfigDB"]) && staff.Login != txtLogin.Text) { UserDatabaseMapper curDBMapper = UserDatabaseMapperDB.GetByLogin(staff.Login, Session["DB"].ToString()); if (curDBMapper == null) UserDatabaseMapperDB.Insert(txtLogin.Text, Session["DB"].ToString()); else UserDatabaseMapperDB.Update(curDBMapper.ID, txtLogin.Text, Session["DB"].ToString()); } GrdStaff.EditIndex = -1; FillGrid(); }