Пример #1
0
        public void LoadFieldData()
        {
            EduFieldsRepository efir = new EduFieldsRepository();

            Session["FieldData"] = efir.GetAllEduFields();

            GridView1.DataSource = Session["FieldData"];


            GridView1.DataBind();

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

            lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["FieldData"] as DataTable).Rows.Count.ToString().ToFarsiNumber(), Resources.DashboardText.SelectRecordCount);
        }
Пример #2
0
        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            lblmessage.Text = "";
            if (txtsearch.Text.Length > 0)
            {
                if (DropDownList1.SelectedValue == "0")
                {
                    try
                    {
                        EduFieldsRepository efir = new EduFieldsRepository();

                        Session["Fielddatafindid"] = efir.Searchid(txtsearch.Text.ToInt());
                        GridView1.DataSource       = Session["Fielddatafindid"];
                        GridView1.DataBind();
                        lblrecordcount.Text       = string.Format("{0} : {1}", efir.FieldCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["Fielddatafindid"] 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
                    {
                        EduFieldsRepository efir = new EduFieldsRepository();
                        Session["Fielddatafindtitle"] = efir.SearchTitle(txtsearch.Text.ToString());
                        GridView1.DataSource          = Session["Fielddatafindtitle"];
                        GridView1.DataBind();
                        lblrecordcount.Text       = string.Format("{0} : {1}", efir.FieldCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["Fielddatafindtitle"] 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
            {
                LoadFieldData();
            }
        }