protected void gvSpeciality_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRecord") { if (e.CommandArgument != null) { ViewState["SpecialityEditActive"] = true; ViewState["SpecialityID"] = Convert.ToInt32(e.CommandArgument.ToString()); lblModalTitle.Text = "Speciality Edit"; FillControls(Convert.ToInt32(e.CommandArgument.ToString())); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "specialityAddEditModal();", true); } } if (e.CommandName == "DeleteRecord") { if (e.CommandArgument != null) { SpecialityBAL balSpeciality = new SpecialityBAL(); if (balSpeciality.Delete(Convert.ToInt32(e.CommandArgument.ToString()))) { fillGridviewSpeciality(); ClientScript.RegisterStartupScript(GetType(), "SweetAlert", "swal({ type: 'success', title: 'Speciality Deleted Successfully', showConfirmButton: false, timer: 2000});", true); } else { lblErrorMessage.Text = balSpeciality.Message; } } } }
protected void btnSave_Click(object sender, EventArgs e) { #region server side validation String strErrorMessage = ""; if (txtSpeciality.Text.Trim() == "") { strErrorMessage += "- Enter Speciality <br/>"; } if (strErrorMessage.Trim() != "") { lblErrorMessage.Text = strErrorMessage; return; } #endregion server side validation #region Collect Form Data SpecialityENT entSpeciality = new SpecialityENT(); if (txtSpeciality.Text.Trim() != "") { entSpeciality.SpecialityName = txtSpeciality.Text.Trim(); } #endregion Collect Form Data SpecialityBAL balSpeciality = new SpecialityBAL(); if (Convert.ToBoolean(ViewState["SpecialityEditActive"]) == false) { if (balSpeciality.Insert(entSpeciality)) { fillGridviewSpeciality(); ClientScript.RegisterStartupScript(GetType(), "SweetAlert", "swal({ type: 'success', title: 'Speciality Inserted Successfully', showConfirmButton: false, timer: 2000});", true); ClearControls(); } else { lblErrorMessage.Text = balSpeciality.Message; } } else { entSpeciality.SpecialityID = Convert.ToInt32(ViewState["SpecialityID"]); if (balSpeciality.Update(entSpeciality)) { fillGridviewSpeciality(); ClientScript.RegisterStartupScript(GetType(), "SweetAlert", "swal({ type: 'success', title: 'Speciality Edited Successfully', showConfirmButton: false, timer: 2000});", true); ClearControls(); ViewState["SpecialityEditActive"] = false; lblModalTitle.Text = "Speciality Add"; } else { lblErrorMessage.Text = balSpeciality.Message; } } }
public static void fillCheckBoxListSpeciality(CheckBoxList chkl) { SpecialityBAL balSpeciality = new SpecialityBAL(); chkl.DataSource = balSpeciality.SelectForDropDownList(); chkl.DataValueField = "SpecialityID"; chkl.DataTextField = "SpecialityName"; chkl.DataBind(); }
public void fillGridviewSpeciality() { SpecialityBAL balSpeciality = new SpecialityBAL(); DataTable dt = new DataTable(); dt = balSpeciality.SelectAll(); gvSpeciality.DataSource = dt; gvSpeciality.DataBind(); }
public static void fillDropDownListSpeciality(DropDownList ddl) { SpecialityBAL balSpeciality = new SpecialityBAL(); ddl.DataSource = balSpeciality.SelectForDropDownList(); ddl.DataValueField = "SpecialityID"; ddl.DataTextField = "SpecialityName"; ddl.DataBind(); ddl.Items.Insert(0, new ListItem("Select Speciality", "-1")); }
private void FillControls(SqlInt32 SpecialityID) { SpecialityBAL balSpeciality = new SpecialityBAL(); SpecialityENT entSpeciality = new SpecialityENT(); entSpeciality = balSpeciality.SelectByPK(SpecialityID); if (!entSpeciality.SpecialityName.IsNull) { txtSpeciality.Text = entSpeciality.SpecialityName.Value.ToString(); } }
public void fillHospitalDetails(SqlInt32 HospitalID) { HospitalBAL balHospital = new HospitalBAL(); HospitalENT entHospital = new HospitalENT(); entHospital = balHospital.SelectByPK(HospitalID); if (!entHospital.HospitalName.IsNull) { lblHospitalName.Text = entHospital.HospitalName.Value; } if (!entHospital.SpecialityID.IsNull) { SpecialityBAL balSpeciality = new SpecialityBAL(); SpecialityENT entSpeciality = new SpecialityENT(); entSpeciality = balSpeciality.SelectByPK(Convert.ToInt32(entHospital.SpecialityID.Value)); lblSpeciality.Text = entSpeciality.SpecialityName.Value; } if (!entHospital.Overview.IsNull) { lblOverview.Text = entHospital.Overview.Value; } if (!entHospital.Address.IsNull) { hlAddress.Text = entHospital.Address.Value; } if (!entHospital.Email.IsNull) { hlEmail.NavigateUrl = "mailto:" + entHospital.Email.Value; hlEmail.Text = entHospital.Email.Value; } if (!entHospital.Mobile.IsNull) { hlMobile.NavigateUrl = "tel:" + entHospital.Mobile.Value; hlMobile.Text = entHospital.Mobile.Value; } HospitalWiseReportBAL balHospitalWiseReport = new HospitalWiseReportBAL(); DataTable dtReport = new DataTable(); dtReport = balHospitalWiseReport.SelectByHospitalID(HospitalID); rptReport.DataSource = dtReport; rptReport.DataBind(); DoctorBAL balDoctorBAL = new DoctorBAL(); DataTable dtDoctor = new DataTable(); dtDoctor = balDoctorBAL.SelectByHospitalID(HospitalID); if (dtDoctor != null && dtDoctor.Rows.Count > 0) { rptDoctors.DataSource = dtDoctor; rptDoctors.DataBind(); pnlNoDoctorFound.Visible = false; } else { pnlNoDoctorFound.Visible = true; } if (Convert.ToBoolean(Application["CheckAdmin"]) == true && Convert.ToBoolean(Application["CheckDoctor"]) == false) { lbEditHospital.Visible = true; lbDoctorAdd.Visible = true; } else if (Convert.ToBoolean(Application["CheckAdmin"]) == false && Convert.ToBoolean(Application["CheckDoctor"]) == true) { lbEditHospital.Visible = false; lbDoctorAdd.Visible = false; Boolean checkDoctor = dtDoctor.Select().ToList().Exists(row => row["DoctorID"].ToString().ToUpper() == Session["UserID"].ToString()); if (checkDoctor == true) { lbEditHospital.Visible = true; } } }
public void fillHospitalDetails(SqlInt32 HospitalID) { HospitalBAL balHospital = new HospitalBAL(); HospitalENT entHospital = new HospitalENT(); entHospital = balHospital.SelectByPK(HospitalID); if (!entHospital.HospitalName.IsNull) { lblHospitalName.Text = entHospital.HospitalName.Value; } if (!entHospital.SpecialityID.IsNull) { SpecialityBAL balSpeciality = new SpecialityBAL(); SpecialityENT entSpeciality = new SpecialityENT(); entSpeciality = balSpeciality.SelectByPK(Convert.ToInt32(entHospital.SpecialityID.Value)); lblSpeciality.Text = entSpeciality.SpecialityName.Value; } if (!entHospital.Overview.IsNull) { lblOverview.Text = entHospital.Overview.Value; } if (!entHospital.Address.IsNull) { hlAddress.Text = entHospital.Address.Value; } if (!entHospital.Email.IsNull) { hlEmail.NavigateUrl = "mailto:" + entHospital.Email.Value; hlEmail.Text = entHospital.Email.Value; } if (!entHospital.Mobile.IsNull) { hlMobile.NavigateUrl = "tel:" + entHospital.Mobile.Value; hlMobile.Text = entHospital.Mobile.Value; } HospitalWiseReportBAL balHospitalWiseReport = new HospitalWiseReportBAL(); DataTable dtReport = new DataTable(); dtReport = balHospitalWiseReport.SelectByHospitalID(HospitalID); rptReport.DataSource = dtReport; rptReport.DataBind(); DoctorBAL balDoctorBAL = new DoctorBAL(); DataTable dtDoctor = new DataTable(); dtDoctor = balDoctorBAL.SelectByHospitalID(HospitalID); if (dtDoctor != null && dtDoctor.Rows.Count > 0) { rptDoctors.DataSource = dtDoctor; rptDoctors.DataBind(); pnlNoDoctorFound.Visible = false; } else { pnlNoDoctorFound.Visible = true; } }