public string find(int s_id = -1, int class_id = -1, string date = "")
        {
            if (s_id < 0 || date == "" || class_id < 0)
            {
                return false.ToJSON();
            }

            if (Session[Configuration.SESSION_USER_ID] == null)
            {
                return false.ToJSON();
            }
            int school_id = SessionHandler.GetSchoolID();
            var result = _ad.FindSingle(s_id, school_id, date);
            if (result == null)
            {
                Attendance atnd = new Attendance();
                atnd.class_id = class_id;
                atnd.school_id = school_id;
                atnd.student_id = s_id;
                atnd.status = AttendanceStatus.NONE;
                atnd.updated_by = SessionHandler.GetUserID();
                atnd.date = date;
                result = _ad.InsertData(atnd);
            }
            return result.ToJSON();
        }
        public ActionResult MarkClass(int class_id = 0, string date = "")
        {
            if (Session[Configuration.SESSION_USER_ID] == null)
            {
                return RedirectToAction("Index", "Login");
            }

            ClassDetails _cd = new ClassDetails();
            int school_id = SessionHandler.GetSchoolID();
            ViewBag.class_id = class_id;
            ViewBag.date = date;

            ViewBag.classes = _cd.GetAll(school_id);
            ViewBag.Days = 0;

            if (class_id != 0)
            {
                var result = _ad.GetAll(school_id, class_id).ToList();
                var _sd = new StudentDetails();
                var stds = _sd.GetAll(school_id, class_id);

                var adResult = _ad.GetAll(school_id, class_id, date).ToList();

                //int daysInMonth = this.GetDaysInMonth(date);
                ViewBag.Days = 1;

                var day = date.GetDayOfMonth();
                List<StudentOneDay> attendance = new List<StudentOneDay>();
                foreach (var std in stds)
                {
                    StudentOneDay stdAttnd = new StudentOneDay() { student_name = std.first_name + " " + std.last_name, student_id = std.user_id, status = -1 };
                    attendance.Add(stdAttnd);

                    var isExsited = false;
                    foreach (var adr in adResult)
                    {
                        if (std.user_id == adr.student_id)
                        {
                            isExsited = true;
                        }
                    }
                    if (!isExsited)
                    {
                        Attendance atd = new Attendance() { student_id = std.user_id, school_id = SessionHandler.GetSchoolID(), status = -1, class_id = class_id, date = date, updated_by = SessionHandler.GetUserID() };
                        _ad.Insert(atd);
                    }
                }
                return View(attendance);
            }
            return View();
        }
        public string MarkClass(IEnumerable<StudentOneDay> attendance, string date = "", int class_id = 0)
        {
            if (date == "" || !ModelState.IsValid)
            {
                return false.ToJSON();
            }
            else
            {
                List<Attendance> attnd = new List<Attendance>();
                foreach (var atnd in attendance)
                {
                    atnd.status = atnd.fstatus == false ? 0 : 1;
                    Attendance atd = new Attendance() { student_id = atnd.student_id, school_id = SessionHandler.GetSchoolID(), status = atnd.status, class_id = class_id, date = date, updated_by = SessionHandler.GetUserID() };
                    _ad.Update(atd);
                    // attnd.Add(atd);
                }

            }
            return "";
        }