Ejemplo n.º 1
0
        public PartialReport GetPartialReport(PartialReportRequest request)
        {
            PartialReport response = new PartialReport();

            response.BeforeYear = _choresService.GetAll()
                                  .Where(x => x.StartDate.Year == request.Year - 1 && x.Element.Area.Floor.Building.Installation.Id == request.InstallationId).Count();
            response.CurrentRequest = _choresService.GetAll()
                                      .Where(x => x.StartDate.Year == request.Year && x.Element.Area.Floor.Building.Installation.Id == request.InstallationId).Count();
            return(response);
        }
Ejemplo n.º 2
0
        private void CreatePatialReportFromInputData()
        {
            _partialReport = new PartialReport();
            DateTime localDate = DateTime.Now;

            _partialReport.NumberReport    = _numberReport;
            _partialReport.ResultsObtained = TextBoxResults.Text;
            _partialReport.HoursCovered    = 240;
            _partialReport.Observations    = TextBoxObservations.Text;
            _partialReport.DeliveryDate    = localDate;
            _partialReport.IdProject       = _assignment.IdProject;
            _partialReport.Enrollment      = _practicioner.Enrollment;
        }
Ejemplo n.º 3
0
 public bool InitializePartialReportGeneration(string enrrollment)
 {
     try
     {
         ProfessionalPracticesContext professionalPracticesContext = new ProfessionalPracticesContext();
         UnitOfWork unitOfWork = new UnitOfWork(professionalPracticesContext);
         _practicioner = unitOfWork.Practicioners.FindFirstOccurence(Practicioner => Practicioner.Enrollment == enrrollment);
         if (_practicioner != null)
         {
             _assignment = unitOfWork.Assignments.FindFirstOccurence(Assignment => Assignment.Practicioner.Enrollment == _practicioner.Enrollment);
             if (_assignment != null)
             {
                 _teacher = unitOfWork.Teachers.FindFirstOccurence(Teacher => Teacher.StaffNumber == _practicioner.Group.StaffNumber);
                 if (_teacher != null)
                 {
                     PartialReport partialReport = unitOfWork.PartialReports.FindFirstOccurence(PartialReport => PartialReport.Enrollment == _practicioner.Enrollment);
                     if (partialReport != null)
                     {
                         _numberReport = "SEGUNDO";
                         CreateHours(false);
                     }
                     else
                     {
                         _numberReport = "PRIMERO";
                         CreateHours(true);
                     }
                     InitializeAssignment();
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch (IOException)
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
        private bool RegisterActivityMades(UnitOfWork unitOfWork)
        {
            PartialReport partialReport = unitOfWork.PartialReports.FindFirstOccurence(PartialReport => PartialReport.IdProject == _partialReport.IdProject &&
                                                                                       PartialReport.Enrollment.Equals(_partialReport.Enrollment) && PartialReport.NumberReport.Equals(_partialReport.NumberReport));

            if (partialReport != null)
            {
                _partialReport.IdParcialReport = partialReport.IdParcialReport;
                AddIdPartialReportInActivitiesMade();
                unitOfWork.ActivityMades.AddRange(_activityMades);
                int rowsAffected = unitOfWork.Complete();
                unitOfWork.Dispose();
                return(rowsAffected.Equals(_activityMades.Count));
            }
            return(false);
        }
Ejemplo n.º 5
0
        public void RegisterPartialReport_Exists()
        {
            DateTime                     localDate        = DateTime.Now;
            List <PartialReport>         partialReports   = new List <PartialReport>();
            DbSet <PartialReport>        mockSet          = DbContextMock.GetQueryableMockDbSet(partialReports, p => p.IdParcialReport);
            ProfessionalPracticesContext mockContext      = DbContextMock.GetContext(mockSet);
            UnitOfWork                   unitOfWork       = DbContextMock.GetUnitOfWork(mockContext);
            PartialReport                newPartialReport = new PartialReport
            {
                NumberReport    = "PRIMERO",
                ResultsObtained = "Actividades completas",
                HoursCovered    = 240,
                Observations    = "Falto una actividad",
                DeliveryDate    = localDate,
                IdProject       = 1,
                Enrollment      = "zS18012149"
            };

            unitOfWork.PartialReports.Add(newPartialReport);
            int expected = 1;
            int actual   = partialReports.Count;

            Assert.AreEqual(expected, actual);
        }