protected void SearchForHospital() { try { string CS = ConfigurationManager.ConnectionStrings["ConnectToPatientPortal"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { string query = "Select * from Institutes"; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); DataView dv = new DataView(dt); if (ddlcity.SelectedValue != "All") { dv.RowFilter = "City='" + ddlcity.SelectedValue + "'"; } dt = dv.ToTable(); GridViewDoctor.DataSource = null; GridViewDoctor.DataBind(); GridViewHospital.DataSource = dt; GridViewHospital.DataBind(); } } catch (Exception ex) { Session["Exception"] = ex; Response.Redirect("~/404.aspx"); } }
private void BindGridView() { try { if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "Select idDoc,name,tel,speciality from Doctors;"; SqlDataAdapter adp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); GridViewDoctor.DataSource = ds; GridViewDoctor.DataBind(); lbltotalcount.Text = GridViewDoctor.Rows.Count.ToString(); } catch (SqlException ex) { showMessage(ex.Message); } finally { conn.Close(); } }
private void GridViewDoctorDataBind() { MyAspNetPager.PageSize = 18; Int32 recordcount; string sql = "SELECT * FROM T_NEWSBASE WHERE NODEID = 62 ORDER BY ID DESC"; DataTable DT = Pages.GetPage(sql, MyAspNetPager.CurrentPageIndex, MyAspNetPager.PageSize, out recordcount); GridViewDoctor.DataSource = DT; GridViewDoctor.DataBind(); this.MyAspNetPager.RecordCount = recordcount; MyAspNetPager.TextBeforeInputBox = "共" + this.MyAspNetPager.RecordCount + "条 转到第"; MyAspNetPager.TextAfterInputBox = "页"; this.lblRecordCount.Text = recordcount.ToString(); this.lblPageSize.Text = MyAspNetPager.CurrentPageIndex.ToString(); }
public void display() { DataTable dt = new DataTable(); String con; con = "User Id = sandeep; Password=admin; Data source = XE"; cn.ConnectionString = con; cn.Open(); //to display data from department table OracleCommand cmd = new OracleCommand("Select * from Doctor_Details", cn); OracleDataAdapter adp = new OracleDataAdapter(cmd); adp.Fill(dt); cn.Close(); GridViewDoctor.DataSource = dt; GridViewDoctor.DataBind(); }
protected void GetSimilarDoctors() { try { string CS = ConfigurationManager.ConnectionStrings["ConnectToPatientPortal"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { string query = "Select top 5 DoctorProfile.*,UserAccounts.Username from DoctorProfile inner join UserAccounts on DoctorProfile.UserId=UserAccounts.UserId where Doctorprofile.DoctorId !='" + Session["SelectedDoctorForDetailView"] + "' and Doctorprofile.Specialization =(select Specialization from Doctorprofile where Doctorid='" + Session["SelectedDoctorForDetailView"] + "')"; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); GridViewDoctor.DataSource = dt; GridViewDoctor.DataBind(); } } catch (Exception ex) { Session["Exception"] = ex; Response.Redirect("~/404.aspx"); } }
protected void GetDoctorsOnBoard() { try { string CS = ConfigurationManager.ConnectionStrings["ConnectToPatientPortal"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { string query = "Select DoctorProfile.*,UserAccounts.Username from DoctorProfile inner join UserAccounts on DoctorProfile.UserId=UserAccounts.UserId where DoctorProfile.DoctorId in(select DoctorId from Affiliations where InstituteId='" + Session["SelectedHospitalForDetailView"] + "')"; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); GridViewDoctor.DataSource = dt; GridViewDoctor.DataBind(); } } catch (Exception ex) { Session["Exception"] = ex; Response.Redirect("~/404.aspx"); } }
protected void SearchForDoctor() { try { string CS = ConfigurationManager.ConnectionStrings["ConnectToPatientPortal"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { string query = "Select DoctorProfile.*,UserAccounts.Username from DoctorProfile inner join UserAccounts on DoctorProfile.UserId=UserAccounts.UserId"; if (ddlFilterBy.SelectedValue == "Services" && ddlspecialization.SelectedValue != "All") { query = "Select DoctorProfile.*,DoctorOfferServices.ServiceName,UserAccounts.Username from ((DoctorProfile inner join DoctorOfferServices on DoctorProfile.DoctorId=DoctorOfferServices.DoctorId) inner join UserAccounts on DoctorProfile.UserId=UserAccounts.UserId)"; } if (ddlFilterBy.SelectedValue == "Diseases" && ddlspecialization.SelectedValue != "All") { query = "Select DoctorProfile.*,Diseases.DiseaseName,UserAccounts.Username from DoctorProfile inner join DoctorCureDiseases on DoctorProfile.DoctorId=DoctorCureDiseases.DoctorId inner join UserAccounts on DoctorProfile.UserId=UserAccounts.UserId"; } SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable dt = new DataTable(); da.Fill(dt); if (ddlcity.SelectedValue != "All") { DataView dv = new DataView(dt); dv.RowFilter = "City='" + ddlcity.SelectedValue + "'"; dt = dv.ToTable(); } if (ddlgender.SelectedValue != "Both") { DataView dv = new DataView(dt); dv.RowFilter = "Gender= '" + ddlgender.SelectedValue + "'"; dt = dv.ToTable(); } if (ddlFeeMin.SelectedValue != "--Minimum--" && ddlFeeMin.SelectedValue != "Don,t Filter" && ddlFeeMax.SelectedValue != "--Maximum--" && ddlFeeMax.SelectedValue != "Don,t Filter") { DataView dv = new DataView(dt); dv.RowFilter = "FeeMin >= '" + ddlFeeMin.SelectedValue + "' AND FeeMax <= '" + ddlFeeMax.SelectedValue + "'"; dt = dv.ToTable(); } if (ddlspecialization.SelectedValue != "All") { DataView dv = new DataView(dt); dv.RowFilter = "Specialization= '" + ddlspecialization.SelectedValue + "'"; dt = dv.ToTable(); } if (ddlFilterBy.SelectedValue == "Diseases" && ddlspecialization.SelectedValue != "All") { DataView dv = new DataView(dt); dv.RowFilter = "DiseaseName= '" + ddlDiseases.SelectedValue + "'"; dt = dv.ToTable(); } if (ddlFilterBy.SelectedValue == "Services" && ddlspecialization.SelectedValue != "All") { DataView dv = new DataView(dt); dv.RowFilter = "ServiceName= '" + ddlServices.SelectedValue + "'"; dt = dv.ToTable(); } DataView dv2 = new DataView(dt); dv2.Sort = "Recommendations DESC"; dt = dv2.ToTable(); GridViewHospital.DataSource = null; GridViewHospital.DataBind(); GridViewDoctor.DataSource = dt; GridViewDoctor.DataBind(); } } catch (Exception ex) { Session["Exception"] = ex; Response.Redirect("~/404.aspx"); } }