Exemplo n.º 1
0
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "0")
                {
                    try
                    {
                        TelTypesRepository etir = new TelTypesRepository();
                        Session["TelTypedatafindid"] = etir.Searchid(txtsearch.Text.ToInt());

                        GridView1.DataSource = Session["TelTypedatafindid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", etir.TelTypeCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelTypedatafindid"] 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 == "1")
                {
                    try
                    {
                        TelTypesRepository ttir = new TelTypesRepository();
                        Session["TelTypedatafindtitle"] = ttir.SearchTitle(txtsearch.Text.ToString());
                        GridView1.DataSource            = Session["TelTypedatafindtitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", ttir.TelTypeCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelTypedatafindtitle"] 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
            {
                LoadTelTypeData();
            }
        }
Exemplo n.º 2
0
        public void LoadTelTypeData()
        {
            TelTypesRepository ttir = new TelTypesRepository();

            Session["TelTypeData"] = ttir.GetAllTelType();
            GridView1.DataSource   = Session["TelTypeData"];


            GridView1.DataBind();

            lblrecordcount.Text = string.Format("{0} : {1}", ttir.TelTypeCount().ToString().ToFarsiNumber(), Resources.DashboardText.RecordCount);

            lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelTypeData"] as DataTable).Rows.Count.ToString().ToFarsiNumber(), Resources.DashboardText.SelectRecordCount);
        }