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

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

                        lblrecordcount.Text       = string.Format("{0} : {1}", etir.EmailtypeCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["EmailTypedatafindid"] 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
                    {
                        EmailTypesRepository etir = new EmailTypesRepository();
                        Session["EmailTypedatafindtitle"] = etir.SearchTitle(txtsearch.Text.ToString());
                        GridView1.DataSource = Session["EmailTypedatafindtitle"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", etir.EmailtypeCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["EmailTypedatafindtitle"] 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
            {
                LoadEmailTypeData();
            }
        }
Exemplo n.º 2
0
        public void LoadEmailTypeData()
        {
            EmailTypesRepository etir = new EmailTypesRepository();

            Session["EmailTypeData"] = etir.GetAllEmailTypes();

            GridView1.DataSource = Session["EmailTypeData"];


            GridView1.DataBind();

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

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