protected void GrdRegistration_RowDataBound(object sender, GridViewRowEventArgs e) { Staff staff = StaffDB.GetByID(GetFormID()); if (staff == null) { HideTableAndSetErrorMessage("", "Invalid URL Parameters"); return; } DataTable dt = Session["registerorgtostaff_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_staff_id=" + lblId.Text); DataRow thisRow = foundRows[0]; DropDownList ddlOrganisation = (DropDownList)e.Row.FindControl("ddlOrganisation"); if (ddlOrganisation != null) { Organisation[] incList_orig = RegisterStaffDB.GetOrganisationsOf(staff.StaffID); Organisation[] incList = Organisation.RemoveByID(incList_orig, Convert.ToInt32(thisRow["organisation_id"])); DataTable orgs = OrganisationDB.GetDataTable_AllNotInc(incList, true, false, false, true, true); orgs.DefaultView.Sort = "name ASC"; foreach (DataRowView row in orgs.DefaultView) { ddlOrganisation.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); } ddlOrganisation.SelectedValue = thisRow["organisation_id"].ToString(); } ImageButton btnDelete = (ImageButton)e.Row.FindControl("btnDelete"); if (btnDelete != null) { bool is_deleted = Convert.ToBoolean(thisRow["registration_is_deleted"]); if (is_deleted) { btnDelete.CommandName = "_UnDelete"; btnDelete.ImageUrl = "~/images/tick-24.png"; btnDelete.AlternateText = "UnDelete"; btnDelete.ToolTip = "UnDelete"; btnDelete.Visible = false; } } Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlOrganisation = (DropDownList)e.Row.FindControl("ddlNewOrganisation"); if (ddlOrganisation != null) { Organisation[] incList = RegisterStaffDB.GetOrganisationsOf(staff.StaffID); DataTable orgs = OrganisationDB.GetDataTable_AllNotInc(incList, true, false, false, true, true); orgs.DefaultView.Sort = "name ASC"; foreach (DataRowView row in orgs.DefaultView) { ddlOrganisation.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); } if (orgs.Rows.Count == 0) { hideFotter = true; } } if (staff.IsExternal) { CheckBox chkNewIncMondays = (CheckBox)e.Row.FindControl("chkNewIncMondays"); CheckBox chkNewIncTuesdays = (CheckBox)e.Row.FindControl("chkNewIncTuesdays"); CheckBox chkNewIncWednesdays = (CheckBox)e.Row.FindControl("chkNewIncWednesdays"); CheckBox chkNewIncThursdays = (CheckBox)e.Row.FindControl("chkNewIncThursdays"); CheckBox chkNewIncFridays = (CheckBox)e.Row.FindControl("chkNewIncFridays"); CheckBox chkNewIncSaturdays = (CheckBox)e.Row.FindControl("chkNewIncSaturdays"); CheckBox chkNewIncSundays = (CheckBox)e.Row.FindControl("chkNewIncSundays"); if (chkNewIncMondays != null) { chkNewIncMondays.Checked = false; } if (chkNewIncTuesdays != null) { chkNewIncTuesdays.Checked = false; } if (chkNewIncWednesdays != null) { chkNewIncWednesdays.Checked = false; } if (chkNewIncThursdays != null) { chkNewIncThursdays.Checked = false; } if (chkNewIncFridays != null) { chkNewIncFridays.Checked = false; } if (chkNewIncSaturdays != null) { chkNewIncSaturdays.Checked = false; } if (chkNewIncSundays != null) { chkNewIncSundays.Checked = false; } } } }
protected void GrdRegistration_RowDataBound(object sender, GridViewRowEventArgs e) { Patient patient = PatientDB.GetByID(GetFormID()); if (patient == null) { HideTableAndSetErrorMessage("", "Invalid URL Parameters"); return; } UserView userView = UserView.GetInstance(); DataTable dt = Session["registerorgtopatient_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_patient_id=" + lblId.Text); DataRow thisRow = foundRows[0]; DropDownList ddlOrganisation = (DropDownList)e.Row.FindControl("ddlOrganisation"); if (ddlOrganisation != null) { Organisation[] incList_orig = RegisterPatientDB.GetOrganisationsOf(patient.PatientID); Organisation[] incList = Organisation.RemoveByID(incList_orig, Convert.ToInt32(thisRow["organisation_id"])); DataTable orgs = OrganisationDB.GetDataTable_AllNotInc(incList, true, !userView.IsClinicView, !userView.IsAgedCareView, true, true); orgs.DefaultView.Sort = "name ASC"; foreach (DataRowView row in orgs.DefaultView) { ddlOrganisation.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); } ddlOrganisation.SelectedValue = thisRow["organisation_id"].ToString(); } HyperLink lnkBookings = (HyperLink)e.Row.FindControl("lnkBookings"); if (lnkBookings != null) { lnkBookings.NavigateUrl = string.Format("~/BookingsV2.aspx?orgs={0}&patient={1}", Convert.ToInt32(thisRow["organisation_id"]), patient.PatientID); } Utilities.AddConfirmationBox(e); if ((e.Row.RowState & DataControlRowState.Edit) > 0) { Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow); } } if (e.Row.RowType == DataControlRowType.Footer) { DropDownList ddlOrganisation = (DropDownList)e.Row.FindControl("ddlNewOrganisation"); if (ddlOrganisation != null) { Organisation[] incList = RegisterPatientDB.GetOrganisationsOf(patient.PatientID); DataTable orgs = OrganisationDB.GetDataTable_AllNotInc(incList, true, !userView.IsClinicView, !userView.IsAgedCareView, true, true); orgs.DefaultView.Sort = "name ASC"; foreach (DataRowView row in orgs.DefaultView) { ddlOrganisation.Items.Add(new ListItem(row["name"].ToString(), row["organisation_id"].ToString())); } if (orgs.Rows.Count == 0) { hideFotter = true; } } } }