Beispiel #1
0
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "0")
                {
                    try
                    {
                        VLecturersRepository vstdir = new VLecturersRepository();

                        Session["stddatafindid"] = vstdir.Searchlecid(txtsearch.Text.ToInt());
                        GridView1.DataSource     = Session["stddatafindid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.leccount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindid"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }

                if (DropDownList1.SelectedValue == "2")
                {
                    try
                    {
                        VLecturersRepository vstdir = new VLecturersRepository();
                        Session["stddatafindFirstName"] = vstdir.SearchFirstName(txtsearch.Text);
                        GridView1.DataSource            = Session["stddatafindFirstName"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.leccount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindFirstName"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "3")
                {
                    try
                    {
                        VLecturersRepository vstdir = new VLecturersRepository();
                        Session["stddatafindLasttName"] = vstdir.SearchLastName(txtsearch.Text);
                        GridView1.DataSource            = Session["stddatafindLasttName"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.leccount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindLasttName"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "4")
                {
                    try
                    {
                        VLecturersRepository vstdir = new VLecturersRepository();
                        Session["stddatafindUsername"] = vstdir.SearchUserName(txtsearch.Text);
                        GridView1.DataSource           = Session["stddatafindUsername"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.leccount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindUsername"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
                if (DropDownList1.SelectedValue == "5")
                {
                    try
                    {
                        VLecturersRepository vstdir = new VLecturersRepository();
                        Session["stddatafindFacultyTitle"] = vstdir.SearchFacultyTitle(txtsearch.Text);
                        GridView1.DataSource = Session["stddatafindFacultyTitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.leccount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindFacultyTitle"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }



                if (DropDownList1.SelectedValue == "7")
                {
                    try
                    {
                        VLecturersRepository vstdir = new VLecturersRepository();
                        Session["stddatafindFielsTitle"] = vstdir.SearchFieldTitle(txtsearch.Text);
                        GridView1.DataSource             = Session["stddatafindFielsTitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.leccount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindFielsTitle"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }

                if (DropDownList1.SelectedValue == "8")
                {
                    try
                    {
                        VLecturersRepository vstdir = new VLecturersRepository();
                        Session["stddatafindTendencyTitle"] = vstdir.SearchTendencyTitle(txtsearch.Text);
                        GridView1.DataSource = Session["stddatafindTendencyTitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", vstdir.leccount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["stddatafindTendencyTitle"] as DataTable).Rows.Count.ToString(), Resources.DashboardText.SelectRecordCount);
                    }
                    catch
                    {
                        PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errSearch, Color.Red);
                        lblrecordcount.Text       = string.Format("{0} : {1}", "0", Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", "0", Resources.DashboardText.SelectRecordCount);
                    }
                }
            }
            else
            {
                LoadStdData();
            }
        }