protected void SetOrgsDDL() { DataTable dt = null; string type = null; if (!UserView.GetInstance().IsAgedCareView) { dt = OrganisationDB.GetDataTable_Clinics(); type = "Clinics"; lblOrgType.Text = "Clinic"; } else { dt = OrganisationDB.GetDataTable_AgedCareFacs(); type = "Facilities"; lblOrgType.Text = "Facility"; } ddlOrgs.Items.Clear(); ddlOrgs.Items.Add(new ListItem("All " + type, "0")); for (int i = 0; i < dt.Rows.Count; i++) { ddlOrgs.Items.Add(new ListItem(dt.Rows[i]["name"].ToString(), dt.Rows[i]["organisation_id"].ToString())); } if (IsValidFormID()) { ddlOrgs.SelectedValue = GetFormID().ToString(); lblHowToAddItems.Visible = false; } }
protected void DisallowAddEditIfNoPermissions() { // if its a booking note // only allow add/edit if by the provider of the booking, or by a "principle" staff memeber UserView userView = UserView.GetInstance(); int loggedInStaffID = Session["StaffID"] == null ? -1 : Convert.ToInt32(Session["StaffID"]); Booking booking = BookingDB.GetByEntityID(GetFormID()); if (booking != null) { bool canAddEdit = (booking.Provider != null && loggedInStaffID == booking.Provider.StaffID) || userView.IsPrincipal || userView.IsStakeholder; if (!canAddEdit) { GrdNote.FooterRow.Visible = false; for (int i = 0; i < GrdNote.Columns.Count; i++) { if (GrdNote.Columns[i].HeaderText.Trim() == ".") { GrdNote.Columns[i].Visible = false; } } } } }
protected void GrdReferreralEmails_RowDataBound(object sender, GridViewRowEventArgs e) { Patient patient = PatientDB.GetByID(GetFormPTID()); if (patient == null) { HideTableAndSetErrorMessage(""); return; } UserView userView = UserView.GetInstance(); DataTable dt = ViewState["referreralemail_data"] 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("register_referrer_id=" + lblId.Text); DataRow thisRow = foundRows[0]; Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { } }
public static void EnforcePermissions_RequireAll(HttpSessionState session, HttpResponse response, bool requireStakeholder, bool requireMasterAdmin, bool requireAdmin, bool requirePrincipal, bool requireProvider, bool requireStaff) { UserView userView = UserView.GetInstance(); if (requireStakeholder && !userView.IsStakeholder) { response.Redirect(PagePermissions.UnauthorisedAccessPageForward()); } if (requireMasterAdmin && !userView.IsMasterAdmin) { response.Redirect(PagePermissions.UnauthorisedAccessPageForward()); } if (requireAdmin && !userView.IsAdmin) { response.Redirect(PagePermissions.UnauthorisedAccessPageForward()); } if (requirePrincipal && !userView.IsPrincipal) { response.Redirect(PagePermissions.UnauthorisedAccessPageForward()); } if (requireProvider && !userView.IsProvider) { response.Redirect(PagePermissions.UnauthorisedAccessPageForward()); } if (requireStaff && !userView.IsStaff) { response.Redirect(PagePermissions.UnauthorisedAccessPageForward()); } }
protected void GrdBooking_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Reverse") { try { UserView userView = UserView.GetInstance(); int booking_id = Convert.ToInt32(e.CommandArgument); Booking booking = BookingDB.GetByID(booking_id); string errorString = string.Empty; if (!booking.CanReverse(userView.IsAdminView, out errorString)) { throw new CustomMessageException(errorString); } booking.Reverse(UserView.GetInstance().IsAdminView, Convert.ToInt32(Session["StaffID"])); FillGrid(); } catch (CustomMessageException ex) { SetErrorMessage(ex.Message); } catch (Exception ex) { SetErrorMessage("", ex.ToString()); } } }
protected void GrdReferrer_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.Pager) { foreach (DataControlField col in GrdReferrer.Columns) { if (!chkShowDeleted.Checked) { if (col.HeaderText.ToLower().Trim() == "deleted") { e.Row.Cells[GrdReferrer.Columns.IndexOf(col)].CssClass = "hiddencol"; } } if (!UserView.GetInstance().IsAdminView) { if (col.HeaderText.ToLower().Trim() == "last batch send treatment notes" || col.HeaderText.ToLower().Trim() == "treatment notes for all patients") { e.Row.Cells[GrdReferrer.Columns.IndexOf(col)].CssClass = "hiddencol"; } } } } if (!Utilities.IsDev() && e.Row.RowType != DataControlRowType.Pager) { e.Row.Cells[0].CssClass = "hiddencol"; } }
protected void GrdCredit_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "_Delete") { try { int credit_id = Convert.ToInt32(e.CommandArgument); Credit credit = CreditDB.GetByID(credit_id); UserView userview = UserView.GetInstance(); if (userview.IsProviderView && Convert.ToInt32(Session["StaffID"]) != credit.AddedBy.StaffID) { throw new CustomMessageException("You Can Not Delete Vouchers Entered By Other Providers."); } CreditDB.SetAsDeleted(credit_id, Convert.ToInt32(Session["StaffID"])); FillCreditGrid(); FillPayments(); } catch (Exception ex) { lblErrorMessage.Text = ex.Message; } } }
protected void FillGrid() { UserView userView = UserView.GetInstance(); DateTime fromDate = IsValidDate(txtStartDate.Text) ? GetDate(txtStartDate.Text) : DateTime.MinValue; DateTime toDate = IsValidDate(txtEndDate.Text) ? GetDate(txtEndDate.Text).Add(new TimeSpan(23, 59, 59)) : DateTime.MinValue; if (!IsValidDate(txtStartDate.Text)) { SetErrorMessage("Please Enter A Valid Start Date"); SetGrid(); return; } if (!IsValidDate(txtEndDate.Text)) { SetErrorMessage("Please Enter A Valid End Date"); SetGrid(); return; } DataTable dt = BookingDB.GetReport_StaffTimetable(fromDate, toDate, chkIncBookings.Checked, userView.IsAgedCareView || chkIncAllSites.Checked, userView.IsClinicView || chkIncAllSites.Checked, Convert.ToInt32(ddlOrgs.SelectedValue), Convert.ToInt32(ddlProviders.SelectedValue)); Session["data_summaryReport"] = dt; SetGrid(); }
protected void SetGUI() { UserView userView = UserView.GetInstance(); lblOrganisationType.Text = !userView.IsAgedCareView ? "Clinic" : "Facility"; hiddenIsMobileDevice.Value = Utilities.IsMobileDevice(Request) ? "1" : "0"; }
protected void GrdNote_RowCreated(object sender, GridViewRowEventArgs e) { if (!Utilities.IsDev() && e.Row.RowType != DataControlRowType.Pager) { e.Row.Cells[0].CssClass = "hiddencol"; e.Row.Cells[1].CssClass = "hiddencol"; } if (e.Row.RowType != DataControlRowType.Pager && !UserView.GetInstance().IsAdminView) { e.Row.Cells[6].CssClass = "hiddencol"; } if (e.Row.RowType != DataControlRowType.Pager && (IsValidFormScreen() && (GetFormScreen() == 16 || GetFormScreen() == 17 || GetFormScreen() == 18))) { foreach (DataControlField col in GrdNote.Columns) { if (col.HeaderText.ToLower().Trim() == "type") { e.Row.Cells[GrdNote.Columns.IndexOf(col)].CssClass = "hiddencol"; } } } if (e.Row.RowType != DataControlRowType.Pager && (IsValidFormScreen() && GetFormScreen() != 16)) { foreach (DataControlField col in GrdNote.Columns) { if (col.HeaderText.ToLower().Trim() == "body part") { e.Row.Cells[GrdNote.Columns.IndexOf(col)].CssClass = "hiddencol"; } } } if (e.Row.RowType == DataControlRowType.DataRow && e.Row.DataItem != null) { TextBox lblNote = (TextBox)e.Row.FindControl("lblNote"); if (lblNote != null) { DataTable dt = ViewState["noteinfo_data"] as DataTable; string text = dt.Rows[e.Row.RowIndex]["text"].ToString(); string[] lines = text.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None); lblNote.Rows = lines.Length <= 1 ? 1 : lines.Length - 1; } } if (IsValidFormScreen() && GetFormScreen() == 17 && e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[5].Text = "Medication"; } if (IsValidFormScreen() && GetFormScreen() == 18 && e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[5].Text = "Medical Condition"; } }
protected void FillGrid() { Organisation org = null; if (IsValidFormID()) { org = OrganisationDB.GetByID(GetFormID()); } DataTable dt = org == null ? dt = StockDB.GetDataTable(!UserView.GetInstance().IsAgedCareView ? 5 : 6) : dt = StockDB.GetDataTable_ByOrg(org.OrganisationID); Session["registerstocktoorg_data"] = dt; if (dt.Rows.Count > 0) { if (IsPostBack && Session["registerstocktoorg_sortexpression"] != null && Session["registerstocktoorg_sortexpression"].ToString().Length > 0) { DataView dataView = new DataView(dt); dataView.Sort = Session["registerstocktoorg_sortexpression"].ToString(); GrdRegistration.DataSource = dataView; } else { GrdRegistration.DataSource = dt; } try { GrdRegistration.DataBind(); } catch (Exception ex) { SetErrorMessage("", ex.ToString()); } } else { dt.Rows.Add(dt.NewRow()); GrdRegistration.DataSource = dt; GrdRegistration.DataBind(); int TotalColumns = GrdRegistration.Rows[0].Cells.Count; GrdRegistration.Rows[0].Cells.Clear(); GrdRegistration.Rows[0].Cells.Add(new TableCell()); GrdRegistration.Rows[0].Cells[0].ColumnSpan = TotalColumns; GrdRegistration.Rows[0].Cells[0].Text = "No Record Found"; } if (org == null || hideFotter) { GrdRegistration.FooterRow.Visible = false; } }
protected void GrdPatients_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header && UserView.GetInstance().IsAgedCareView) { for (int i = 0; i < e.Row.Cells.Count; i++) { e.Row.Cells[i].Text = e.Row.Cells[i].Text.Replace("EPC", "Ref."); } } DataTable dt = Session["referrerinfoclinic_patients_data"] 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"); string s = "patient_id=" + lblId.Text.Trim(); DataRow[] foundRows = dt.Select("patient_id=" + lblId.Text.Trim()); DataRow thisRow = foundRows[0]; Label lblPatient = (Label)e.Row.FindControl("lblPatient"); if (lblPatient != null) { string URL = "PatientDetailV2.aspx?type=view&id=" + thisRow["patient_id"]; if (URL.StartsWith("~")) { URL = URL.Substring(1); } lblPatient.Text = "<a href=\"#\" onclick=\"open_new_window('" + URL + "');return false;\" >" + thisRow["firstname"] + " " + thisRow["surname"] + "</a>"; } Label lblEPCExpires = (Label)e.Row.FindControl("lblEPCExpires"); if (lblEPCExpires != null) { if (thisRow["epc_expiry_date"] != DBNull.Value && Convert.ToDateTime(thisRow["epc_expiry_date"]) < DateTime.Today) { lblEPCExpires.ForeColor = System.Drawing.Color.Red; } } Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { } }
protected void SetupGUI() { bool isValidFormPatient = IsValidFormPatient(); if (isValidFormPatient) { Patient patient = PatientDB.GetByID(GetFormPatient()); lblSelectedPatientName.Text = "<a href=\"#\" onclick=\"open_new_window('PatientDetailV2.aspx?type=view&id=" + patient.PatientID + "', 1750, 1000);return false;\">" + patient.Person.FullnameWithoutMiddlename + "</a>"; } lblSelectedPatientLabelText.Visible = isValidFormPatient; lblSelectedPatientName.Visible = isValidFormPatient; btnClearSelectedPatient.Visible = isValidFormPatient; txtStartDate.Text = GetFormDate().ToString("dd-MM-yyyy"); for (int i = 1; i <= 8; i++) { ddlDaysToDisplay.Items.Add(new ListItem(i.ToString(), i.ToString())); } int ndays = GetFormNumDays(); if (ndays < 1) { ndays = 1; } if (ndays > 8) { ndays = 8; } ddlDaysToDisplay.SelectedValue = ndays.ToString(); if (Convert.ToInt32(ddlDaysToDisplay.SelectedValue) != Convert.ToInt32(Session["NumDaysToDisplayOnBookingScreen"])) { StaffDB.UpdateNumDaysToDisplayOnBookingScreen(Convert.ToInt32(Session["StaffID"]), Convert.ToInt32(ddlDaysToDisplay.SelectedValue)); Session["NumDaysToDisplayOnBookingScreen"] = Convert.ToInt32(ddlDaysToDisplay.SelectedValue); } if (UserView.GetInstance().IsAgedCareView) { lblGetPatientLabelText.Visible = false; txtSearchFullName.Visible = false; btnClearFullNameSearch.Visible = false; lblSelectedPatientLabelText.Visible = false; lblSelectedPatientName.Visible = false; btnClearSelectedPatient.Visible = false; pt_table_seperator.Style["min-width"] = "0px"; } }
protected void FillOrganisationGrid() { UserView userView = UserView.GetInstance(); lblHeading.Text = !userView.IsAgedCareView ? "Facilitys" : "Clinics"; int patientID = IsValidFormPatient() ? GetFormPatient(false) : -1; DataTable dt = patientID == -1 ? OrganisationDB.GetDataTable(0, false, true, !userView.IsClinicView && !userView.IsGPView, !userView.IsAgedCareView, true, true, txtSearchOrganisation.Text.Trim(), chkOrganisationSearchOnlyStartWith.Checked) : RegisterPatientDB.GetDataTable_OrganisationsOf(patientID, true, !userView.IsClinicView && !userView.IsGPView, !userView.IsAgedCareView, true, true, txtSearchOrganisation.Text.Trim(), chkOrganisationSearchOnlyStartWith.Checked); Session["organisationlist_data"] = dt; if (dt.Rows.Count > 0) { if (IsPostBack && Session["organisationlist_sortexpression"] != null && Session["organisationlist_sortexpression"].ToString().Length > 0) { DataView dataView = new DataView(dt); dataView.Sort = Session["organisationlist_sortexpression"].ToString(); GrdOrganisation.DataSource = dataView; } else { GrdOrganisation.DataSource = dt; } try { GrdOrganisation.DataBind(); GrdOrganisation.PagerSettings.FirstPageText = "1"; GrdOrganisation.PagerSettings.LastPageText = GrdOrganisation.PageCount.ToString(); GrdOrganisation.DataBind(); } catch (Exception ex) { this.lblErrorMessage.Visible = true; this.lblErrorMessage.Text = ex.ToString(); } } else { dt.Rows.Add(dt.NewRow()); GrdOrganisation.DataSource = dt; GrdOrganisation.DataBind(); int TotalColumns = GrdOrganisation.Rows[0].Cells.Count; GrdOrganisation.Rows[0].Cells.Clear(); GrdOrganisation.Rows[0].Cells.Add(new TableCell()); GrdOrganisation.Rows[0].Cells[0].ColumnSpan = TotalColumns; GrdOrganisation.Rows[0].Cells[0].Text = "No Record Found"; } }
protected void GrdScannedDoc_RowCreated(object sender, GridViewRowEventArgs e) { if (!Utilities.IsDev() && e.Row.RowType != DataControlRowType.Pager) { } UserView userview = UserView.GetInstance(); if (!userview.IsMasterAdmin) { e.Row.Cells[4].CssClass = "hiddencol"; } }
protected void SetupGUI() { DateTime startOfThisMonth = DateTime.Now.AddDays((-1 * DateTime.Now.Day) + 1); DateTime endOfThisMonth = startOfThisMonth.AddMonths(1).AddDays(-1); txtStartDate.Text = startOfThisMonth.ToString("dd-MM-yyyy"); txtEndDate.Text = endOfThisMonth.ToString("dd-MM-yyyy"); txtStartDate_Picker.OnClientClick = "displayDatePicker('txtStartDate', this, 'dmy', '-'); return false;"; txtEndDate_Picker.OnClientClick = "displayDatePicker('txtEndDate', this, 'dmy', '-'); return false;"; lblHeading.InnerText = UserView.GetInstance().IsAgedCareView ? "Facilities Statistics" : "Clinics Statistics"; }
protected void UpdateLogout(bool hideHeader) { UserView userView = UserView.GetInstance(); if (!userView.IsLoggedIn) { Logout(hideHeader); return; } // if another session logged in - logout here if (Session["StaffID"] == null || !(new List <int> { -5, -7, -8 }).Contains((int)Session["StaffID"])) { UserLogin userlogin = null; if (HttpContext.Current.Session != null && HttpContext.Current.Session["DB"] != null) { userlogin = !userView.IsPatient ? UserLoginDB.GetByUserID(Convert.ToInt32(Session["StaffID"]), -1) : UserLoginDB.GetByUserID(-1, Convert.ToInt32(Session["PatientID"])); } if (userlogin == null || userlogin.SessionID != HttpContext.Current.Session.SessionID.ToString()) { Logout(hideHeader); return; } if (Session["SiteID"] == null && !HttpContext.Current.Request.Url.LocalPath.Contains("/Account/LoginV2.aspx") && !HttpContext.Current.Request.Url.LocalPath.Contains("/Account/LogoutV2.aspx") && !HttpContext.Current.Request.Url.LocalPath.Contains("/Account/SelectSiteV2.aspx")) { Response.Redirect("~/Account/SelectSiteV2.aspx?from_url=" + Request.RawUrl); } if (!userView.IsAdminView && Session["OrgID"] == null && !HttpContext.Current.Request.Url.LocalPath.Contains("/Account/LoginV2.aspx") && !HttpContext.Current.Request.Url.LocalPath.Contains("/Account/LogoutV2.aspx") && !HttpContext.Current.Request.Url.LocalPath.Contains("/Account/SelectOrgV2.aspx") && !HttpContext.Current.Request.Url.LocalPath.Contains("/Account/SelectSiteV2.aspx")) { Response.Redirect("~/Account/SelectOrgV2.aspx?from_url=" + Request.RawUrl); } UserLoginDB.UpdateLastAccessTime(userlogin.UserloginID, DateTime.Now, Request.RawUrl.Contains("/Account/Logout.aspx") ? "" : Request.RawUrl); } }
protected void GrdStaffOfferings_RowDataBound(object sender, GridViewRowEventArgs e) { DataTable dt = Session["staff_offerings_data"] 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("so_staff_offering_id=" + lblId.Text); DataRow thisRow = foundRows[0]; Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlStaff = (DropDownList)e.Row.FindControl("ddlNewStaff"); DataTable staff = StaffDB.GetDataTable(); DataView dataView = new DataView(staff); dataView.Sort = "person_firstname, person_surname"; staff = dataView.ToTable(); for (int i = 0; i < staff.Rows.Count; i++) { Staff s = StaffDB.LoadAll(staff.Rows[i]); ddlStaff.Items.Add(new ListItem(s.Person.FullnameWithoutMiddlename, s.StaffID.ToString())); } DropDownList ddlOffering = (DropDownList)e.Row.FindControl("ddlNewOffering"); string offering_invoice_type_id = null; if (UserView.GetInstance().IsAgedCareView) { offering_invoice_type_id = "3,4"; // 4 = AC } else // if (!UserView.GetInstance().IsAgedCareView) { offering_invoice_type_id = "1,3"; // 4 = Clinic } DataTable offerings = OfferingDB.GetDataTable(false, offering_invoice_type_id); ddlOffering.DataSource = offerings; ddlOffering.DataTextField = "o_name"; ddlOffering.DataValueField = "o_offering_id"; ddlOffering.DataBind(); } }
protected void FillForm() { try { if (!CheckIsValidStartEndDates()) { return; } DataTable tblStats = OrganisationDB.GetStats(GetFromDate(), GetToDate(), UserView.GetInstance().IsClinicView ? 5 : 6, chkIncDeleted.Checked); lstOrgStats.DataSource = tblStats; lstOrgStats.DataBind(); // get from footer Label lblSum_TotalBookings = (Label)lstOrgStats.Controls[lstOrgStats.Controls.Count - 1].Controls[0].FindControl("lblSum_TotalBookings"); Label lblSum_AvgConsultTime = (Label)lstOrgStats.Controls[lstOrgStats.Controls.Count - 1].Controls[0].FindControl("lblSum_AvgConsultTime"); Label lblSum_Bookings = (Label)lstOrgStats.Controls[lstOrgStats.Controls.Count - 1].Controls[0].FindControl("lblSum_Bookings"); Label lblSum_Patients = (Label)lstOrgStats.Controls[lstOrgStats.Controls.Count - 1].Controls[0].FindControl("lblSum_Patients"); lblSum_TotalBookings.Text = String.Format("{0:n0}", tblStats.Compute("Sum(total_bookings)", "")); decimal total = 0; int count = 0; for (int i = 0; i < tblStats.Rows.Count; i++) { if (tblStats.Rows[i]["avg_minutes"] == DBNull.Value) { continue; } total += Convert.ToDecimal(tblStats.Rows[i]["avg_minutes"]); count++; } if (count > 0) { lblSum_AvgConsultTime.Text = String.Format("{0:n0}", total / count); } lblSum_Bookings.Text = String.Format("{0:n0}", tblStats.Compute("Sum(n_bookings)", "")); lblSum_Patients.Text = String.Format("{0:n0}", tblStats.Compute("Sum(n_patients)", "")); } catch (CustomMessageException cmEx) { HideTableAndSetErrorMessage(cmEx.Message); } catch (Exception ex) { HideTableAndSetErrorMessage(Utilities.IsDev() ? ex.ToString() : string.Empty); } }
protected void FillOfferingGrid() { UserView userView = UserView.GetInstance(); DataTable dt = OfferingDB.GetDataTable(false, userView.IsAgedCareView ? "3,4" : "1,3", "63,89", false, txtSearchOffering.Text.Trim(), chkOfferingSearchOnlyStartWith.Checked); Session["offeringlist_data"] = dt; if (dt.Rows.Count > 0) { if (IsPostBack && Session["offeringlist_sortexpression"] != null && Session["offeringlist_sortexpression"].ToString().Length > 0) { DataView dataView = new DataView(dt); dataView.Sort = Session["offeringlist_sortexpression"].ToString(); GrdOffering.DataSource = dataView; } else { GrdOffering.DataSource = dt; } try { GrdOffering.DataBind(); GrdOffering.PagerSettings.FirstPageText = "1"; GrdOffering.PagerSettings.LastPageText = GrdOffering.PageCount.ToString(); GrdOffering.DataBind(); } catch (Exception ex) { this.lblErrorMessage.Visible = true; this.lblErrorMessage.Text = ex.ToString(); } } else { dt.Rows.Add(dt.NewRow()); GrdOffering.DataSource = dt; GrdOffering.DataBind(); int TotalColumns = GrdOffering.Rows[0].Cells.Count; GrdOffering.Rows[0].Cells.Clear(); GrdOffering.Rows[0].Cells.Add(new TableCell()); GrdOffering.Rows[0].Cells[0].ColumnSpan = TotalColumns; GrdOffering.Rows[0].Cells[0].Text = "No Record Found"; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { Utilities.SetNoCache(Response); } HideErrorMessage(); if (!IsPostBack) { PagePermissions.EnforcePermissions_RequireAny(Session, Response, true, true, true, false, false, false); Session.Remove("registerofferingtoorg_sortexpression"); Session.Remove("registerofferingtoorg_data"); lblHeading.Text = Page.Title = !UserView.GetInstance().IsAgedCareView ? "Specific Prices Per Clinic" : "Specific Prices Per Facility/Wing/Unit"; FillGrid(); SetOrgsDDL(); } this.GrdRegistration.EnableViewState = true; } catch (CustomMessageException ex) { if (IsPostBack) { SetErrorMessage(ex.Message); } else { HideTableAndSetErrorMessage(ex.Message); } } catch (Exception ex) { if (IsPostBack) { SetErrorMessage("", ex.ToString()); } else { HideTableAndSetErrorMessage("", ex.ToString()); } } }
protected void SetupGUI() { txtStartDate_Picker.OnClientClick = "displayDatePicker('txtStartDate', this, 'dmy', '-'); return false;"; //txtEndDate_Picker.OnClientClick = "displayDatePicker('txtEndDate', this, 'dmy', '-'); return false;"; txtNoRecallLettersAfterDate_Picker.OnClientClick = "displayDatePicker('txtNoRecallLettersAfterDate', this, 'dmy', '-'); return false;"; //txtStartDate.Text = IsValidFormStartDate() ? (GetFormStartDate(false) == DateTime.MinValue ? "" : GetFormStartDate(false).ToString("dd-MM-yyyy")) : DateTime.Today.AddYears(-1).ToString("dd-MM-yyyy"); // DateTime.Now.AddYears(-1).ToString("dd-MM-yyyy"); // txtEndDate.Text = IsValidFormEndDate() ? (GetFormEndDate(false) == DateTime.MinValue ? "" : GetFormEndDate(false).ToString("dd-MM-yyyy")) : DateTime.Today.ToString("dd-MM-yyyy"); // DateTime.Now.AddYears(1).ToString("dd-MM-yyyy"); // txtNoRecallLettersAfterDate.Text = IsValidFormNoRecallDate() ? (GetFormNoRecallDate(false) == DateTime.MinValue ? "" : GetFormNoRecallDate(false).ToString("dd-MM-yyyy")) : DateTime.Today.ToString("dd-MM-yyyy"); string show_with_epc = Request.QueryString["show_with_epc"]; if (show_with_epc != null && (show_with_epc == "1" || show_with_epc == "0")) { chkShowWithEPC.Checked = show_with_epc == "1"; } string show_with_no_epc = Request.QueryString["show_with_no_epc"]; if (show_with_no_epc != null && (show_with_no_epc == "1" || show_with_no_epc == "0")) { chkShowWithNoEPC.Checked = show_with_no_epc == "1"; } UserView userView = UserView.GetInstance(); ddlClinics.Style["width"] = "290px"; ddlClinics.Items.Add(new ListItem("All " + (userView.IsAgedCareView ? "Facilities" : "Clinics"), 0.ToString())); DataTable dt_clinics = OrganisationDB.GetDataTable_Clinics(false); for (int i = 0; i < dt_clinics.Rows.Count; i++) { ddlClinics.Items.Add(new ListItem(dt_clinics.Rows[i]["name"].ToString(), dt_clinics.Rows[i]["organisation_id"].ToString())); } string org = Request.QueryString["org"]; if (org != null && ddlClinics.Items.FindByValue(org) != null) { ddlClinics.SelectedValue = org; } }
protected void FillCreditGrid() { UserView userview = UserView.GetInstance(); int staffID = Convert.ToInt32(Session["StaffID"]); DataTable tbl = CreditDB.GetDataTable_ByEntityID(224413, "1,2"); tbl.Columns.Add("can_delete", typeof(Boolean)); for (int i = 0; i < tbl.Rows.Count; i++) { tbl.Rows[i]["can_delete"] = (Convert.ToInt32(tbl.Rows[i]["credit_credit_type_id"]) == 1 || Convert.ToInt32(tbl.Rows[i]["credit_credit_type_id"]) == 2) && tbl.Rows[i]["credit_deleted_by"] == DBNull.Value && (!userview.IsProviderView || staffID == Convert.ToInt32(tbl.Rows[i]["credit_added_by"])); } GrdCredit.DataSource = tbl; GrdCredit.DataBind(); }
protected void PopulateLettersList() { UserView userView = UserView.GetInstance(); int orgID = (txtUpdateOrganisationID.Text.Length == 0) ? 0 : Convert.ToInt32(txtUpdateOrganisationID.Text); if (orgID == 0 && !userView.IsAdminView) { orgID = Convert.ToInt32(Session["OrgID"]); } bool usingDeafultLetters = orgID == 0 || chkUseDefaultDocs.Checked; // || !LetterDB.OrgHasdocs(orgID); DataTable letters = LetterDB.GetDataTable_ByOrg(usingDeafultLetters ? 0 : orgID, usingDeafultLetters ? Convert.ToInt32(Session["SiteID"]) : -1); lblSpaceBeforeUseDefaultDocsCheckbox.Visible = orgID != 0; chkUseDefaultDocs.Visible = orgID != 0; chkUseDefaultDocs.ForeColor = System.Drawing.Color.DarkOrchid; lblDefaultOrOrgSpecificDocs.Visible = orgID == 0; lblSpaceBeforeUseDefaultDocsCheckbox.Visible = orgID == 0; if (usingDeafultLetters) { SetLabel(lblDefaultOrOrgSpecificDocs, "**Using Default Docs", System.Drawing.Color.Blue, false); } else { SetLabel(lblDefaultOrOrgSpecificDocs, "**Using Organisation Specific Docs", System.Drawing.Color.DarkOrchid, false); } // remove ones that dont exists for (int i = letters.Rows.Count - 1; i >= 0; i--) { Letter letter = LetterDB.LoadAll(letters.Rows[i]); if (!letter.FileExists(Convert.ToInt32(Session["SiteID"]))) { letters.Rows.RemoveAt(i); } } lstLetters.DataSource = letters; lstLetters.DataTextField = "letter_docname"; lstLetters.DataValueField = "letter_letter_id"; lstLetters.DataBind(); }
protected void GrdOrgInvoicesOutstanding_FillGrid() { bool insuranceCompanies = !UserView.GetInstance().IsAgedCareView; DataTable dt = InvoiceDB.GetAllOutstandingByOrgAsReport(Convert.ToInt32(Session["SiteID"]), 0, insuranceCompanies); dt.DefaultView.Sort = "name"; dt = dt.DefaultView.ToTable(); Session["orginvoicesoutstanding_data"] = dt; btnExportAllFacs.Visible = dt.Rows.Count > 0; btnPrintAllFacs.Visible = dt.Rows.Count > 0; if (dt.Rows.Count > 0) { GrdOrgInvoicesOutstanding.DataSource = dt; try { GrdOrgInvoicesOutstanding.DataBind(); GrdOrgInvoicesOutstanding.PagerSettings.FirstPageText = "1"; GrdOrgInvoicesOutstanding.PagerSettings.LastPageText = GrdOrgInvoicesOutstanding.PageCount.ToString(); GrdOrgInvoicesOutstanding.DataBind(); } catch (Exception ex) { HideTableAndSetErrorMessage("", ex.ToString()); } } else { dt.Rows.Add(dt.NewRow()); GrdOrgInvoicesOutstanding.DataSource = dt; GrdOrgInvoicesOutstanding.DataBind(); int TotalColumns = GrdOrgInvoicesOutstanding.Rows[0].Cells.Count; GrdOrgInvoicesOutstanding.Rows[0].Cells.Clear(); GrdOrgInvoicesOutstanding.Rows[0].Cells.Add(new TableCell()); GrdOrgInvoicesOutstanding.Rows[0].Cells[0].ColumnSpan = TotalColumns; GrdOrgInvoicesOutstanding.Rows[0].Cells[0].Text = "No Record Found"; } btnEmailAllFacs.Attributes["onclick"] = "if (!confirm('Estimating 20 seconds per email for " + dt.Rows.Count + " facilities, you will need to let this page run for about " + (dt.Rows.Count / 3) + " Minutes. \\r\\nAre you sure you want to continue?')) return false;"; }
protected void GrdPatient_RowCreated(object sender, GridViewRowEventArgs e) { if (!Utilities.IsDev() && e.Row.RowType != DataControlRowType.Pager) { e.Row.Cells[0].CssClass = "hiddencol"; } if (e.Row.RowType != DataControlRowType.Pager) { foreach (DataControlField col in GrdPatient.Columns) { if (!UserView.GetInstance().IsAgedCareView) { if (col.HeaderText.ToLower().Trim() == "ac type") { e.Row.Cells[GrdPatient.Columns.IndexOf(col)].CssClass = "hiddencol"; } } } } }
protected void btnPrintAllFacs_Command(object sender, CommandEventArgs e) { DataTable dt = Session["orginvoicesoutstanding_data"] as DataTable; bool tblEmpty = (dt.Rows.Count == 1 && dt.Rows[0][0] == DBNull.Value); if (tblEmpty) { dt = dt.Clone(); // copy schema only to have empty table } Tuple <int[], int, int>[] list = new Tuple <int[], int, int> [dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { int organisationID = Convert.ToInt32(dt.Rows[i]["organisation_id"]); string invoiceIDsCommaSep = (string)dt.Rows[i]["invoice_ids_comma_sep"]; int[] invoiceIDs = Array.ConvertAll <string, int>(invoiceIDsCommaSep.Split(','), Convert.ToInt32); list[i] = new Tuple <int[], int, int>(invoiceIDs, -1, organisationID); } Letter.GenerateOutstandingInvoicesToPrint_Multiple(Response, list, !UserView.GetInstance().IsAgedCareView); }
protected void GUI_SetBatchSendElements() { if (UserView.GetInstance().IsAdminView) { try { DateTime lastGenerated = GetLastDateBatchSendTreatmentNotesAllReferrers(); string lastGeneratedString = (lastGenerated == DateTime.MinValue) ? "Never" : lastGenerated.ToString("dd-MM-yyyy"); string howLongAgoString = string.Empty; if (lastGenerated != DateTime.MinValue) { if (DateTime.Now.Subtract(lastGenerated).TotalDays <= 30) { howLongAgoString = " (" + DateTime.Now.Subtract(lastGenerated).TotalDays.ToString("0") + " days ago)"; } else { howLongAgoString = " (" + MonthDifference(DateTime.Now, lastGenerated).ToString("0.0") + " months ago)"; } } //lblLastBatchSendTreatmentNotes_AllReferrers.Text = // "Generate Treatement Notes All Referrers" + "<br />" + // "Last Generated: <b>" + lastGeneratedString + howLongAgoString +"</b>"; } catch (Exception) { SetErrorMessage("Last batch send treatment notes all referrers has invalid date: " + ((SystemVariables)Session["SystemVariables"])["LastDateBatchSendTreatmentNotes_AllReferrers"].Value); } } else { //td_generate_treatment_notes_space_before.Visible = false; //td_generate_treatment_notes_button.Visible = false; //td_generate_treatment_notes_date_space_before.Visible = false; //td_generate_treatment_notes_date_label.Visible = false; } }
protected void GrdOffering_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType != DataControlRowType.Pager) { foreach (DataControlField col in GrdOffering.Columns) { if (!chkShowDeleted.Checked && col.HeaderText.ToLower().Trim() == "deleted") { e.Row.Cells[GrdOffering.Columns.IndexOf(col)].CssClass = "hiddencol"; } } if (!Utilities.IsDev()) { e.Row.Cells[0].CssClass = "hiddencol"; } e.Row.Cells[2].CssClass = "hiddencol"; e.Row.Cells[3].CssClass = "hiddencol"; bool isAgedCareResidentTypes = IsValidIsAgedCareResidentTypes() ? GetFormIsAgedCareResidentTypes() : false; if (UserView.GetInstance().IsClinicView || !isAgedCareResidentTypes) { e.Row.Cells[6].CssClass = "hiddencol"; // Patient Subcategory (Aged Care) -- add/update in to add/edit code so if invis, puts right one in. } if (isAgedCareResidentTypes) { e.Row.Cells[4].CssClass = "hiddencol"; // is always a 'Service' e.Row.Cells[8].CssClass = "hiddencol"; // is always 'A.C.Fac. Booking' e.Row.Cells[7].CssClass = "hiddencol"; // Yearly Visits Allowed e.Row.Cells[10].CssClass = "hiddencol"; // Service Time Mins e.Row.Cells[17].CssClass = "hiddencol"; // Max Claimable Nbr e.Row.Cells[18].CssClass = "hiddencol"; // Max Claimable Months e.Row.Cells[19].CssClass = "hiddencol"; // Reminder Letters - Months e.Row.Cells[20].CssClass = "hiddencol"; // Reminder Letter } } }
protected void ReverseBooking(bool runIt = true) // can use it to check if "able" to reverse a booking with argument false { UserView userView = UserView.GetInstance(); Booking booking = UrlBooking; if (booking == null) { throw new Exception("Invalid url field booking_id"); } string errorString = string.Empty; if (!booking.CanReverse(userView.IsAdminView, out errorString)) { throw new CustomMessageException(errorString); } if (runIt) { booking.Reverse(userView.IsAdminView, GetStaffID()); } }