public ActionResult Index()
        {
            if (Session["User_id"] == null)
            {
                return(RedirectToAction("Index", "Login"));
            }
            else
            {
                AP_Menu        menu        = new AP_Menu();
                var            Menulist    = db.user_rights(Convert.ToInt32(Session["User_id"]));
                List <AP_Menu> menudisplay = menu.Menutree(Menulist, null);

                Attendance_data count_user = db.Get_all_users();
                ViewBag.allusers = count_user.att_id;

                Attendance_data courses = db.Get_Valid_Course();
                ViewBag.allcourses = courses.att_id;

                Attendance_data helpers = db.Get_Expired_Course();
                ViewBag.allhelper = helpers.att_id;

                Attendance_data attendance = db.Get_all_attendance();
                ViewBag.attendance = attendance.att_id;

                List <Batch_header> bh_hd = db.Incomplete_course();
                ViewBag.incom_cour = bh_hd;
                return(View(menudisplay));
            }
        }
        public ActionResult Index(DateTime?From_Date, DateTime?To_Date, string Batch_Name, string stud_id, string status)
        {
            if (Batch_Name == "0")
            {
                ViewBag.att_report_batch_name = "ALL";
                ViewBag.att_report_ed_date    = "ALL";
            }
            else
            {
                Attendance_data Att_header = db.Get_report_header(Batch_Name);
                ViewBag.att_report_batch_name = Att_header.Batch_name;
                //ViewBag.att_report_ed_date = Att_header.Bh_end_date;
            }

            if (From_Date == null)
            {
                From_Date = DateTime.Now.Date;
            }

            if (To_Date == null)
            {
                To_Date = DateTime.Now.Date;
            }

            if (Batch_Name == "0")
            {
                Batch_Name = "%";
            }

            if (stud_id == "0")
            {
                stud_id = "%";
            }
            ViewBag.From_date  = From_Date;
            ViewBag.to_date    = To_Date;
            ViewBag.Batch_Name = Batch_Name;
            ViewBag.stud_id    = stud_id;
            ViewBag.status     = status;

            List <Att_Report> Att_report = db.report_att_present(Batch_Name, From_Date, To_Date, stud_id, status);

            ViewBag.att_report = Att_report;
            return(View());
        }
        public ActionResult Index(Attendance_data ad)
        {
            bool status = false;

            var att_valid = db.attendance_valid(ad.BH_id);

            if (att_valid.att_id == 1)
            {
                foreach (var i in ad.Attendance_dtl)
                {
                    db.attuserupdate(ad.BH_id, i.Att_status, i.stud_id);
                }
                status = true;
            }
            else
            {
                List <Batch_header> Course_dropdown = db.get_Course_dropdown();
                ViewBag.course = Course_dropdown;

                var att_id = db.AutoGenerate_attendance_id();
                ad.att_id = att_id.att_id;

                db.Insert_attendance(ad);

                foreach (var s in ad.Attendance_dtl)
                {
                    s.bh_id  = ad.BH_id;
                    s.att_id = att_id.att_id;
                    db.Insert_attendance_details(s);
                }
                status = true;
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }