Exemplo n.º 1
0
        public ActionResult AddAttendence(string course, string degree, string batch)
        {
            using (CMSEntities db = new CMSEntities())
            {
                assigned_course assCourse = db.assigned_course.Where(x => x.course == course && x.degree1.title == degree && x.batch1.name == batch).FirstOrDefault();

                if (assCourse != null)
                {
                    List <student> studentList = db.students.Where(x => x.degree1.title == degree && x.batch1.name == batch).ToList();

                    List <attendence> model = new List <attendence>();
                    for (int i = 0; i < studentList.Count; i++)
                    {
                        attendence atten = new attendence();
                        atten.ass_course_id   = assCourse.Id;
                        atten.rollno          = studentList[i].rollno;
                        atten.status          = false;
                        atten.assigned_course = assCourse;
                        atten.student         = studentList[i];
                        atten.date            = DateTime.Now;

                        model.Add(atten);
                    }
                    return(View(model));
                }
            }
            return(View());
        }
Exemplo n.º 2
0
        public ActionResult Attendance(attendence obj, HttpPostedFileBase attendfile)
        {
            try
            {
                string PhotoPath      = Server.MapPath("~/Docs/Images/");
                string PhotoName      = Guid.NewGuid() + Path.GetFileName(attendfile.FileName); //3l4an lw atb3t tokins m3 asm l swra y4lha
                string FinalPhotoPath = Path.Combine(PhotoPath, PhotoName);
                attendfile.SaveAs(FinalPhotoPath);
                if (ModelState.IsValid)
                {
                    obj.attendfile = PhotoName;
                    db.attendence.Add(obj);
                    db.SaveChanges();
                    ModelState.Clear();
                    return(RedirectToAction("Grades"));
                }
                return(View(obj));
            }

            catch (Exception ex)
            {
                ViewBag.AttendType = new SelectList(db.attendtype, "id", "TypeOfAttend");
                return(View(obj));
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            attendence attendence = db.attendences.Find(id);

            db.attendences.Remove(attendence);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult EditAttendence(AttendenceDTO s, int id)
        {
            attendence result = _db.attendences.Single(attendence => attendence.id == id);

            result.id          = s.attendenceData.id;
            result.date        = s.attendenceData.date;
            result.aattendence = s.attendenceData.aattendence;
            result.emp_id      = s.attendenceData.emp_id;
            _db.SaveChanges();
            return(RedirectToAction("Index", "Attendence"));
        }
 public ActionResult Edit([Bind(Include = "Attendence_Id,Employee_Id,Present_Id,Attendence_Date")] attendence attendence)
 {
     if (ModelState.IsValid)
     {
         db.Entry(attendence).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Employee_Id = new SelectList(db.employees, "Employee_Id", "Employee_Name", attendence.Employee_Id);
     ViewBag.Present_Id  = new SelectList(db.presents, "Present_Id", "Value", attendence.Present_Id);
     return(View(attendence));
 }
        // GET: attendences/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            attendence attendence = db.attendences.Find(id);

            if (attendence == null)
            {
                return(HttpNotFound());
            }
            return(View(attendence));
        }
        // GET: attendences/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            attendence attendence = db.attendences.Find(id);

            if (attendence == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Employee_Id = new SelectList(db.employees, "Employee_Id", "Employee_Name", attendence.Employee_Id);
            ViewBag.Present_Id  = new SelectList(db.presents, "Present_Id", "Value", attendence.Present_Id);
            return(View(attendence));
        }
 public void add(attendence entity)
 {
     atn.Insert(entity.Studentid, entity.Batchid, entity.Branchid, entity.Totaldays
                , entity.Attendence, entity.Percentage);
 }