protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { lblmessage.Text = ""; if (txtsearch.Text.Length > 0) { if (DropDownList1.SelectedValue == "3") { try { TelContactsRepository dir = new TelContactsRepository(); Session["ecetid"] = dir.SearchpersonTelTypeid(txtsearch.Text.ToInt(), Session["UserTypeID"].ToString().ToInt(), Session["UserID"].ToString().ToInt()); GridView1.DataSource = Session["ecetid"]; GridView1.DataBind(); lblrecordcount.Text = string.Format("{0} : {1}", dir.TelContactCount().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 { TelContactsRepository dir = new TelContactsRepository(); Session["eceaid"] = dir.SearchpersonTelNumber(txtsearch.Text.ToString(), Session["UserTypeID"].ToString().ToInt(), Session["UserID"].ToString().ToInt()); GridView1.DataSource = Session["eceaid"]; GridView1.DataBind(); lblrecordcount.Text = string.Format("{0} : {1}", dir.TelContactCount().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 { LoadTelContactData(Session["UserID"].ToString(), Session["UserTypeID"].ToString()); } }
public void LoadTelContactData(string userid, string usertypeid) { //try //{ TelContactsRepository dir = new TelContactsRepository(); Session["TelPersonContactData"] = dir.GetTelpersonContactList(userid.ToInt(), usertypeid.ToInt()); GridView1.DataSource = Session["TelPersonContactData"]; GridView1.DataBind(); lblrecordcount.Text = string.Format("{0} : {1}", dir.TelContactCount().ToString().ToFarsiNumber(), Resources.DashboardText.RecordCount); lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelPersonContactData"] 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); // } }
public void LoadTelContactData() { TelContactsRepository dir = new TelContactsRepository(); Session["TelContactData"] = dir.GetAllTelContacts(); GridView1.DataSource = Session["TelContactData"]; GridView1.DataBind(); lblrecordcount.Text = string.Format("{0} : {1}", dir.TelContactCount().ToString().ToFarsiNumber(), Resources.DashboardText.RecordCount); lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelContactData"] as DataTable).Rows.Count.ToString().ToFarsiNumber(), Resources.DashboardText.SelectRecordCount); }