示例#1
0
    protected void btnsave_Click(object sender, EventArgs e)
    {
        SchoolInformation info   = new SchoolInformation();
        MyDate            mydate = new MyDate();

        foreach (ListViewItem item in ListView1.Items)
        {
            Button btnActive = (Button)item.FindControl("btnActive");
            if (btnActive.Text == "غياب")
            {
                StudentsAbsence abs   = new StudentsAbsence();
                RadioButtonList radio = ((RadioButtonList)item.FindControl("radio"));
                abs.SemesterId = MyDate.getCurrentSemesterId();
                abs.SchoolId   = info.getId();
                abs.StudentId  = int.Parse(((HiddenField)item.FindControl("HiddenField1")).Value).ToString();
                abs.Date       = DateTime.Now;
                abs.IsExcuse   = Convert.ToBoolean(radio.SelectedValue);
                km.StudentsAbsences.Add(abs);
                km.SaveChanges();
            }
            else if (btnActive.Text == "حضور")
            {
                StudentsAttendence att = new StudentsAttendence();
                att.Date       = DateTime.Now;
                att.SchoolId   = info.getId();
                att.SemesterId = MyDate.getCurrentSemesterId();
                att.StudentId  = ((HiddenField)item.FindControl("HiddenField1")).Value;
                //TextBox txtArrive = (TextBox)item.FindControl("txtarrivingTime");
                //if (!String.IsNullOrEmpty(txtArrive.Text))
                //att.ArrivingTime = Convert.ToDateTime(txtArrive.Text).TimeOfDay;
                //TextBox txtDeparture = (TextBox)item.FindControl("txtdeptime");
                //if (!String.IsNullOrEmpty(txtDeparture.Text))
                //    att.DepartureTime = Convert.ToDateTime(txtDeparture.Text).TimeOfDay;
                km.StudentsAttendences.Add(att);
                km.SaveChanges();
            }
            else if (btnActive.Text == "تأخر")
            {
                StudentsLateness late = new StudentsLateness();

                if (!String.IsNullOrEmpty(((TextBox)item.FindControl("TimeLate")).Text))
                {
                    late.TotalSeconds = Convert.ToDateTime(((TextBox)item.FindControl("TimeLate")).Text).TimeOfDay.TotalSeconds;
                    late.Amount       = Convert.ToDateTime(((TextBox)item.FindControl("TimeLate")).Text).TimeOfDay;
                }

                late.Date       = DateTime.Now;
                late.SchoolId   = info.getId();
                late.SemesterId = MyDate.getCurrentSemesterId();
                late.StudentId  = ((HiddenField)item.FindControl("HiddenField1")).Value;
                km.StudentsLatenesses.Add(late);
                km.SaveChanges();
            }
            //    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('تم التسجيل بنجاح')", true);
        }

        Response.Redirect("~/Student/StudentAttendenceReport.aspx");
    }
示例#2
0
        // GET: Attendences/Details/5
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StudentsAttendence studentAttendence = db.GetStudentAttendence(id);

            if (studentAttendence == null)
            {
                return(HttpNotFound());
            }
            return(View(studentAttendence));
        }
示例#3
0
        public ActionResult AttendencePage(string groupID, int timetableID)
        {
            List <Student>            studentList            = db.GetGroupStudent(groupID);
            Timetable                 timetable              = db.GetTimetable(timetableID);
            Module                    module                 = db.GetModule(timetable.ModuleID);
            List <StudentsAttendence> studentsAttendenceList = new List <StudentsAttendence>();

            foreach (Student student in studentList)
            {
                StudentsAttendence studentAttendence = new StudentsAttendence(student.StudentID, timetable.TimeTableId, student.FirstName, student.LastName, timetable.ClassStartTime, timetable.ClassEndTime, module.ModuleName, DateTime.Now, "p");
                studentsAttendenceList.Add(studentAttendence);
            }
            ViewBag.ModuleName     = module.ModuleName;
            ViewBag.ClassStartTime = timetable.ClassStartTime;
            ViewBag.ClassEndTime   = timetable.ClassEndTime;
            ViewBag.Date           = DateTime.Now;

            return(View(studentsAttendenceList));
        }