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 loadform() { try { lbluserid.Text = Session["UserID"].ToString(); lblusertypeid.Text = Session["UserTypeID"].ToString(); EmailTypesRepository etr = new EmailTypesRepository(); DataTable dt = etr.GetAllEmailTypes(); ddlemailtype.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlemailtype.Items.Add(new ListItem(dr["EmailTypeTitle"].ToString(), dr["EmailTypeID"].ToString())); } 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 VStudent FindByStudentID(string username, string password, int id) { WebServiceAccountsRepository webir = new WebServiceAccountsRepository(); WebServiceAccount currentuser = webir.FindByUserName(username); if (currentuser != null) { if (currentuser.Password == password) { VStudentsRepository depir = new VStudentsRepository(); return(depir.FindByid(id)); } else { return(null); } } else { return(null); } }
public void loadform() { try { EmailContactsRepository ecrir = new EmailContactsRepository(); EmailContact email = ecrir.FindByid(Session["ID"].ToString().ToInt()); lblid.Text = email.ID.ToString(); lbluserid.Text = Session["UserID"].ToString(); lblusertypeid.Text = Session["UserTypeID"].ToString(); Session["EmailType"] = email.EmailTypeID.ToString(); lblemailaddrress.Text = email.EmailAddrress; Session["newemailtype"] = email.EmailTypeID.ToString(); 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; } EmailTypesRepository etir = new EmailTypesRepository(); EmailType emailtype = etir.FindByid(Session["EmailType"].ToString().ToInt()); if (emailtype != null) { lblEmailtype.Text = emailtype.EmailTypeTitle; // Label7.Text = std.FirstName.ToString() + " " + std.LastName.ToString(); } else { Redirector.Goto(Redirector.PageName.errorpage); } EmailTypesRepository etr = new EmailTypesRepository(); DataTable dt2 = etr.GetAllEmailTypes(); ddlemailtype.Items.Clear(); foreach (DataRow dr in dt2.Rows) { ddlemailtype.Items.Add(new ListItem(dr["EmailTypeTitle"].ToString(), dr["EmailTypeID"].ToString())); } } catch { Redirector.Goto(Redirector.PageName.errorpage); } }
public void loadform(string stdi) { //try //{ FacultiesRepositpry fair = new FacultiesRepositpry(); DataTable dt = fair.GetAllFaculties(); ddlfacultuy.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlfacultuy.Items.Add(new ListItem(dr["FacultyTitle"].ToString(), dr["FacultyID"].ToString())); } EduLevelsRepository leveir = new EduLevelsRepository(); DataTable dtlevel = leveir.GetAllEduLevels(); foreach (DataRow dr in dtlevel.Rows) { ddllevel.Items.Add(new ListItem(dr["LevelTitle"].ToString(), dr["LevelID"].ToString())); } EduFieldsRepository fieldir = new EduFieldsRepository(); DataTable dtfield = fieldir.GetAllEduFields(); foreach (DataRow dr in dtfield.Rows) { ddlfield.Items.Add(new ListItem(dr["FieldTitle"].ToString(), dr["FieldID"].ToString())); } VEduTendenciesRepository tenir = new VEduTendenciesRepository(); DataTable ten = tenir.GetAllTendency(); foreach (DataRow dr in ten.Rows) { ddltendency.Items.Add(new ListItem(dr["TendencyTitle"].ToString(), dr["TendencyID"].ToString())); } VStudentsRepository vstir = new VStudentsRepository(); VStudent std = vstir.FindByid(stdi.ToInt()); if (std != null) { lblstdid.Text = std.StudentID.ToString(); txtstdcode.Text = std.StudentCode; txtname.Text = std.FirstName; txtlastname.Text = std.LastName; RadioButtonList1.SelectedValue = std.Gender.ToString(); txtnationalcode.Text = std.NationalCode; lblfaculty.Text = std.FacultyTitle; lbllevel.Text = std.LevelTitle; lblfield.Text = std.FieldTitle; lbltend.Text = std.TendencyTitle; RadioButtonList2.SelectedValue = std.EntryTerm.ToString(); lblusername.Text = std.Username; if (txtpass.Text != null) { txtpass.Text = std.Password; } // ImageButton1.ImageUrl = std.ImageFileName; Session["newfacultyid"] = std.FacultyID.ToString(); Session["newlevelid"] = std.LevelID.ToString(); Session["newfieldid"] = std.FieldID.ToString(); Session["newtenid"] = std.TendencyID.ToString(); Session["pass"] = std.Password; chkActiveAccount.Checked = (std.Status.Value == 0 ? true : false); Session["imageurl"] = std.ImageFileName; if (Session["imageurl"].ToString() != null) { ImageButton2.ImageUrl = "~/file/" + std.ImageFileName; } } else { Redirector.Goto(Redirector.PageName.errorpage); } //} //catch //{ // Redirector.Goto(Redirector.PageName.errorpage); //} }
public void LoadData(string id) { try { EmailContactsRepository ecrir = new EmailContactsRepository(); EmailContact email = ecrir.FindByid(id.ToInt()); lblid.Text = email.ID.ToString(); Session["UserID"] = email.UserID.ToString(); Session["EmailType"] = email.EmailTypeID.ToString(); Session["UserType"] = email.UserTypeID.ToString(); lblEmailaddrress.Text = email.EmailAddrress.ToString(); Session["newuserid"] = email.UserID.ToString(); Session["newemailtype"] = email.EmailTypeID.ToString(); VStudentsRepository vstdir = new VStudentsRepository(); VStudent std = vstdir.FindByid(Session["UserID"].ToString().ToInt()); if (std != null) { Label7.Text = std.FirstName.ToString() + " " + std.LastName.ToString(); } else { Redirector.Goto(Redirector.PageName.errorpage); } EmailTypesRepository etir = new EmailTypesRepository(); EmailType emailtype = etir.FindByid(Session["EmailType"].ToString().ToInt()); if (emailtype != null) { lblEmailtype.Text = emailtype.EmailTypeTitle; // Label7.Text = std.FirstName.ToString() + " " + std.LastName.ToString(); } else { Redirector.Goto(Redirector.PageName.errorpage); } EmailTypesRepository etr = new EmailTypesRepository(); DataTable dt2 = etr.GetAllEmailTypes(); ddlemailtype.Items.Clear(); foreach (DataRow dr in dt2.Rows) { ddlemailtype.Items.Add(new ListItem(dr["EmailTypeTitle"].ToString(), dr["EmailTypeID"].ToString())); } switch ((Session["UserType"].ToString())) { case "1": { DropDownList1.SelectedValue = "1"; VStudentsRepository vstd = new VStudentsRepository(); DataTable dtstd = vstd.GetAllstd(); ddluserid.Items.Clear(); foreach (DataRow dr in dtstd.Rows) { ddluserid.Items.Add(new ListItem(dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), dr["StudentID"].ToString())); } } break; case "2": { DropDownList1.SelectedValue = "2"; VLecturersRepository vlrir = new VLecturersRepository(); DataTable dtlec = vlrir.GetAllLec(); ddluserid.Items.Clear(); foreach (DataRow dr in dtlec.Rows) { ddluserid.Items.Add(new ListItem(dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), dr["LecturerID"].ToString())); } } break; case "3": { DropDownList1.SelectedValue = "3"; VEmployeesRepository verir = new VEmployeesRepository(); DataTable dtemp = verir.GetAllEmp(); ddluserid.Items.Clear(); foreach (DataRow dr in dtemp.Rows) { ddluserid.Items.Add(new ListItem(dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), dr["EmployeeID"].ToString())); } } break; } } catch { Redirector.Goto(Redirector.PageName.errorpage); } }
public void LoadData(string id) { try { VPNsRepository vpnir = new VPNsRepository(); // EmailContactsRepository ecrir = new EmailContactsRepository(); VVPN vpn = vpnir.FindByid(id.ToInt()); lblid.Text = id; Session["UserID"] = vpn.UserID.ToString(); Session["UserType"] = vpn.UserTypeID.ToString(); Session["DepartmentID"] = vpn.DepartmentID; lblusername.Text = vpn.Username; Lbldep.Text = vpn.DepartmentTitle; VStudentsRepository vstdir = new VStudentsRepository(); VStudent std = vstdir.FindByid(Session["UserID"].ToString().ToInt()); if (std != null) { Label7.Text = std.FirstName.ToString() + " " + std.LastName.ToString(); } else { Redirector.Goto(Redirector.PageName.errorpage); } DepartmentsRepository etr = new DepartmentsRepository(); DataTable dt = etr.GetAllDepartment(); ddldepartment.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddldepartment.Items.Add(new ListItem(dr["DepartmentTitle"].ToString(), dr["DepartmentID"].ToString())); } switch ((Session["UserType"].ToString())) { case "1": { DropDownList1.SelectedValue = "1"; VStudentsRepository vstd = new VStudentsRepository(); DataTable dtstd = vstd.GetAllstd(); ddluserid.Items.Clear(); foreach (DataRow dr in dtstd.Rows) { ddluserid.Items.Add(new ListItem(dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), dr["StudentID"].ToString())); } } break; case "2": { DropDownList1.SelectedValue = "2"; VLecturersRepository vlrir = new VLecturersRepository(); DataTable dtlec = vlrir.GetAllLec(); ddluserid.Items.Clear(); foreach (DataRow dr in dtlec.Rows) { ddluserid.Items.Add(new ListItem(dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), dr["LecturerID"].ToString())); } } break; case "3": { DropDownList1.SelectedValue = "3"; VEmployeesRepository verir = new VEmployeesRepository(); DataTable dtemp = verir.GetAllEmp(); ddluserid.Items.Clear(); foreach (DataRow dr in dtemp.Rows) { ddluserid.Items.Add(new ListItem(dr["FirstName"].ToString() + " " + dr["LastName"].ToString(), dr["EmployeeID"].ToString())); } } break; } } catch { Redirector.Goto(Redirector.PageName.errorpage); } }