示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string GY = Request.QueryString["Year"];

                Student_DBEntities S = new Student_DBEntities();
                var GYL = S.Students.GroupBy(x => x.Graduation_Year);
                foreach (var i in GYL)
                {
                    Grad_Year_DDL.Items.Add(i.Key.ToString());
                }
                if (GY != null)
                {
                    Grad_Year_DDL.ClearSelection();
                    Grad_Year_DDL.Items.FindByText(GY).Selected = true;
                }
                else
                {
                    Grad_Year_DDL.ClearSelection();
                    Grad_Year_DDL.Items.FindByText(GYL.First().Key.ToString()).Selected = true;
                }
                int Grad_year = Convert.ToInt32(Grad_Year_DDL.SelectedItem.Text);
                year_grads_count  = S.Students.ToList().Where(x => x.Graduation_Year == Grad_year).Count();
                total_grads_count = S.Students.ToList().Count();
                ratio             = ((float)year_grads_count / (float)total_grads_count) * 100;
            }
        }
示例#2
0
        protected void ADD_BTN_Click(object sender, EventArgs e)
        {
            Student_DBEntities S       = new Student_DBEntities();
            Student            student = new Student();

            student.Name     = TextBoxName.Text;
            student.Phone    = TextBoxPhone.Text;
            student.Email    = TextBoxEmail.Text;
            student.Courses  = TextBoxCourses.Text;
            student.division = TextBoxDivision.Text;
            student.Score    = TextBoxScore.Text;
            student.Job      = TextBoxJob.Text;
            if (TextBoxGradYear.Text != "")
            {
                student.Graduation_Year = Convert.ToInt32(TextBoxGradYear.Text);
            }
            else
            {
                student.Graduation_Year = 0;
            }
            student.Degree = TextBoxDegree.Text;
            S.Students.Add(student);
            S.SaveChanges();
            Response.Redirect("Display");
        }
示例#3
0
        protected void EDIT_BTN_Click(object sender, EventArgs e)
        {
            Student_DBEntities S = new Student_DBEntities();
            int     ID           = Convert.ToInt32(Request.QueryString["ID"]);
            Student student      = S.Students.FirstOrDefault(x => x.Id == ID);

            student.Name            = TextBoxName.Text;
            student.Phone           = TextBoxPhone.Text;
            student.Email           = TextBoxEmail.Text;
            student.Courses         = TextBoxCourses.Text;
            student.division        = TextBoxDivision.Text;
            student.Score           = TextBoxScore.Text;
            student.Job             = TextBoxJob.Text;
            student.Graduation_Year = Convert.ToInt32(TextBoxGradYear.Text);
            student.Degree          = TextBoxDegree.Text;
            S.SaveChanges();
            Response.Redirect("Display");
        }
示例#4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string ID_S = Request.QueryString["ID"];
         if (ID_S != null)
         {
             edit = true;
             int ID = Convert.ToInt32(ID_S);
             Student_DBEntities S = new Student_DBEntities();
             var Student          = S.Students.FirstOrDefault(x => x.Id == ID);
             TextBoxName.Text     = Student.Name;
             TextBoxPhone.Text    = Student.Phone;
             TextBoxEmail.Text    = Student.Email;
             TextBoxCourses.Text  = Student.Courses;
             TextBoxDivision.Text = Student.division;
             TextBoxScore.Text    = Student.Score;
             TextBoxJob.Text      = Student.Job;
             TextBoxGradYear.Text = Student.Graduation_Year.ToString();
             TextBoxDegree.Text   = Student.Degree;
         }
     }
 }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string S_Type   = Request.QueryString["S_Type"];
                string Search   = Request.QueryString["S"];
                string RemoveID = Request.QueryString["RemoveID"];

                Student_DBEntities S = new Student_DBEntities();

                if (S_Type != null)
                {
                    SearchTypeDDL.ClearSelection();
                    SearchTypeDDL.Items.FindByText(S_Type).Selected = true;
                }

                if (RemoveID != null)
                {
                    int     R_ID    = Convert.ToInt32(RemoveID);
                    Student student = S.Students.FirstOrDefault(x => x.Id == R_ID);
                    S.Students.Remove(student);
                    S.SaveChanges();
                }

                if (Search == null || Search == "")
                {
                    Students_list = S.Students.ToList();
                }
                else
                {
                    switch (S_Type)
                    {
                    case "الاسم":
                        Students_list = S.Students.ToList().Where(x => x.Name.Contains(Search));
                        break;

                    case "التلفون":
                        Students_list = S.Students.ToList().Where(x => x.Phone == Search);
                        break;

                    case "البريد":
                        Students_list = S.Students.ToList().Where(x => x.Email.Contains(Search));
                        break;

                    case "الدورات التدريبيه":
                        Students_list = S.Students.ToList().Where(x => x.Courses.Contains(Search));
                        break;

                    case "الشعبه":
                        Students_list = S.Students.ToList().Where(x => x.division.Contains(Search));
                        break;

                    case "التقدير":
                        Students_list = S.Students.ToList().Where(x => x.Score.Contains(Search));
                        break;

                    case "الوظيفه":
                        Students_list = S.Students.ToList().Where(x => x.Job.Contains(Search));
                        break;

                    case "سنة التخرج":
                        Students_list = S.Students.ToList().Where(x => x.Graduation_Year == Convert.ToInt32(Search));
                        break;

                    case "الدرجة العلمية":
                        Students_list = S.Students.ToList().Where(x => x.Degree.Contains(Search));
                        break;
                    }
                }
            }
        }