public async Task <IActionResult> SeeAttendenceInfo(int id, DateTime Month)
        {
            ViewBag.count = _attendenceRepository.AttendenceCount();
            ViewBag.P     = _attendenceRepository.PresentCount(id);
            //ViewBag.A = _attendenceRepository.AbsentCount(id);
            ViewBag.L  = _attendenceRepository.LeaveCount(id);
            ViewBag.W  = _attendenceRepository.HoursCount(id);
            ViewBag.IO = _attendenceRepository.InOutCount(id);
            String monthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Month.Month);

            if (Month != DateTime.MinValue)
            {
                ViewBag.subtitle = "Attendence of " + monthName + " , " + Month.Year;
                var data = await _attendenceRepository.GetAttInfo2(id, Month);

                if (data == null)
                {
                    ViewBag.a = DateTime.MinValue;
                    return(RedirectToAction(nameof(SeeAttendenceInfo)));
                }
                else
                {
                    ViewBag.a = Month;
                    return(View(data));
                }
            }
            ViewBag.a = Month;
            return(View());
        }
Exemple #2
0
        public async Task <IActionResult> AttendenceInfo(DateTime Month)
        {
            string user        = User.FindFirst("Index").Value;
            var    Currentuser = await _taskRepository.GetCurrentUser(user);

            ViewBag.photo = Currentuser.PhotoURL;
            int EmpId = Currentuser.EmpId;

            ViewBag.P = _attendenceRepo.PresentCount(Currentuser.EmpId);
            //  ViewBag.A = _attendenceRepo.AbsentCount(Currentuser.EmpId);
            ViewBag.L  = _attendenceRepo.LeaveCount(Currentuser.EmpId);
            ViewBag.W  = _attendenceRepo.HoursCount(Currentuser.EmpId);
            ViewBag.IO = _attendenceRepo.InOutCount(Currentuser.EmpId);
            String monthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Month.Month);

            if (Month != DateTime.MinValue)
            {
                ViewBag.Month    = Month;
                ViewBag.subtitle = "Attendence of " + monthName + " , " + Month.Year;
                var data = await _attendenceRepo.GetAttInfo(EmpId, Month);

                if (data == null)
                {
                    ViewBag.a = DateTime.MinValue;
                    return(RedirectToAction(nameof(AttendenceInfo)));
                }
                else
                {
                    ViewBag.a = Month;
                    return(View(data));
                }
            }
            ViewBag.a = Month;
            return(View());
        }