private void FillEditViewForm(bool isEditMode) { Offering offering = OfferingDB.GetByID(GetFormID()); if (offering == null) { HideTableAndSetErrorMessage("Invalid Offering ID"); return; } lblId.Text = offering.OfferingID.ToString(); lblOffering.Text = offering.Name; txtPopupMessage.Text = offering.PopupMessage; if (isEditMode) { } else { } if (isEditMode) { btnSubmit.Text = "Update"; } else // is view mode { btnSubmit.Visible = false; btnCancel.Text = "Close"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utilities.SetNoCache(Response); } try { if (Session == null || Session["DB"] == null) { throw new SessionTimedOutException(); } string patient_id = Request.QueryString["patient_id"]; if (patient_id == null || !Regex.IsMatch(patient_id, @"^\d+$")) { throw new CustomMessageException(); } Patient patient = PatientDB.GetByID(Convert.ToInt32(patient_id)); if (patient == null) { throw new CustomMessageException(); } string offering_id = Request.QueryString["offering_id"]; if (offering_id == null || !Regex.IsMatch(offering_id, @"^\d+$")) { throw new CustomMessageException(); } Offering offering = OfferingDB.GetByID(Convert.ToInt32(offering_id)); if (offering == null) { throw new CustomMessageException(); } string booking_datetime = Request.QueryString["booking_datetime"]; if (booking_datetime == null || !Regex.IsMatch(booking_datetime, @"^\d{4}_\d{2}_\d{2}_\d{4}$")) { throw new CustomMessageException(); } DateTime dateTime = ConvertStringToDateTime(booking_datetime); int nbrMedicareThisServiceSoFarThisPeriod = (int)InvoiceDB.GetMedicareCountByPatientAndDateRange(patient.PatientID, dateTime.Date.AddMonths(-1 * offering.MaxNbrClaimableMonths), dateTime.Date, offering.OfferingID); // return "[done]:[limit]" Response.Write(nbrMedicareThisServiceSoFarThisPeriod + ":" + offering.MaxNbrClaimable + ":" + offering.MaxNbrClaimableMonths); } catch (SessionTimedOutException) { Utilities.UnsetSessionVariables(); Response.Write("SessionTimedOutException"); } catch (Exception ex) { Response.Write("Exception: " + (Utilities.IsDev() ? ex.ToString() : "please contact system administrator.")); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utilities.SetNoCache(Response); } try { if (Session == null || Session["DB"] == null) { throw new SessionTimedOutException(); } string offering_id = Request.QueryString["offering"]; if (offering_id == null || !Regex.IsMatch(offering_id, @"^\-?\d+$")) { throw new CustomMessageException(); } Offering offering = OfferingDB.GetByID(Convert.ToInt32(offering_id)); if (offering_id == "-1" || offering == null) { throw new CustomMessageException(); } string fieldsSep = "<<sep>>"; string serialized = offering.Name + fieldsSep + offering.ServiceTimeMinutes + fieldsSep + offering.PopupMessage + fieldsSep + offering.Field.ID + fieldsSep + offering.Field.Descr + fieldsSep; Response.Write(serialized); } catch (SessionTimedOutException) { Utilities.UnsetSessionVariables(); Response.Write("SessionTimedOutException"); } catch (Exception ex) { Response.Write("Exception: " + (Utilities.IsDev() ? ex.ToString() : "please contact system administrator.")); } }
private void FillEmptyAddForm() { Offering offering = OfferingDB.GetByID(GetFormID()); if (offering == null) { HideTableAndSetErrorMessage("Invalid Offering ID"); return; } lblId.Text = offering.OfferingID.ToString(); lblOffering.Text = offering.Name; txtPopupMessage.Text = offering.PopupMessage; btnSubmit.Text = "Add Popup Message"; btnCancel.Visible = true; }
public static void UpdateAndCheckWarning(int organisation_id, int offering_id, int qtyUsed) { Organisation org = OrganisationDB.GetByID(organisation_id); Offering offering = OfferingDB.GetByID(offering_id); Stock[] stockList = StockDB.GetByOrg(org.OrganisationID); string warningEmail = SystemVariableDB.GetByDescr("StockWarningNotificationEmailAddress").Value; for (int i = 0; i < stockList.Length; i++) { if (offering.OfferingID == stockList[i].Offering.OfferingID && stockList[i].Quantity >= 0) { int prevQty = stockList[i].Quantity; int postQty = stockList[i].Quantity - qtyUsed; if (postQty < 0) { postQty = 0; } if (warningEmail.Length > 0 && stockList[i].WarningAmount >= 0 && qtyUsed > 0 && stockList[i].WarningAmount < prevQty && stockList[i].WarningAmount >= postQty) { try { Emailer.SimpleEmail( warningEmail, "Stock Warning Level Reached For " + stockList[i].Offering.Name + " at " + org.Name, "This is an automated email to notify you that the stock warning level of <b>" + stockList[i].WarningAmount + "</b> items that was set for <b>" + stockList[i].Offering.Name + "</b> at <b>" + org.Name + "</b> has been reached and you may need to re-stock.<br /><br />Best regards,<br />Mediclinic", true, null, null ); } catch (Exception ex) { Logger.LogException(ex, true); } } StockDB.UpdateQuantity(stockList[i].StockID, postQty); } } }
protected void SetUpGUI() { ddlStaff.Items.Clear(); ddlStaff.Items.Add(new ListItem("All Providers", "-1")); DataTable dtStaff = StaffDB.GetDataTable(); for (int i = 0; i < dtStaff.Rows.Count; i++) { if (!Convert.ToBoolean(dtStaff.Rows[i]["staff_is_fired"]) && Convert.ToBoolean(dtStaff.Rows[i]["staff_is_provider"])) { ddlStaff.Items.Add(new ListItem(dtStaff.Rows[i]["person_firstname"].ToString() + " " + dtStaff.Rows[i]["person_surname"].ToString(), dtStaff.Rows[i]["staff_staff_id"].ToString())); } } ddlOfferings.Style["max-width"] = "375px"; ddlOfferings.Items.Clear(); ddlOfferings.Items.Add(new ListItem("All Offerings", "-1")); DataTable dtOfferings = OfferingDB.GetDataTable(false, "1,3", "63,89"); for (int i = 0; i < dtOfferings.Rows.Count; i++) { if (!Convert.ToBoolean(dtOfferings.Rows[i]["o_is_deleted"])) { ddlOfferings.Items.Add(new ListItem(dtOfferings.Rows[i]["o_name"].ToString(), dtOfferings.Rows[i]["o_offering_id"].ToString())); } } if (IsValidFormStaffID()) { ddlStaff.SelectedValue = StaffDB.GetByID(GetFormStaffID()).StaffID.ToString(); } if (IsValidFormOfferingID()) { ddlOfferings.SelectedValue = OfferingDB.GetByID(GetFormOfferingID()).OfferingID.ToString(); } }
protected void SetupGUI() { if (Request.QueryString["date_type"] != null) { rblDateType.SelectedValue = Request.QueryString["date_type"]; } UserView userView = UserView.GetInstance(); ddlOrgs.Style["width"] = "300px"; ddlOrgs.Items.Clear(); ddlOrgs.Items.Add(new ListItem("All " + (userView.IsAgedCareView ? "Facilities" : "Clinics"), (-1).ToString())); foreach (Organisation curOrg in OrganisationDB.GetAll(false, true, !userView.IsClinicView && !userView.IsGPView, !userView.IsAgedCareView, true, true)) { ListItem li = new ListItem(curOrg.Name, curOrg.OrganisationID.ToString()); li.Attributes.Add("title", curOrg.Name); ddlOrgs.Items.Add(li); } ddlProviders.Style["width"] = "300px"; ddlProviders.Items.Clear(); ddlProviders.Items.Add(new ListItem("All Providers", (-1).ToString())); foreach (Staff curProv in StaffDB.GetAll()) { if (curProv.IsProvider) { ddlProviders.Items.Add(new ListItem(curProv.Person.FullnameWithoutMiddlename, curProv.StaffID.ToString())); } } ddlOfferings.Style["width"] = "300px"; ddlOfferings.Items.Clear(); ddlOfferings.Items.Add(new ListItem("All Products & Services", (-1).ToString())); foreach (Offering offering in OfferingDB.GetAll(false, userView.IsAgedCareView ? "3,4" : "1,3", "63,89", false)) { ddlOfferings.Items.Add(new ListItem(offering.Name, offering.OfferingID.ToString())); } if (IsValidFormOrgID()) { Organisation org = OrganisationDB.GetByID(GetFormOrgID()); if (org != null) { ddlOrgs.SelectedValue = org.OrganisationID.ToString(); } } if (!UserView.GetInstance().IsAdminView) { providerRow.Visible = false; Staff provider = StaffDB.GetByID(Convert.ToInt32(Session["StaffID"])); if (provider != null) { ddlProviders.SelectedValue = provider.StaffID.ToString(); } } else { if (IsValidFormProviderID()) { Staff provider = StaffDB.GetByID(GetFormProviderID()); if (provider != null) { ddlProviders.SelectedValue = provider.StaffID.ToString(); } } } if (IsValidFormOfferingID()) { Offering offering = OfferingDB.GetByID(GetFormOfferingID()); if (offering != null) { ddlOfferings.SelectedValue = offering.OfferingID.ToString(); } } txtStartDate.Text = IsValidFormStartDate() ? (GetFormStartDate(false) == DateTime.MinValue ? "" : GetFormStartDate(false).ToString("dd-MM-yyyy")) : DateTime.Today.ToString("dd-MM-yyyy"); txtEndDate.Text = IsValidFormEndDate() ? (GetFormEndDate(false) == DateTime.MinValue ? "" : GetFormEndDate(false).ToString("dd-MM-yyyy")) : DateTime.Today.ToString("dd-MM-yyyy"); txtStartDate_Picker.OnClientClick = "displayDatePicker('txtStartDate', this, 'dmy', '-'); return false;"; txtEndDate_Picker.OnClientClick = "displayDatePicker('txtEndDate', this, 'dmy', '-'); return false;"; }
protected void GrdOffering_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lblId = (Label)GrdOffering.Rows[e.RowIndex].FindControl("lblId"); TextBox txtName = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtName"); TextBox txtShortName = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtShortName"); TextBox txtDescr = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtDescr"); DropDownList ddlOfferingType = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlOfferingType"); DropDownList ddlField = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlField"); DropDownList ddlOfferingPatientSubcategory = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlOfferingPatientSubcategory"); DropDownList ddlNumClinicVisitsAllowedPerYear = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlNumClinicVisitsAllowedPerYear"); DropDownList ddlOfferingInvoiceType = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlOfferingInvoiceType"); CheckBox chkIsGstExempt = (CheckBox)GrdOffering.Rows[e.RowIndex].FindControl("chkIsGstExempt"); TextBox txtDefaultPrice = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtDefaultPrice"); DropDownList ddlServiceTimeMinutes = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlServiceTimeMinutes"); DropDownList ddlMaxNbrClaimable = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlMaxNbrClaimable"); DropDownList ddlMaxNbrClaimableMonths = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlMaxNbrClaimableMonths"); TextBox txtMedicareCompanyCode = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtMedicareCompanyCode"); TextBox txtDvaCompanyCode = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtDvaCompanyCode"); TextBox txtTacCompanyCode = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtTacCompanyCode"); TextBox txtMedicareCharge = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtMedicareCharge"); TextBox txtDvaCharge = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtDvaCharge"); TextBox txtTacCharge = (TextBox)GrdOffering.Rows[e.RowIndex].FindControl("txtTacCharge"); DropDownList ddlReminderLetterMonthsLaterToSend = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlReminderLetterMonthsLaterToSend"); DropDownList ddlReminderLetter = (DropDownList)GrdOffering.Rows[e.RowIndex].FindControl("ddlReminderLetter"); CheckBox chkUseCustomColour = (CheckBox)GrdOffering.Rows[e.RowIndex].FindControl("chkUseCustomColour"); System.Web.UI.HtmlControls.HtmlInputText ColorPicker = (System.Web.UI.HtmlControls.HtmlInputText)GrdOffering.Rows[e.RowIndex].FindControl("ColorPicker"); if (Convert.ToInt32(ddlReminderLetterMonthsLaterToSend.SelectedValue) > 0 && Convert.ToInt32(ddlReminderLetter.SelectedValue) == -1) { SetErrorMessage("For reminder letters - you must either set the number of months as disabled or select a reminder letter."); return; } Offering offering = OfferingDB.GetByID(Convert.ToInt32(lblId.Text)); // if logged not AC system, set as was // if logged not Clinic system, set as was // these are hidden in the gui also in method 'GrdOffering_RowCreated' int offeringPatientSubcategoryID = !UserView.GetInstance().IsAgedCareView ? offering.AgedCarePatientType.ID : Convert.ToInt32(ddlOfferingPatientSubcategory.SelectedValue); OfferingDB.Update(Convert.ToInt32(lblId.Text), Convert.ToInt32(ddlOfferingType.SelectedValue), Convert.ToInt32(ddlField.SelectedValue), offeringPatientSubcategoryID, Convert.ToInt32(ddlNumClinicVisitsAllowedPerYear.SelectedValue), Convert.ToInt32(ddlOfferingInvoiceType.SelectedValue), txtName.Text, txtShortName.Text, txtDescr.Text, chkIsGstExempt.Checked, Convert.ToDecimal(txtDefaultPrice.Text), Convert.ToInt32(ddlServiceTimeMinutes.Text), Convert.ToInt32(ddlMaxNbrClaimable.SelectedValue), Convert.ToInt32(ddlMaxNbrClaimableMonths.SelectedValue), txtMedicareCompanyCode.Text.Trim(), txtDvaCompanyCode.Text.Trim(), txtTacCompanyCode.Text.Trim(), Convert.ToDecimal(txtMedicareCharge.Text), Convert.ToDecimal(txtDvaCharge.Text), Convert.ToDecimal(txtTacCharge.Text), offering.PopupMessage, Convert.ToInt32(ddlReminderLetterMonthsLaterToSend.SelectedValue), Convert.ToInt32(ddlReminderLetter.SelectedValue), chkUseCustomColour.Checked, ColorPicker.Value ); Session["OfferingColors"] = OfferingDB.GetColorCodes(); GrdOffering.EditIndex = -1; FillGrid(); }