Пример #1
0
        /* protected void ExportToExcelClick(object sender, EventArgs e)
         * {
         *   Response.ClearContent();
         *   Response.Buffer = true;
         *   Response.AppendHeader("content-disposition", "attachment; filename=DoctorsList.xls");
         *   Response.ContentType = "application/excel";
         *   StringWriter sw = new StringWriter();
         *   HtmlTextWriter htw = new HtmlTextWriter(sw);
         *   DoctorsView.AllowPaging = false;
         *
         *   DoctorsView.HeaderRow.ControlStyle.Font.Size = 25;
         *   DoctorsView.HeaderRow.Style.Add("background-color", "red");
         *   for (int i=0; i< DoctorsView.HeaderRow.Cells.Count; i++)
         *   {
         *       DoctorsView.HeaderRow.Cells[i].ColumnSpan =2;
         *       DoctorsView.ForeColor = System.Drawing.Color.Blue;
         *   }
         *   for (int i = 0; i < DoctorsView.Rows.Count; i++)
         *   {
         *       for (int j = 0; j < DoctorsView.Rows[i].Cells.Count; j++)
         *       {
         *           DoctorsView.Rows[i].Cells[j].Style.Add("background-color", "yellow");
         *           DoctorsView.Rows[i].Cells[j].ColumnSpan = 2;
         *           DoctorsView.Rows[i].Cells[j].ForeColor = System.Drawing.Color.Blue;
         *           DoctorsView.ForeColor = System.Drawing.Color.Blue;
         *       }
         *
         *   }
         *
         *   DoctorsView.RenderControl(htw);
         *   string headerTable = @"<Table><tr><td align='center' colspan='16' rowspan='2' style='font-size:20px;'><b>HEALTH BRIDGE REPORT</b></td></tr></Table>";
         *   Response.Write(headerTable);
         *   Response.Write(sw.ToString());
         *   Response.End();
         *
         *
         * }*/



        public void loadData()
        {
            try
            {
                sqlcon.Open();
                MySqlDataAdapter adp = new MySqlDataAdapter("Select HospitalId, HospitalName, DoctorName, Specialization, HospitalLocation,HospitalAddress, Rating,ConsultancyFee from health_bridge_doctors", sqlcon);
                DataSet          ds  = new DataSet();
                adp.Fill(ds);

                DoctorsView.DataSource = ds;
                DoctorsView.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write("problem with Connection" + ex);
            }
            finally
            {
                sqlcon.Close();
            }
        }
Пример #2
0
        public void GetFilterData()
        {
            if (cities.SelectedIndex != 0 && specialization.SelectedIndex != 0)
            {
                ViewState["queryStr"] = "Select HospitalId, HospitalName, DoctorName, Specialization, HospitalLocation,HospitalAddress, Rating,ConsultancyFee from health_bridge_doctors where HospitalLocation='" + cities.SelectedValue + "' AND Specialization='" + specialization.SelectedValue + "'";
            }
            else if (cities.SelectedIndex != 0 && specialization.SelectedIndex == 0)
            {
                ViewState["queryStr"] = "Select HospitalId, HospitalName, DoctorName, Specialization, HospitalLocation,HospitalAddress, Rating,ConsultancyFee from health_bridge_doctors where HospitalLocation='" + cities.SelectedValue + "'";
            }
            else if (cities.SelectedIndex == 0 && specialization.SelectedIndex != 0)
            {
                ViewState["queryStr"] = "Select HospitalId, HospitalName, DoctorName, Specialization, HospitalLocation,HospitalAddress, Rating,ConsultancyFee from health_bridge_doctors where  Specialization='" + specialization.SelectedValue + "'";
            }
            else if (cities.SelectedIndex == 0 && specialization.SelectedIndex == 0)
            {
                ViewState["queryStr"] = "Select HospitalId, HospitalName, DoctorName, Specialization, HospitalLocation,HospitalAddress, Rating,ConsultancyFee from health_bridge_doctors where HospitalLocation='" + cities.SelectedValue + "' AND Specialization='" + specialization.SelectedValue + "'";
            }
            // ShowMessage(ViewState["cityName"].ToString() +" ->"+flag+ " Record Successfully Inserted", MessageType.success);
            try
            {
                sqlcon.Open();
                MySqlDataAdapter adp = new MySqlDataAdapter(ViewState["queryStr"].ToString(), sqlcon);

                DataSet ds = new DataSet();
                adp.Fill(ds);

                DoctorsView.DataSource = ds;
                DoctorsView.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write("problem with Connection" + ex);
            }
            finally
            {
                sqlcon.Close();
            }
        }