Exemple #1
0
        public EmailContact FindByEmailContactID(string username, string password, int id)
        {
            WebServiceAccountsRepository webir       = new WebServiceAccountsRepository();
            WebServiceAccount            currentuser = webir.FindByUserName(username);

            if (currentuser != null)
            {
                if (currentuser.Password == password)
                {
                    EmailContactsRepository depir = new EmailContactsRepository();
                    return(depir.FindByid(id));
                }
                else
                {
                    return(null);
                }
            }

            else
            {
                return(null);
            }
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
        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);
            }
        }