public static void UpdateAllOtherStaffAsNotMainProviders(int organisation_id, int staff_id) { string sql = "UPDATE RegisterStaff SET main_provider_for_clinic = 0 WHERE organisation_id = " + organisation_id + " AND staff_id <> " + staff_id; DBBase.ExecuteNonResult(sql); }
public static void UpdateAllMedicare(decimal medicare_charge) { string sql = "UPDATE Offering SET medicare_charge = " + medicare_charge; DBBase.ExecuteNonResult(sql); }
protected void GrdReferrer_RowDataBound(object sender, GridViewRowEventArgs e) { DataTable dt = Session["referrerinfolist_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]; DropDownList ddlTitle = (DropDownList)e.Row.FindControl("ddlTitle"); if (ddlTitle != null) { DataTable titles = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Title", Convert.ToInt32(thisRow["title_id"]) == 0 ? "" : " title_id <> 0 ", " descr ", "title_id", "descr"); ddlTitle.DataSource = titles; ddlTitle.DataTextField = "descr"; ddlTitle.DataValueField = "title_id"; ddlTitle.DataBind(); ddlTitle.SelectedValue = thisRow["title_id"].ToString(); } DropDownList ddlGender = (DropDownList)e.Row.FindControl("ddlGender"); if (ddlGender != null) { if (thisRow["gender"].ToString() != "") { for (int i = ddlGender.Items.Count - 1; i >= 0; i--) { if (ddlGender.Items[i].Value == "") { ddlGender.Items.RemoveAt(i); } } } } if (ddlTitle != null && ddlGender != null) { ddlTitle.Attributes["onchange"] = "title_changed_reset_gender('" + ddlTitle.ClientID + "','" + ddlGender.ClientID + "');"; } HyperLink lnkContactInfo = (HyperLink)e.Row.FindControl("lnkContactInfo"); if (lnkContactInfo != null) { int entity_id = Convert.ToInt32(thisRow["organisation_entity_id"]); string addEditContactListPage; if (Utilities.GetAddressType().ToString() == "Contact") { addEditContactListPage = "AddEditContactList.aspx"; } else if (Utilities.GetAddressType().ToString() == "ContactAus") { addEditContactListPage = "ContactAusListV2.aspx"; } else { throw new Exception("Unknown AddressType in config: " + Utilities.GetAddressType().ToString().ToString()); } string allFeatures = "dialogWidth:525px;dialogHeight:430px;center:yes;resizable:no; scroll:no"; string js = "javascript:window.showModalDialog('" + addEditContactListPage + "?entity_type=referrer&id=" + entity_id.ToString() + "', '', '" + allFeatures + "');return false;"; lnkContactInfo.Visible = true; lnkContactInfo.NavigateUrl = " "; lnkContactInfo.Text = "Clinic Contact"; lnkContactInfo.Attributes.Add("onclick", js); } ImageButton btnDelete = (ImageButton)e.Row.FindControl("btnDelete"); if (btnDelete != null) { bool is_deleted = Convert.ToBoolean(thisRow["is_deleted"]); if (is_deleted) { btnDelete.CommandName = "_UnDelete"; btnDelete.ImageUrl = "~/images/tick-24.png"; btnDelete.AlternateText = "UnDelete"; btnDelete.ToolTip = "UnDelete"; } } Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { DataTable titles = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Title", " title_id <> 0 ", " descr ", "title_id", "descr"); DropDownList ddlTitle = (DropDownList)e.Row.FindControl("ddlNewTitle"); ddlTitle.DataSource = titles; ddlTitle.DataBind(); ddlTitle.SelectedIndex = Utilities.IndexOf(ddlTitle, "dr", "dr."); } }
public static bool Exists(int register_referrer_id) { string sql = "SELECT COUNT(*) FROM RegisterReferrer WHERE register_referrer_id = " + register_referrer_id.ToString(); return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql)) > 0); }
public static bool Exists(int offering_id) { string sql = "SELECT COUNT(*) FROM Offering WHERE offering_id = " + offering_id.ToString(); return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql)) > 0); }
public static DataTable GetDataTable_ByCreditID(int credit_id) { string sql = JoinedSql + " WHERE credit_history.credit_id = " + credit_id.ToString(); return(DBBase.ExecuteQuery(sql).Tables[0]); }
public static void UpdateActive(int register_referrer_id) { string sql = "UPDATE RegisterReferrer SET is_deleted = 0 WHERE register_referrer_id = " + register_referrer_id.ToString(); DBBase.ExecuteNonResult(sql); }
public static DataTable GetDataTable_ByEntityID(int entity_id, string note_type_ids = null, bool orderAsc = true, bool incDeleted = false) { string sql = JoniedSql + " WHERE n.entity_id = " + entity_id + (note_type_ids != null && note_type_ids.Length > 0 ? " AND n.note_type_id IN (" + note_type_ids + ")" : "") + (incDeleted ? "" : " AND deleted_by IS NULL AND date_deleted IS NULL") + (orderAsc ? "" : " ORDER BY n.note_id DESC "); return(DBBase.ExecuteQuery(sql).Tables[0]); }
public static bool HasNotes(int entity_id) { string sql = "SELECT COUNT(*) FROM Note WHERE entity_id = " + entity_id; return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql)) > 0); }
public static bool Exists(int staff_id, int site_id) { string sql = "SELECT COUNT(*) FROM StaffSiteRestriction WHERE staff_id = " + staff_id + " AND site_id = " + site_id; return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql)) > 0); }
public static DataTable GetDataTable(bool incDeleted = false) { string sql = JoniedSql + (incDeleted ? "" : " WHERE deleted_by IS NULL AND date_deleted IS NULL"); return(DBBase.ExecuteQuery(sql).Tables[0]); }
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"); 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); 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(); }
protected void GrdStaff_RowDataBound(object sender, GridViewRowEventArgs e) { DataTable fields = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Field", "field_id <> 0", "descr", "field_id", "descr"); DataTable costcentres = CostCentreDB.GetDataTable(); DataTable positions = StaffPositionDB.GetDataTable(); DataTable dt = Session["staffinfo_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("staff_id=" + lblId.Text); DataRow thisRow = foundRows[0]; DropDownList ddlTitle = (DropDownList)e.Row.FindControl("ddlTitle"); if (ddlTitle != null) { DataTable titles = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Title", Convert.ToInt32(thisRow["title_id"]) == 0 ? "" : " title_id <> 0 ", " descr ", "title_id", "descr"); ddlTitle.DataSource = titles; ddlTitle.DataTextField = "descr"; ddlTitle.DataValueField = "title_id"; ddlTitle.DataBind(); ddlTitle.SelectedValue = thisRow["title_id"].ToString(); } DropDownList ddlGender = (DropDownList)e.Row.FindControl("ddlGender"); if (ddlGender != null) { if (thisRow["gender"].ToString() != "") { for (int i = ddlGender.Items.Count - 1; i >= 0; i--) { if (ddlGender.Items[i].Value == "") { ddlGender.Items.RemoveAt(i); } } } } if (ddlTitle != null && ddlGender != null) { ddlTitle.Attributes["onchange"] = "title_changed_reset_gender('" + ddlTitle.ClientID + "','" + ddlGender.ClientID + "');"; } DropDownList ddlDOB_Day = (DropDownList)e.Row.FindControl("ddlDOB_Day"); DropDownList ddlDOB_Month = (DropDownList)e.Row.FindControl("ddlDOB_Month"); DropDownList ddlDOB_Year = (DropDownList)e.Row.FindControl("ddlDOB_Year"); if (ddlDOB_Day != null && ddlDOB_Month != null && ddlDOB_Year != null) { ddlDOB_Day.Items.Add(new ListItem("--", "-1")); ddlDOB_Month.Items.Add(new ListItem("--", "-1")); ddlDOB_Year.Items.Add(new ListItem("----", "-1")); for (int i = 1; i <= 31; i++) { ddlDOB_Day.Items.Add(new ListItem(i.ToString(), i.ToString())); } for (int i = 1; i <= 12; i++) { ddlDOB_Month.Items.Add(new ListItem(i.ToString(), i.ToString())); } for (int i = 1915; i <= DateTime.Today.Year; i++) { ddlDOB_Year.Items.Add(new ListItem(i.ToString(), i.ToString())); } if (thisRow["dob"] != DBNull.Value) { DateTime dob = Convert.ToDateTime(thisRow["dob"]); ddlDOB_Day.SelectedValue = dob.Day.ToString(); ddlDOB_Month.SelectedValue = dob.Month.ToString(); int firstYearSelectable = Convert.ToInt32(ddlDOB_Year.Items[1].Value); int lastYearSelectable = Convert.ToInt32(ddlDOB_Year.Items[ddlDOB_Year.Items.Count - 1].Value); if (dob.Year < firstYearSelectable) { ddlDOB_Year.Items.Insert(1, new ListItem(dob.Year.ToString(), dob.Year.ToString())); } if (dob.Year > lastYearSelectable) { ddlDOB_Year.Items.Add(new ListItem(dob.Year.ToString(), dob.Year.ToString())); } ddlDOB_Year.SelectedValue = dob.Year.ToString(); } } TextBox txtPwd = (TextBox)e.Row.FindControl("txtPwd"); if (txtPwd != null) { txtPwd.Attributes["value"] = thisRow["pwd"].ToString(); } DropDownList ddlPosition = (DropDownList)e.Row.FindControl("ddlStaffPosition"); if (ddlPosition != null) { ddlPosition.DataSource = positions; ddlPosition.DataTextField = "descr"; ddlPosition.DataValueField = "staff_position_id"; ddlPosition.DataBind(); ddlPosition.SelectedValue = thisRow["staff_position_id"].ToString(); } DropDownList ddlField = (DropDownList)e.Row.FindControl("ddlField"); if (ddlField != null) { ddlField.DataSource = fields; ddlField.DataTextField = "descr"; ddlField.DataValueField = "field_id"; ddlField.DataBind(); if (ddlField.Items.FindByValue(thisRow["field_id"].ToString()) == null) { ddlField.Items.Add(new ListItem(thisRow["field_descr"].ToString(), thisRow["field_id"].ToString())); } ddlField.SelectedValue = thisRow["field_id"].ToString(); } DropDownList ddlCostCentre = (DropDownList)e.Row.FindControl("ddlCostCentre"); if (ddlCostCentre != null) { ddlCostCentre.DataSource = costcentres; ddlCostCentre.DataTextField = "descr"; ddlCostCentre.DataValueField = "costcentre_id"; ddlCostCentre.DataBind(); ddlCostCentre.SelectedValue = thisRow["costcentre_id"].ToString(); } bool is_fired = Convert.ToBoolean(thisRow["is_fired"]); DropDownList ddlStatus = (DropDownList)e.Row.FindControl("ddlStatus"); if (ddlStatus != null) { if (is_fired) { ddlStatus.SelectedValue = "Inactive"; } else { ddlStatus.SelectedValue = "Active"; } } Label lblIsFired = (Label)e.Row.FindControl("lblIsFired"); if (is_fired) { e.Row.ForeColor = System.Drawing.Color.Gray; if (lblIsFired != null) { lblIsFired.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) { DataTable titles = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Title", " title_id <> 0 ", " descr ", "title_id", "descr"); DropDownList ddlTitle = (DropDownList)e.Row.FindControl("ddlNewTitle"); ddlTitle.DataSource = titles; ddlTitle.DataBind(); ddlTitle.SelectedIndex = Utilities.IndexOf(ddlTitle, "mr", "mr."); DropDownList ddlNewStaffPosition = (DropDownList)e.Row.FindControl("ddlNewStaffPosition"); ddlNewStaffPosition.DataSource = positions; ddlNewStaffPosition.DataBind(); DropDownList ddlNewField = (DropDownList)e.Row.FindControl("ddlNewField"); ddlNewField.DataSource = fields; ddlNewField.DataBind(); DropDownList ddlNewCostCentre = (DropDownList)e.Row.FindControl("ddlNewCostCentre"); ddlNewCostCentre.DataSource = costcentres; ddlNewCostCentre.DataBind(); } }
public static bool IsStaffWorkingInOrg(int staff_id, int organisation_id, bool inc_deleted = true) { string sql = "SELECT COUNT(*) FROM RegisterStaff WHERE " + (inc_deleted ? "" : " is_deleted = 0 AND ") + " staff_id = " + staff_id.ToString() + " AND organisation_id = " + organisation_id.ToString(); return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql)) > 0); }
protected void GrdContactType_RowDataBound(object sender, GridViewRowEventArgs e) { DataTable groups = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "ContactTypeGroup", "", "descr", "contact_type_group_id", "descr"); DataTable dt_contact_type = Session["contacttype_data"] as DataTable; bool tblEmpty = (dt_contact_type.Rows.Count == 1 && dt_contact_type.Rows[0][0] == DBNull.Value); if (!tblEmpty && e.Row.RowType == DataControlRowType.DataRow) { Label lblId = (Label)e.Row.FindControl("lblContactTypeId"); DataRow[] foundRows = dt_contact_type.Select("at_contact_type_id=" + lblId.Text); DataRow thisRow = foundRows[0]; DropDownList ddlContactTypeGroup = (DropDownList)e.Row.FindControl("ddlContactTypeGroup"); if (ddlContactTypeGroup != null) { foreach (DataRow row in groups.Rows) { ddlContactTypeGroup.Items.Add(new ListItem(row["descr"].ToString(), row["contact_type_group_id"].ToString())); } ddlContactTypeGroup.SelectedValue = Convert.ToString(thisRow["at_contact_type_group_id"]); } DropDownList ddlDisplayOrder = (DropDownList)e.Row.FindControl("ddlDisplayOrder"); if (ddlDisplayOrder != null) { int lowest_display_order = 0; int highest_display_order = 50; int display_order = Convert.ToInt32(thisRow["at_display_order"]); if (display_order < lowest_display_order) { ddlDisplayOrder.Items.Add(new ListItem(display_order.ToString(), display_order.ToString())); } for (int i = lowest_display_order; i <= highest_display_order; i++) { ddlDisplayOrder.Items.Add(new ListItem(i.ToString(), i.ToString())); } if (display_order > highest_display_order) { ddlDisplayOrder.Items.Add(new ListItem(display_order.ToString(), display_order.ToString())); } ddlDisplayOrder.SelectedValue = display_order.ToString(); } Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlContactTypeGroup = (DropDownList)e.Row.FindControl("ddlNewContactTypeGroup"); foreach (DataRow row in groups.Rows) { ddlContactTypeGroup.Items.Add(new ListItem(row["descr"].ToString(), row["contact_type_group_id"].ToString())); } DropDownList ddlDisplayOrder = (DropDownList)e.Row.FindControl("ddlNewDisplayOrder"); for (int i = 0; i <= 50; i++) { ddlDisplayOrder.Items.Add(new ListItem(i.ToString(), i.ToString())); } } }
public static void DeleteByEntityID(int entity_id) { string sql = "DELETE Note WHERE entity_id = " + entity_id; DBBase.ExecuteNonResult(sql); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (SiteDB.GetSiteByType(SiteDB.SiteType.AgedCare) != null) { HideTableAndSetErrorMessage("Aged Care Site Already Exists"); return; } string errMsg = string.Empty; txtACSiteName.Text = Utilities.FormatName(txtACSiteName.Text.Trim()); if (txtACSiteName.Text == string.Empty) { errMsg += (errMsg.Length == 0 ? "" : "<br />") + "Site Name is required"; } if (errMsg.Length > 0) { SetErrorMessage(errMsg); return; } try { string sql = @" Declare @entity_id int INSERT INTO Entity DEFAULT VALUES; SET @entity_id = SCOPE_IDENTITY() SET IDENTITY_INSERT Site ON INSERT INTO Site ( site_id, entity_id, name, 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, site_type_id ) VALUES ( 2, @entity_id, '" + txtACSiteName.Text + @"', '', '', '', '', 0, '', '', '', '', '', 0.00, 1, 0, 0, 0, 0, 0, 0, 0, '08:00:00.0000000', '00:00:00.0000000', '00:00:00.0000000', '22:00:00.0000000', '2014-06-30 00:00:00.000', 54, 2 ) SET IDENTITY_INSERT Site OFF "; DBBase.ExecuteNonResult(sql); HideTableAndSetErrorMessage("Site Added!<br /><br /><font color=\"blue\"><center><table style=\"text-align:left;max-width:520px;\"><tr><td><ol><li>Logout and then log back in so the 'change site' link is showing</li><li>Go into the new AC site</li><li>Go to menu <b><u>Letters</u></b> ⇨ <b><u>Treatment Letters</u></b></li><li>Add a row for each profession until the row where you add is no longer showing (indicating there exists a row for all professions already)<br /><br /></li><li>You may also need to add <u>AC invoice</u> and <u>AC Overdue Invoice</u> templates in the letters page</li></ol></td></tr></table></center></font>"); SetupGUI(); } catch (CustomMessageException ex) { SetErrorMessage(ex.Message); } catch (Exception ex) { SetErrorMessage("", ex.ToString()); } }
public static int GetCountByEntityID(int entity_id) { string sql = "SELECT COUNT(*) FROM Note WHERE entity_id = " + entity_id; return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql))); }
public static string[] BulkGetAllTreatmentNotes(DateTime date_start, DateTime date_end, string newline = "\n", bool incNoteIDForDebug = false) { string recurring_condition = string.Empty; string non_recurring_condition = string.Empty; if (date_start != DateTime.MinValue && date_end != DateTime.MinValue) { recurring_condition = "AND ( booking.date_start >= '" + date_start.ToString("yyyy-MM-dd HH:mm:ss") + "' AND booking.date_end <= '" + date_end.ToString("yyyy-MM-dd HH:mm:ss") + @"' )"; non_recurring_condition = "AND ( booking.date_end IS NULL OR booking.date_end > '" + date_start.Date.ToString("yyyy-MM-dd HH:mm:ss") + "') " + (date_end == DateTime.MinValue ? "" : " AND booking.date_start < '" + date_end.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss") + "'") + @""; } else if (date_start != DateTime.MinValue) { recurring_condition = "AND ( booking.date_start >= '" + date_start.ToString("yyyy-MM-dd HH:mm:ss") + "')"; non_recurring_condition = "AND ( booking.date_end IS NULL OR booking.date_end > '" + date_start.Date.ToString("yyyy-MM-dd HH:mm:ss") + "') " + @""; } else if (date_end != DateTime.MinValue) { recurring_condition = "AND ( booking.date_end <= '" + date_end.ToString("yyyy-MM-dd HH:mm:ss") + @"' )"; non_recurring_condition = "AND ( booking.date_start < '" + date_end.Date.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss") + @"' )"; } else { recurring_condition = ""; non_recurring_condition = ""; } string sql = @" SELECT note.note_id as note_note_id, note.entity_id as note_entity_id, note.note_type_id as note_note_type_id, note.body_part_id as note_body_part_id, note.text as note_text, note.date_added as note_date_added, note.date_modified as note_date_modified, note.added_by as note_added_by, note.modified_by as note_modified_by, note.site_id as note_site_id, booking.booking_id as booking_booking_id,booking.entity_id as booking_entity_id, booking.date_start as booking_date_start,booking.date_end as booking_date_end,booking.organisation_id as booking_organisation_id, booking.provider as booking_provider,booking.patient_id as booking_patient_id,booking.offering_id as booking_offering_id,booking.booking_type_id as booking_booking_type_id, booking.booking_status_id as booking_booking_status_id,booking.booking_unavailability_reason_id as booking_booking_unavailability_reason_id,booking.added_by as booking_added_by,booking.date_created as booking_date_created, booking.booking_confirmed_by_type_id as booking_booking_confirmed_by_type_id,booking.confirmed_by as booking_confirmed_by,booking.date_confirmed as booking_date_confirmed, booking.deleted_by as booking_deleted_by, booking.date_deleted as booking_date_deleted, booking.cancelled_by as booking_cancelled_by, booking.date_cancelled as booking_date_cancelled, booking.is_patient_missed_appt as booking_is_patient_missed_appt,booking.is_provider_missed_appt as booking_is_provider_missed_appt, booking.is_emergency as booking_is_emergency, booking.need_to_generate_first_letter as booking_need_to_generate_first_letter,booking.need_to_generate_last_letter as booking_need_to_generate_last_letter,booking.has_generated_system_letters as booking_has_generated_system_letters, booking.arrival_time as booking_arrival_time, booking.sterilisation_code as booking_sterilisation_code, booking.informed_consent_added_by as booking_informed_consent_added_by, booking.informed_consent_date as booking_informed_consent_date, booking.is_recurring as booking_is_recurring,booking.recurring_weekday_id as booking_recurring_weekday_id, booking.recurring_start_time as booking_recurring_start_time,booking.recurring_end_time as booking_recurring_end_time, (SELECT 0) AS booking_note_count, (SELECT 0) AS booking_inv_count, patient.patient_id as patient_patient_id, patient.person_id as patient_person_id, patient.patient_date_added as patient_patient_date_added, patient.is_clinic_patient as patient_is_clinic_patient,patient.is_gp_patient as patient_is_gp_patient,patient.is_deleted as patient_is_deleted,patient.is_deceased as patient_is_deceased, patient.flashing_text as patient_flashing_text, patient.flashing_text_added_by as patient_flashing_text_added_by, patient.flashing_text_last_modified_date as patient_flashing_text_last_modified_date, patient.private_health_fund as patient_private_health_fund, patient.concession_card_number as patient_concession_card_number, patient.concession_card_expiry_date as patient_concession_card_expiry_date, patient.is_diabetic as patient_is_diabetic, patient.is_member_diabetes_australia as patient_is_member_diabetes_australia, patient.diabetic_assessment_review_date as patient_diabetic_assessment_review_date, patient.ac_inv_offering_id as patient_ac_inv_offering_id, patient.ac_pat_offering_id as patient_ac_pat_offering_id, patient.login as patient_login, patient.pwd as patient_pwd, patient.is_company as patient_is_company, patient.abn as patient_abn, patient.next_of_kin_name as patient_next_of_kin_name, patient.next_of_kin_relation as patient_next_of_kin_relation, patient.next_of_kin_contact_info as patient_next_of_kin_contact_info, " + PersonDB.GetFields("person_patient_", "person_patient") + @", title_patient.title_id as title_patient_title_id, title_patient.descr as title_patient_descr, rr.register_referrer_id as rr_register_referrer_id, rr.organisation_id as rr_organisation_id, rr.referrer_id as rr_referrer_id, rr.provider_number as rr_provider_number, rr.report_every_visit_to_referrer as rr_report_every_visit_to_referrer, rr.batch_send_all_patients_treatment_notes as rr_batch_send_all_patients_treatment_notes, rr.date_last_batch_send_all_patients_treatment_notes as rr_date_last_batch_send_all_patients_treatment_notes, rr.register_referrer_date_added as rr_register_referrer_date_added, rr.is_deleted as rr_is_deleted, ref.referrer_id as ref_referrer_id, ref.person_id as ref_person_id, ref.referrer_date_added as ref_referrer_date_added, " + PersonDB.GetFields("p_", "p") + @", t.title_id as t_title_id, t.descr as t_descr FROM Note note INNER JOIN Booking booking ON booking.entity_id = note.entity_id INNER JOIN Patient patient ON patient.patient_id = booking.patient_id INNER JOIN Person person_patient ON person_patient.person_id = patient.person_id INNER JOIN Title title_patient ON title_patient.title_id = person_patient.title_id INNER Join PatientReferrer patient_referrer ON patient_referrer.patient_id = patient.patient_id INNER Join RegisterReferrer rr ON rr.register_referrer_id = patient_referrer.register_referrer_id INNER JOIN Referrer ref ON ref.referrer_id = rr.referrer_id INNER JOIN Person p ON p.person_id = ref.person_id INNER JOIN Title t ON t.title_id = p.title_id WHERE note.note_type_id = 252 -- only provider treatment notes AND booking.booking_status_id = 187 -- only get completed bookings AND booking.booking_type_id = 34 -- only get bookings for patients (not blockout-prov/org-timeslot bookings) AND ( (booking.is_recurring = 0 " + recurring_condition + @") OR (booking.is_recurring = 1 " + non_recurring_condition + @") ) AND rr.is_deleted = 0 AND rr.batch_send_all_patients_treatment_notes = 1 ORDER BY rr.register_referrer_id, person_patient.surname, person_patient.firstname, booking.date_start, note.note_id "; DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0]; string[] notes = new string[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { Booking booking = BookingDB.Load(tbl.Rows[i], "booking_"); booking.Patient = PatientDB.Load(tbl.Rows[i], "patient_"); booking.Patient.Person = PersonDB.Load(tbl.Rows[i], "person_patient_"); booking.Patient.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_patient_title_id", "title_patient_descr"); Note note = NoteDB.Load(tbl.Rows[i], "note_"); RegisterReferrer rr = RegisterReferrerDB.Load(tbl.Rows[i], "rr_"); rr.Referrer = ReferrerDB.Load(tbl.Rows[i], "ref_"); rr.Referrer.Person = PersonDB.Load(tbl.Rows[i], "p_"); rr.Referrer.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "t_title_id", "t_descr"); notes[i] = booking.GetNoteTextForTreatmentLetter(rr.Referrer, note, newline, incNoteIDForDebug); } return(notes); }
protected void GrdOffering_RowDataBound(object sender, GridViewRowEventArgs e) { DataTable offeringTypes = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "OfferingType", "offering_type_id <> 90", "", "offering_type_id", "descr"); DataTable fields = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "Field", "has_offerings = 1", "descr", "field_id", "descr"); DataTable offeringPatientSubcategories = DBBase.GetGenericDataTable(null, "AgedCarePatientType", "aged_care_patient_type_id", "descr"); DataTable offeringInvoiceTypes = DBBase.GetGenericDataTable(null, "OfferingInvoiceType", "offering_invoice_type_id", "descr"); DataTable letters = LetterDB.GetDataTable_ByLetterType(391); int BookingScreenDefaultServiceID = Convert.ToInt32(SystemVariableDB.GetByDescr("BookingScreenDefaultServiceID").Value); // move 'None' item to the top for (int i = 0; i < fields.Rows.Count; i++) { if (fields.Rows[i]["descr"].ToString() != "None") { continue; } DataRow newRow = fields.NewRow(); newRow.ItemArray = fields.Rows[i].ItemArray; fields.Rows.RemoveAt(i); fields.Rows.InsertAt(newRow, 0); break; } DataTable dt = Session["offeringinfo_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("o_offering_id=" + lblId.Text); DataRow thisRow = foundRows[0]; int offering_id = Convert.ToInt32(thisRow["o_offering_id"]); TextBox txtName = (TextBox)e.Row.FindControl("txtName"); if (txtName != null) { if (Session["DB"] != null && Session["DB"].ToString() == "Mediclinic_0040") { txtName.MaxLength = 2000; txtName.TextMode = TextBoxMode.MultiLine; } else if (thisRow["o_name"].ToString().Contains(Environment.NewLine)) { txtName.TextMode = TextBoxMode.MultiLine; } } DropDownList ddlOfferingType = (DropDownList)e.Row.FindControl("ddlOfferingType"); if (ddlOfferingType != null) { ddlOfferingType.DataSource = offeringTypes; ddlOfferingType.DataTextField = "descr"; ddlOfferingType.DataValueField = "offering_type_id"; ddlOfferingType.DataBind(); ddlOfferingType.SelectedValue = thisRow["o_offering_type_id"].ToString(); } DropDownList ddlField = (DropDownList)e.Row.FindControl("ddlField"); if (ddlField != null) { ddlField.DataSource = fields; ddlField.DataTextField = "descr"; ddlField.DataValueField = "field_id"; ddlField.DataBind(); ddlField.SelectedValue = thisRow["o_field_id"].ToString(); } DropDownList ddlOfferingPatientSubcategory = (DropDownList)e.Row.FindControl("ddlOfferingPatientSubcategory"); if (ddlOfferingPatientSubcategory != null) { ddlOfferingPatientSubcategory.DataSource = offeringPatientSubcategories; ddlOfferingPatientSubcategory.DataTextField = "descr"; ddlOfferingPatientSubcategory.DataValueField = "aged_care_patient_type_id"; ddlOfferingPatientSubcategory.DataBind(); ddlOfferingPatientSubcategory.SelectedValue = thisRow["o_aged_care_patient_type_id"].ToString(); } DropDownList ddlOfferingInvoiceType = (DropDownList)e.Row.FindControl("ddlOfferingInvoiceType"); if (ddlOfferingInvoiceType != null) { if (IsValidFormInvType()) { IDandDescr invType = GetFormInvType(); ddlOfferingInvoiceType.Items.Add(new ListItem(invType.Descr, invType.ID.ToString())); } else { string v = thisRow["o_offering_invoice_type_id"].ToString(); ddlOfferingInvoiceType.DataSource = offeringInvoiceTypes; ddlOfferingInvoiceType.DataTextField = "descr"; ddlOfferingInvoiceType.DataValueField = "offering_invoice_type_id"; ddlOfferingInvoiceType.DataBind(); ddlOfferingInvoiceType.SelectedValue = thisRow["o_offering_invoice_type_id"].ToString(); } } DropDownList ddlServiceTimeMinutes = (DropDownList)e.Row.FindControl("ddlServiceTimeMinutes"); if (ddlServiceTimeMinutes != null) { ddlServiceTimeMinutes.Items.AddRange(GetListOfTimes()); int valueToSelect = Convert.ToInt32(dt.Rows[e.Row.RowIndex]["o_service_time_minutes"]); if (ddlServiceTimeMinutes.Items.FindByValue(valueToSelect.ToString()) != null) { ddlServiceTimeMinutes.SelectedValue = valueToSelect.ToString(); } else { ddlServiceTimeMinutes.Items.Clear(); ddlServiceTimeMinutes.Items.AddRange(GetListOfTimes(valueToSelect)); ddlServiceTimeMinutes.SelectedValue = valueToSelect.ToString(); } } DropDownList ddlNumClinicVisitsAllowedPerYear = (DropDownList)e.Row.FindControl("ddlNumClinicVisitsAllowedPerYear"); if (ddlNumClinicVisitsAllowedPerYear != null) { for (int i = 0; i < 6; i++) { ddlNumClinicVisitsAllowedPerYear.Items.Add(new ListItem(i.ToString(), i.ToString())); } ddlNumClinicVisitsAllowedPerYear.SelectedValue = thisRow["o_num_clinic_visits_allowed_per_year"].ToString(); } DropDownList ddlMaxNbrClaimable = (DropDownList)e.Row.FindControl("ddlMaxNbrClaimable"); if (ddlMaxNbrClaimable != null) { for (int i = 0; i < 10; i++) { ddlMaxNbrClaimable.Items.Add(new ListItem(i.ToString(), i.ToString())); } ddlMaxNbrClaimable.SelectedValue = thisRow["o_max_nbr_claimable"].ToString(); } DropDownList ddlMaxNbrClaimableMonths = (DropDownList)e.Row.FindControl("ddlMaxNbrClaimableMonths"); if (ddlMaxNbrClaimableMonths != null) { for (int i = 0; i <= 24; i++) { ddlMaxNbrClaimableMonths.Items.Add(new ListItem(i.ToString(), i.ToString())); } ddlMaxNbrClaimableMonths.SelectedValue = thisRow["o_max_nbr_claimable_months"].ToString(); } DropDownList ddlReminderLetterMonthsLaterToSend = (DropDownList)e.Row.FindControl("ddlReminderLetterMonthsLaterToSend"); if (ddlReminderLetterMonthsLaterToSend != null) { for (int i = 0; i <= 24; i++) { ddlReminderLetterMonthsLaterToSend.Items.Add(new ListItem((i == 0 ? "Disabled" : i.ToString()), i.ToString())); } ddlReminderLetterMonthsLaterToSend.SelectedValue = thisRow["o_reminder_letter_months_later_to_send"].ToString(); } DropDownList ddlReminderLetter = (DropDownList)e.Row.FindControl("ddlReminderLetter"); if (ddlReminderLetter != null) { ddlReminderLetter.Items.Add(new ListItem("--", "-1")); for (int i = 0; i < letters.Rows.Count; i++) { ddlReminderLetter.Items.Add(new ListItem(letters.Rows[i]["letter_docname"].ToString(), letters.Rows[i]["letter_letter_id"].ToString())); } if (thisRow["o_reminder_letter_id"] != DBNull.Value) { ddlReminderLetter.SelectedValue = thisRow["o_reminder_letter_id"].ToString(); } } Label lblReminderLetter = (Label)e.Row.FindControl("lblReminderLetter"); if (lblReminderLetter != null) { if (thisRow["o_reminder_letter_id"] == DBNull.Value) { lblReminderLetter.Text = string.Empty; } else { for (int i = 0; i < letters.Rows.Count; i++) { if (Convert.ToInt32(letters.Rows[i]["letter_letter_id"]) == Convert.ToInt32(thisRow["o_reminder_letter_id"])) { lblReminderLetter.Text = letters.Rows[i]["letter_docname"].ToString(); break; } } } } ImageButton lnkPopupMessage = (ImageButton)e.Row.FindControl("lnkPopupMessage"); if (lnkPopupMessage != null) { string allFeatures = "dialogWidth:550px;dialogHeight:400px;center:yes;resizable:no; scroll:no"; string js = "javascript:window.showModalDialog('OfferingPopupMessageDetailV2.aspx?type=edit&id=" + offering_id.ToString() + "', '', '" + allFeatures + "');return false;"; lnkPopupMessage.Visible = true; lnkPopupMessage.PostBackUrl = " "; lnkPopupMessage.Attributes.Add("onclick", js); } ImageButton btnDelete = (ImageButton)e.Row.FindControl("btnDelete"); if (btnDelete != null) { bool is_deleted = Convert.ToBoolean(thisRow["o_is_deleted"]); if (is_deleted) { btnDelete.CommandName = "_UnDelete"; btnDelete.ImageUrl = "~/images/tick-24.png"; btnDelete.AlternateText = "UnDelete"; btnDelete.ToolTip = "UnDelete"; } } LinkButton lnkUpdate = (LinkButton)e.Row.FindControl("lnkUpdate"); if (lnkUpdate != null) { TextBox txtMedicareCharge = (TextBox)e.Row.FindControl("txtMedicareCharge"); TextBox txtDvaCharge = (TextBox)e.Row.FindControl("txtDvaCharge"); TextBox txtTacCharge = (TextBox)e.Row.FindControl("txtTacCharge"); lnkUpdate.OnClientClick = "set_if_empty_price(document.getElementById('" + txtMedicareCharge.ClientID + "'),document.getElementById('" + txtDvaCharge.ClientID + "'),document.getElementById('" + txtTacCharge.ClientID + "'));"; } Image imgBookingScreenDefaultService = (Image)e.Row.FindControl("imgBookingScreenDefaultService"); imgBookingScreenDefaultService.Visible = offering_id == BookingScreenDefaultServiceID; LinkButton btnSetAsBookingScreenDefaultService = (LinkButton)e.Row.FindControl("btnSetAsBookingScreenDefaultService"); btnSetAsBookingScreenDefaultService.Visible = offering_id != BookingScreenDefaultServiceID; Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlOfferingType = (DropDownList)e.Row.FindControl("ddlNewOfferingType"); ddlOfferingType.DataSource = offeringTypes; ddlOfferingType.DataBind(); DropDownList ddlField = (DropDownList)e.Row.FindControl("ddlNewField"); ddlField.DataSource = fields; ddlField.DataBind(); DropDownList ddlOfferingPatientSubcategory = (DropDownList)e.Row.FindControl("ddlNewOfferingPatientSubcategory"); ddlOfferingPatientSubcategory.DataSource = offeringPatientSubcategories; ddlOfferingPatientSubcategory.DataBind(); bool isAgedCareResidentTypes = IsValidIsAgedCareResidentTypes() ? GetFormIsAgedCareResidentTypes() : false; if (isAgedCareResidentTypes) { ddlOfferingPatientSubcategory.Items.RemoveAt(0); } DropDownList ddlOfferingInvoiceType = (DropDownList)e.Row.FindControl("ddlNewOfferingInvoiceType"); if (IsValidFormInvType()) { IDandDescr invType = GetFormInvType(); ddlOfferingInvoiceType.Items.Add(new ListItem(invType.Descr, invType.ID.ToString())); } else { //ddlOfferingInvoiceType.DataSource = offeringInvoiceTypes; //ddlOfferingInvoiceType.DataBind(); foreach (DataRow row in offeringInvoiceTypes.Rows) { if (row["offering_invoice_type_id"].ToString() != "0") { ddlOfferingInvoiceType.Items.Add(new ListItem(row["descr"].ToString(), row["offering_invoice_type_id"].ToString())); } } ddlOfferingInvoiceType.SelectedValue = UserView.GetInstance().IsClinicView ? "1" : "4"; // 1 = clinics, 4 = aged care } DropDownList ddlServiceTimeMinutes = (DropDownList)e.Row.FindControl("ddlNewServiceTimeMinutes"); for (int i = 0; i < 20; i++) { ddlServiceTimeMinutes.Items.Add(new ListItem(i.ToString(), i.ToString())); } for (int i = 20; i <= 90; i++) { if (i % 5 == 0) { ddlServiceTimeMinutes.Items.Add(new ListItem(i.ToString(), i.ToString())); } } for (int i = 91; i <= 480; i++) { if (i % 30 == 0) { ddlServiceTimeMinutes.Items.Add(new ListItem(i.ToString(), i.ToString())); } } DropDownList ddlNumClinicVisitsAllowedPerYear = (DropDownList)e.Row.FindControl("ddlNewNumClinicVisitsAllowedPerYear"); if (ddlNumClinicVisitsAllowedPerYear != null) { for (int i = 0; i < 6; i++) { ddlNumClinicVisitsAllowedPerYear.Items.Add(new ListItem(i.ToString(), i.ToString())); } } DropDownList ddlMaxNbrClaimable = (DropDownList)e.Row.FindControl("ddlNewMaxNbrClaimable"); for (int i = 0; i < 10; i++) { ddlMaxNbrClaimable.Items.Add(new ListItem(i.ToString(), i.ToString())); } DropDownList ddlMaxNbrClaimableMonths = (DropDownList)e.Row.FindControl("ddlNewMaxNbrClaimableMonths"); for (int i = 0; i <= 24; i++) { ddlMaxNbrClaimableMonths.Items.Add(new ListItem(i.ToString(), i.ToString())); } DropDownList ddlReminderLetterMonthsLaterToSend = (DropDownList)e.Row.FindControl("ddlNewReminderLetterMonthsLaterToSend"); for (int i = 0; i <= 24; i++) { ddlReminderLetterMonthsLaterToSend.Items.Add(new ListItem((i == 0 ? "Disabled" : i.ToString()), i.ToString())); } DropDownList ddlReminderLetter = (DropDownList)e.Row.FindControl("ddlNewReminderLetter"); ddlReminderLetter.Items.Add(new ListItem("--", "-1")); for (int i = 0; i < letters.Rows.Count; i++) { ddlReminderLetter.Items.Add(new ListItem(letters.Rows[i]["letter_docname"].ToString(), letters.Rows[i]["letter_letter_id"].ToString())); } LinkButton lnkAdd = (LinkButton)e.Row.FindControl("lnkAdd"); TextBox txtMedicareCharge = (TextBox)e.Row.FindControl("txtNewMedicareCharge"); TextBox txtDvaCharge = (TextBox)e.Row.FindControl("txtNewDvaCharge"); TextBox txtTacCharge = (TextBox)e.Row.FindControl("txtNewTacCharge"); lnkAdd.OnClientClick = "set_if_empty_price(document.getElementById('" + txtMedicareCharge.ClientID + "'),document.getElementById('" + txtDvaCharge.ClientID + "'),document.getElementById('" + txtTacCharge.ClientID + "'));"; } }
public static void UpdateLastBatchSendAllPatientsTreatmentNotes_All(DateTime date_last_batch_send_all_patients_treatment_notes) { string sql = "UPDATE RegisterReferrer SET date_last_batch_send_all_patients_treatment_notes = " + (date_last_batch_send_all_patients_treatment_notes == DateTime.MinValue ? "NULL" : "'" + date_last_batch_send_all_patients_treatment_notes.ToString("yyyy-MM-dd HH:mm:ss") + "'") + " WHERE batch_send_all_patients_treatment_notes = 1"; DBBase.ExecuteNonResult(sql); }
public static int Insert(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) { string sql = "INSERT INTO Referral (health_card_id,medical_service_type_id,register_referrer_id,date_referral_signed,date_referral_received_in_office,added_or_last_modified_by,added_or_last_modified_date,deleted_by,date_deleted) VALUES (" + "" + health_card_id + "," + "" + medical_service_type_id + "," + (register_referrer_id == -1 ? "NULL" : register_referrer_id.ToString()) + "," + (date_referral_signed == DateTime.MinValue ? "null" : "'" + date_referral_signed.ToString("yyyy-MM-dd HH:mm:ss") + "'") + "," + (date_referral_received_in_office == DateTime.MinValue ? "null" : "'" + date_referral_received_in_office.ToString("yyyy-MM-dd HH:mm:ss") + "'") + "," + added_or_last_modified_by + "," + "'" + added_or_last_modified_date.ToString("yyyy-MM-dd HH:mm:ss") + "'," + (deleted_by == -1 ? "NULL" : deleted_by.ToString()) + "," + (date_deleted == DateTime.MinValue ? "null" : "'" + date_deleted.ToString("yyyy-MM-dd HH:mm:ss") + "'") + ");SELECT SCOPE_IDENTITY();"; return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql))); }
public static bool Exists(int organisation_id, int referrer_id, int register_referrer_id_exclude = -1) { string sql = "SELECT COUNT(*) FROM RegisterReferrer WHERE organisation_id = " + organisation_id + " AND referrer_id = " + referrer_id + (register_referrer_id_exclude == -1 ? "" : " AND register_referrer_id <> " + register_referrer_id_exclude.ToString()); return(Convert.ToInt32(DBBase.ExecuteSingleResult(sql)) > 0); }
public static void Update(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) { string sql = "UPDATE Referral SET health_card_id = " + health_card_id + ",medical_service_type_id = " + medical_service_type_id + ",register_referrer_id = " + (register_referrer_id == -1 ? "NULL" : register_referrer_id.ToString()) + ",date_referral_signed = " + (date_referral_signed == DateTime.MinValue ? "null" : "'" + date_referral_signed.ToString("yyyy-MM-dd HH:mm:ss") + "'") + ",date_referral_received_in_office = " + (date_referral_received_in_office == DateTime.MinValue ? "null" : "'" + date_referral_received_in_office.ToString("yyyy-MM-dd HH:mm:ss") + "'") + ",added_or_last_modified_by = " + added_or_last_modified_by + ",added_or_last_modified_date = '" + added_or_last_modified_date.ToString("yyyy-MM-dd HH:mm:ss") + "',deleted_by = " + (deleted_by == -1 ? "NULL" : deleted_by.ToString()) + ",date_deleted = " + (date_deleted == DateTime.MinValue ? "null" : "'" + date_deleted.ToString("yyyy-MM-dd HH:mm:ss") + "'") + " WHERE referral_id = " + referral_id.ToString(); DBBase.ExecuteNonResult(sql); }
public static void UpdateActive(int offering_id) { string sql = "UPDATE Offering SET is_deleted = 0 WHERE offering_id = " + offering_id.ToString(); DBBase.ExecuteNonResult(sql); }
public static void UpdateRegRef(int referral_id, int register_referrer_id) { string sql = "UPDATE Referral SET register_referrer_id = " + register_referrer_id + " WHERE referral_id = " + referral_id.ToString(); DBBase.ExecuteNonResult(sql); }
public static void UpdateAllGstExempt(bool setExempt) { string sql = "UPDATE Offering SET is_gst_exempt = " + (setExempt ? "1" : "0"); DBBase.ExecuteNonResult(sql); }
public static void UpdateAsDeleted(int referral_id, int staff_id) { string sql = "UPDATE Referral SET deleted_by = " + staff_id + ",date_deleted = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' WHERE referral_id = " + referral_id.ToString(); DBBase.ExecuteNonResult(sql); }
/* * Put this into grid - page and menu only can be seen by stakeholder * * 0000-0999 1000-1999 2000-2999 3000-3999 .... * A • Total Podiatry * B • PodiatryClinics * C * D * .. * */ protected void Run() { string curDbName = Session["DB"].ToString(); try { ArrayList claimNbrRangeList = new ArrayList(); for (char l = 'A'; l <= 'Z'; l++) { for (int i = 0; i <= 9; i++) { claimNbrRangeList.Add("" + l + i + "000" + "_" + l + i + "999"); } } ArrayList dbList = new ArrayList(); ArrayList siteNameList = new ArrayList(); ArrayList allocationsList = new ArrayList(); System.Data.DataTable tblDBs = DBBase.ExecuteQuery("EXEC sp_databases;", "master").Tables[0]; for (int i = 0; i < tblDBs.Rows.Count; i++) { string databaseName = tblDBs.Rows[i][0].ToString(); if (!Regex.IsMatch(databaseName, @"Mediclinic_\d{4}")) { continue; } //if (databaseName == "Mediclinic_0001") // continue; Session["DB"] = databaseName; Session["SystemVariables"] = SystemVariableDB.GetAll(); string sql = "SELECT COUNT(*) FROM InvoiceHealthcareClaimNumbers WHERE last_date_used IS NOT NULL OR is_active = 1"; int countUsed = Convert.ToInt32(DBBase.ExecuteSingleResult(sql)); if (countUsed > 0) { dbList.Add(databaseName); siteNameList.Add(((SystemVariables)Session["SystemVariables"])["Site"].Value); allocationsList.Add(GetClaimsAllocated(claimNbrRangeList)); } Session.Remove("DB"); Session.Remove("SystemVariables"); } string outputHeaderRow = string.Empty; string outputBody = string.Empty; for (char l = 'A'; l <= 'Z'; l++) // each col { string row = "<tr><th>" + l + "</th>"; for (int i = 0; i <= 9; i++) // each row { if (l == 'A') { outputHeaderRow += "<th style=\"text-align:center;\">" + "" + i + "000" + "-" + i + "999" + "</th>"; } string range = "" + l + i + "000" + "_" + l + i + "999"; string startRange = range.Split('_')[0]; string endRange = range.Split('_')[1]; string firstChar = range[0].ToString(); string sites = string.Empty; for (int j = 0; j < siteNameList.Count; j++) { DataTable tbl = (DataTable)allocationsList[j]; bool allocated = Convert.ToBoolean(tbl.Rows[0][range]); if (allocated) { sites += (sites.Length > 0 ? "<br />" : "") + "• " + siteNameList[j]; } } row += "<td" + (sites.Length > 0 ? " class=\"nowrap\"" : "") + ">" + sites + "</td>"; } row += "</tr>"; outputBody += row; } outputHeaderRow = "<tr><th></th>" + outputHeaderRow + "<tr>"; outputBody = "<table class=\"table table-bordered table-striped table-grid table-grid-top-bottum-padding-normal auto_width block_center\" border=\"1\">" + outputHeaderRow + outputBody + "</table>"; lblOutput.Text = outputBody; } finally { Session["DB"] = curDbName; Session["SystemVariables"] = SystemVariableDB.GetAll(); } }
public static DataTable GetDataTable_All() { string sql = JoinedSql; return(DBBase.ExecuteQuery(sql).Tables[0]); }