コード例 #1
0
        protected void LoadData()
        {
            Database db = EnterpriseLibraryContainer.Current.GetInstance <Database>("Clinic db Instance");

            try
            {
                string str = "select e.employeeid, e.firstname, e.lastname, p.specialty "
                             + "from employee e, physician p where e.EMPLOYEEID = p.EMPLOYEEID and e.EMPLOYEEID NOT IN (select employeeid from surgeon)"
                             + " and e.firstname like '%" + Fname.Text + "%' and e.lastname like '%" + Lname.Text + "%'";
                using (DataSet ds = db.ExecuteDataSet(CommandType.Text, str))
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        Session.Add("Data", ds);
                        PhysEntries.DataSource = ds;
                        PhysEntries.DataBind();
                        //tcSearch.ActiveTabIndex = 1;
                        PhysEntries.Visible = true;
                        lblError.Visible    = false;
                    }
                    else
                    {
                        lblError.Text    = "No data found for the search criteria!";
                        lblError.Visible = true;
                    }
                }
            }
            catch (SqlException ex)
            {
                lblError.Text    = ex.Message.ToString();
                lblError.Visible = true;
            }
        }
コード例 #2
0
 protected void Physician_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     try
     {
         PhysEntries.PageIndex = e.NewPageIndex;
         if (Session["data"] != string.Empty || Session["Data"] != null)
         {
             PhysEntries.DataSource = Session["data"];
             PhysEntries.DataBind();
         }
         else
         {
             LoadData();
         }
     }
     catch (Exception ex)
     {
     }
 }