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

                        Session["ecetid"]    = dir.SearchpersonEmailTypeid(txtsearch.Text.ToInt(), Session["UserTypeID"].ToString().ToInt(), Session["UserID"].ToString().ToInt());
                        GridView1.DataSource = Session["ecetid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", dir.EmailContactCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["ecetid"] 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
                    {
                        EmailContactsRepository dir = new EmailContactsRepository();

                        Session["eceaid"]    = dir.SearchpersonEmailAddrress(txtsearch.Text.ToString(), Session["UserTypeID"].ToString().ToInt(), Session["UserID"].ToString().ToInt());
                        GridView1.DataSource = Session["eceaid"];
                        GridView1.DataBind();

                        lblrecordcount.Text       = string.Format("{0} : {1}", dir.EmailContactCount().ToString(), Resources.DashboardText.RecordCount);
                        lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["eceaid"] 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
            {
                LoadEmailContactData(Session["UserID"].ToString(), Session["UserTypeID"].ToString());
            }
        }
Beispiel #2
0
        public void LoadEmailContactData(string userid, string usertypeid)
        {
            try
            {
                EmailContactsRepository dir = new EmailContactsRepository();
                Session["EmailPersonContactData"] = dir.GetEmailpersonContactList(userid.ToInt(), usertypeid.ToInt());

                GridView1.DataSource = Session["EmailPersonContactData"];


                GridView1.DataBind();

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

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

                switch (Session["UserTypeID"].ToString())
                {
                case "1":
                {
                    VStudentsRepository vstdir = new VStudentsRepository();
                    VStudent            std    = vstdir.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "دانشجو" + ":" + std.FirstName + " " + std.LastName;
                }
                break;

                case "2":
                {
                    VLecturersRepository vlec = new VLecturersRepository();
                    VLecturer            lec  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "استاد" + ":" + lec.FirstName + " " + lec.LastName;
                }
                break;

                case "3":
                {
                    VEmployeesRepository vlec = new VEmployeesRepository();
                    VEmployee            emp  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "کارمند" + ":" + emp.FirstName + " " + emp.LastName;
                }
                break;
                }
            }
            catch
            {
                Redirector.Goto(Redirector.PageName.errorpage);
            }
        }