protected void FillGrid() { DataTable dt = BookingChangeHistoryReasonDB.GetDataTable(); Session["bookingchangehistoryreason_data"] = dt; if (dt.Rows.Count > 0) { GrdBookingChangeHistoryReason.DataSource = dt; try { GrdBookingChangeHistoryReason.DataBind(); } catch (Exception ex) { SetErrorMessage("", ex.ToString()); } } else { dt.Rows.Add(dt.NewRow()); GrdBookingChangeHistoryReason.DataSource = dt; GrdBookingChangeHistoryReason.DataBind(); int TotalColumns = GrdBookingChangeHistoryReason.Rows[0].Cells.Count; GrdBookingChangeHistoryReason.Rows[0].Cells.Clear(); GrdBookingChangeHistoryReason.Rows[0].Cells.Add(new TableCell()); GrdBookingChangeHistoryReason.Rows[0].Cells[0].ColumnSpan = TotalColumns; GrdBookingChangeHistoryReason.Rows[0].Cells[0].Text = "No Record Found"; } }
protected void GrdBookingChangeHistoryReason_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lblId = (Label)GrdBookingChangeHistoryReason.Rows[e.RowIndex].FindControl("lblId"); TextBox txtDescr = (TextBox)GrdBookingChangeHistoryReason.Rows[e.RowIndex].FindControl("txtDescr"); DropDownList ddlDisplayOrder = (DropDownList)GrdBookingChangeHistoryReason.Rows[e.RowIndex].FindControl("ddlDisplayOrder"); BookingChangeHistoryReasonDB.Update(Convert.ToInt32(lblId.Text), txtDescr.Text, Convert.ToInt32(ddlDisplayOrder.SelectedValue)); GrdBookingChangeHistoryReason.EditIndex = -1; FillGrid(); }
protected void GrdBookingChangeHistoryReason_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Insert")) { TextBox txtDescr = (TextBox)GrdBookingChangeHistoryReason.FooterRow.FindControl("txtNewDescr"); DropDownList ddlDisplayOrder = (DropDownList)GrdBookingChangeHistoryReason.FooterRow.FindControl("ddlNewDisplayOrder"); BookingChangeHistoryReasonDB.Insert(txtDescr.Text, Convert.ToInt32(ddlDisplayOrder.SelectedValue)); FillGrid(); } }
protected void lbSubtractOneDisplayOrderToAll_Click(object sender, EventArgs e) { BookingChangeHistoryReasonDB.UpdateDisplayOrderAll(-1); FillGrid(); }
public void SetModalDropDownList(StartEndTime startEndTime) { int minBookingDurationMins = 10; if (Convert.ToBoolean(Session["SiteIsClinic"])) { minBookingDurationMins = Convert.ToInt32(((SystemVariables)Session["SystemVariables"])["BookingSheetTimeSlotMins_Clinic"].Value); } else if (Convert.ToBoolean(Session["SiteIsAgedCare"])) { minBookingDurationMins = Convert.ToInt32(((SystemVariables)Session["SystemVariables"])["BookingSheetTimeSlotMins_AgedCare"].Value); } else if (Convert.ToBoolean(Session["SiteIsGP"])) { minBookingDurationMins = Convert.ToInt32(((SystemVariables)Session["SystemVariables"])["BookingSheetTimeSlotMins_GP"].Value); } ddlModalStartHour.Items.Clear(); ddlModalEndHour.Items.Clear(); ddlModalStartMinute.Items.Clear(); ddlModalEndMinute.Items.Clear(); for (int i = startEndTime.StartTime.Hours; i <= startEndTime.EndTime.Hours; i++) { ddlModalStartHour.Items.Add(new ListItem(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'))); ddlModalEndHour.Items.Add(new ListItem(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'))); } for (int i = 0; i < 60; i += minBookingDurationMins) { ddlModalStartMinute.Items.Add(new ListItem(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'))); ddlModalEndMinute.Items.Add(new ListItem(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'))); } for (int i = 0; i <= 23; i++) { ddlModalPopupUnavailableRecurringModalStartHour.Items.Add(new ListItem(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'))); ddlModalPopupUnavailableRecurringModalEndHour.Items.Add(new ListItem(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'))); } for (int i = 0; i < 60; i += minBookingDurationMins) { ddlModalPopupUnavailableRecurringModalStartMinute.Items.Add(new ListItem(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'))); ddlModalPopupUnavailableRecurringModalEndMinute.Items.Add(new ListItem(i.ToString().PadLeft(2, '0'), i.ToString().PadLeft(2, '0'))); } ddlOrgUnavailabilityReason.Items.Add(new ListItem("[None]", "-1")); DataTable tblUnavailabilityReasons = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "BookingUnavailabilityReason", "", "descr", "booking_unavailability_reason_id", "booking_unavailability_reason_type_id", "descr"); foreach (DataRow row in tblUnavailabilityReasons.Rows) { if (row["booking_unavailability_reason_type_id"].ToString() == "341") { ddlProvUnavailabilityReason.Items.Add(new ListItem(row["descr"].ToString(), row["booking_unavailability_reason_id"].ToString())); } else if (row["booking_unavailability_reason_type_id"].ToString() == "340") { ddlOrgUnavailabilityReason.Items.Add(new ListItem(row["descr"].ToString(), row["booking_unavailability_reason_id"].ToString())); } } //DataTable tblBookingChangeHistoryReasons = DBBase.GetGenericDataTable_WithWhereOrderClause("BookingChangeHistoryReason", "", "display_order, descr", "booking_change_history_reason_id", "descr", "display_order"); DataTable tblBookingChangeHistoryReasons = BookingChangeHistoryReasonDB.GetDataTable(); foreach (DataRow row in tblBookingChangeHistoryReasons.Rows) { ddlBookingMovementReason.Items.Add(new ListItem(row["descr"].ToString(), row["booking_change_history_reason_id"].ToString())); } ddlEveryNWeeks.Items.Clear(); for (int i = 1; i <= 13; i++) { ddlEveryNWeeks.Items.Add(new ListItem(i.ToString(), i.ToString())); } ddlOcurrences.Items.Clear(); for (int i = 1; i <= 13; i++) { ddlOcurrences.Items.Add(new ListItem(i.ToString(), i.ToString())); } ddlUnavailableEveryNWeeks.Items.Clear(); for (int i = 1; i <= 13; i++) { ddlUnavailableEveryNWeeks.Items.Add(new ListItem(i.ToString(), i.ToString())); } }