Example #1
0
 public UserRepository(UserManager <Users> userManager, SQLHoshinCoreContext ctx, IMapper mapper, RoleManager <Roles> roleManager)
 {
     _userManager = userManager;
     _roleManager = roleManager;
     _ctx         = ctx;
     _mapper      = mapper;
 }
        private AuditStates ValidateDescriptionAuditState(SQLHoshinCoreContext _ctx, IMapper _mapper, AuditState auditState)
        {
            AuditStates auditStateValidation = _ctx.AuditStates.Where(x => (x.Name == auditState.Name || x.Code == auditState.Code || x.Color == auditState.Color) && x.AuditStateID != auditState.AuditStateID).FirstOrDefault();

            if (auditStateValidation == null)
            {
                return(_mapper.Map <AuditState, AuditStates>(auditState));
            }

            return(null);
        }
        private void SetAuditInitiated(int auditId, SQLHoshinCoreContext ctx)
        {
            var audit          = ctx.Audits.FirstOrDefault((x) => x.AuditID == auditId);
            var stateInitiated = ctx.AuditStates.FirstOrDefault(x => x.Code == "INI").AuditStateID;

            if (audit.AuditStateID != stateInitiated)
            {
                audit.AuditStateID = stateInitiated;
                ctx.Update(audit);
            }
        }
Example #4
0
 private IQueryable <Findings> MakeGetAllQuery(SQLHoshinCoreContext _ctx)
 {
     return(_ctx.Findings
            .Include(x => x.EmitterUser)
            .ThenInclude(x => x.JobSectorPlant.SectorPlant.Sector)
            .Include(x => x.EmitterUser)
            .ThenInclude(x => x.JobSectorPlant.SectorPlant.Plant)
            .Include(x => x.ResponsibleUser)
            .Include(x => x.FindingType)
            .Include(x => x.FindingState)
            .Include(x => x.FindingComments)
            .Include(x => x.SectorPlantTreatment)
            .ThenInclude(y => y.Sector)
            .Include(x => x.SectorPlantTreatment)
            .ThenInclude(y => y.Plant)
            .Where(f => f.WorkflowId != null));
 }
Example #5
0
        private string ValidateStandard(SQLHoshinCoreContext _ctx, IMapper _mapper, Standard standard)
        {
            string    validation         = string.Empty;
            Standards standardValidation = _ctx.Standards.Where(x => (x.Name == standard.Name || x.Code == standard.Code) && x.StandardID != standard.StandardID).FirstOrDefault();

            validation = standardValidation != null ? "NameExist" : string.Empty;

            if (!string.IsNullOrEmpty(validation))
            {
                return(validation);
            }

            validation = standard.Aspects.Count() == standard.Aspects.Where(x => !x.Active).Count() ? "OneActive" : string.Empty;

            if (!string.IsNullOrEmpty(validation))
            {
                return(validation);
            }

            return(validation);
        }
 public CompanyRepository(SQLHoshinCoreContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }
 public UserCorrectiveActionsRepository(SQLHoshinCoreContext ctx)
 {
     _ctx = ctx;
 }
Example #8
0
 public RoleRepository(RoleManager <Roles> roleManager, IMapper mapper, SQLHoshinCoreContext ctx)
 {
     _roleManager = roleManager;
     _mapper      = mapper;
     _ctx         = ctx;
 }
Example #9
0
 public CorrectiveActionFishboneRepository(SQLHoshinCoreContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }
Example #10
0
        public GetUpdatedJobsOfSectorTest()
        {
            var optionsBuilder = new DbContextOptionsBuilder <SQLHoshinCoreContext>()
                                 .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                 .Options;

            _ctx = new SQLHoshinCoreContext(optionsBuilder);

            jobs          = new List <Domain.Job.Job>();
            sectorsPlants = new SectorsPlants();
            jobsDbSet     = new List <Jobs>
            {
                new Jobs {
                    JobID = 1
                },
                new Jobs {
                    JobID = 2
                },
                new Jobs {
                    JobID = 3
                },
                new Jobs {
                    JobID = 4
                },
                new Jobs {
                    JobID = 5
                },
                new Jobs {
                    JobID = 6
                },
                new Jobs {
                    JobID = 7
                },
                new Jobs {
                    JobID = 8
                },
                new Jobs {
                    JobID = 9
                },
                new Jobs {
                    JobID = 10
                }
            };

            _ctx.Jobs.AddRange(jobsDbSet);
            _ctx.SaveChanges();

            sectorsPlants.JobsSectorsPlants = new List <JobsSectorsPlants>();
            sectorsPlants.JobsSectorsPlants.Add(new JobsSectorsPlants
            {
                PlantID  = 1,
                SectorID = 1,
                JobID    = 1,
            });

            sectorsPlants.JobsSectorsPlants.Add(new JobsSectorsPlants
            {
                PlantID  = 1,
                SectorID = 1,
                JobID    = 2,
            });

            sectorsPlants.JobsSectorsPlants.Add(new JobsSectorsPlants
            {
                PlantID  = 1,
                SectorID = 1,
                JobID    = 3,
            });

            sectorsPlants.JobsSectorsPlants.Add(new JobsSectorsPlants
            {
                PlantID  = 1,
                SectorID = 1,
                JobID    = 4,
            });
        }
Example #11
0
 public AuditTypeRepository(SQLHoshinCoreContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }
 public ParametrizationCriteriaRepository(SQLHoshinCoreContext ctx)
 {
     _ctx = ctx;
 }
 public AlertUserRepository(SQLHoshinCoreContext ctx, IMapper mapper)
 {
     _ctx    = ctx;
     _mapper = mapper;
 }