public ActionResult Detail(long personnelId, DateTime fromdate, DateTime dateto)
        {
            try
            {
                GenForm();
                ViewData["personnelId"] = personnelId;
                ViewData["fromdate"]    = fromdate;
                ViewData["dateto"]      = dateto;

                var biometricData = _service.GetBiometricData(personnelId, fromdate, dateto);

                var obligatedRange = _service.GetObligatedRange(personnelId);

                List <BiometryCalculatedDetail> taradodInfoCalculated =
                    _service.CompareAndJoin(fromdate, dateto, biometricData, obligatedRange);

                BiometryCalculatedDetail totalCalculated = _service.CalculateTotal(taradodInfoCalculated);


                ViewData[PersonnelTaradodInfoController.total] = totalCalculated;
                ViewData[PersonnelTaradodInfoController.obligatedRangeName] = obligatedRange;
                ViewData[PersonnelTaradodInfoController.taradodInfo]        = taradodInfoCalculated;
            }
            catch (Exception e)
            {
                ViewData["error"] = e.Message;
            }


            return(View("Index"));
        }
        public void TestPersonnelWorkDetail()
        {
            var fakeBiometricRepository = new FakeBiometricRepository();

            fakeBiometricRepository.init();

            var c = new PersonnelTaradodInfoService();

            var personnelId   = fakeBiometricRepository.personnel.Id;
            var fromDate      = DateTime.Now.AddDays(-1);
            var toDate        = DateTime.Now.AddDays(1);
            var biometricData = c.GetBiometricData(personnelId, fromDate, toDate);

            var tmpday = DateTime.Now.AddDays(2);

            Assert.DoesNotContain(biometricData, b => b.Date > tmpday);


            ObligatedRange obligatedRange = c.GetObligatedRange(personnelId);

            Assert.NotNull(obligatedRange);
            Assert.True(obligatedRange.ObligatedRangeWeeks.Count >= 7);

            List <BiometryCalculatedDetail> taradodInfo = c.CompareAndJoin(fromDate, toDate, biometricData, obligatedRange);

            //   Assert.True(taradodInfo.Count==biometricData.Count());


            BiometryCalculatedDetail total = c.CalculateTotal(taradodInfo);
        }
        public void MultiWeekPersonnelTaradodTestDetail()
        {
            // ایجاد دیتای فیک
            var fakeBiometricRepository = new MultiWeekFakeBiometricRepository();

            fakeBiometricRepository.init();



            // اطلاعات از تاریخ تا تاریخ را بده برای پرسنل خاص
            var c             = new PersonnelTaradodInfoService();
            var personnelId   = fakeBiometricRepository.personnel.Id;
            var fromDate      = DateTime.Now;
            var toDate        = DateTime.Now.AddDays(15);
            var biometricData = c.GetBiometricData(personnelId, fromDate, toDate);


            // بازه موظفی شخص
            ObligatedRange obligatedRange = c.GetObligatedRange(personnelId);

            Assert.NotNull(obligatedRange);
            Assert.True(obligatedRange.ObligatedRangeWeeks.Count >= 14);


            // محاسبه اطلاعات
            List <BiometryCalculatedDetail> taradodInfo = c.CompareAndJoin(fakeBiometricRepository.workgroupRange.DateTime.Value, toDate, biometricData, obligatedRange);

            // روز اول
            var firstDay = taradodInfo.ElementAt(1);

            /*ValidateFirst(firstDay);
             *
             * var nineDay=taradodInfo.ElementAt(9);
             * ValidateNine(nineDay);*/


            //   Assert.True(taradodInfo.Count==biometricData.Count());


            // محاسبه جمع
            BiometryCalculatedDetail total = c.CalculateTotal(taradodInfo);
        }