示例#1
0
        public void GetOIMFromAdminCustomData()
        {
            var adminCustomRepository = new AdminCustomRepository(IrmaContext, Log.GetLogger(this.GetType()));
            var val = adminCustomRepository.GetByName(VerifierRole.OIM.ToString());

            Assert.IsNotNull(val);
        }
示例#2
0
        private void AddRigManagerToChecklist(RigOapChecklist rigOapChecklist)
        {
            var rigManager = AdminCustomRepository.GetByName(VerifierRole.RigManager.ToString());

            if (rigManager != null && !string.IsNullOrEmpty(rigManager.Value))
            {
                var rmPassportId = rigManager.Value;
                var rmUser       = PeopleRepository.GetByLogin(rmPassportId);
                var rmOrder      = rigOapChecklist.VerifiedBy?.Count() + 100 ?? 100;

                if ((rigOapChecklist.VerifiedBy != null) && rigOapChecklist.VerifiedBy.Any())
                {
                    //Check if the Rig Manager User Exists
                    if (!rigOapChecklist.VerifiedBy.Any(v => v.UserId == rmUser.Id && v.Role.Equals(rigManager.Name, StringComparison.InvariantCultureIgnoreCase)))
                    {
                        rigOapChecklist.VerifiedBy.Add(new RigOapChecklistVerifier()
                        {
                            Id = Guid.NewGuid(), RigOapChecklistId = rigOapChecklist.Id, Role = VerifierRole.RigManager.ToString(), isReviewer = true, UserId = rmUser.Id, Order = rmOrder
                        });
                    }
                }
                else
                {
                    rigOapChecklist.VerifiedBy = new List <RigOapChecklistVerifier>()
                    {
                        new RigOapChecklistVerifier()
                        {
                            Id = Guid.NewGuid(), RigOapChecklistId = rigOapChecklist.Id, Role = VerifierRole.RigManager.ToString(), isReviewer = true, UserId = rmUser.Id, Order = rmOrder
                        }
                    };
                }
            }
        }
        public override Guid Add(RigOapChecklistQuestionFinding entity)
        {
            var rigManagerPassport = AdminCustomRepository.GetByName("RigManager")?.Value;

            if (!string.IsNullOrEmpty(rigManagerPassport))
            {
                entity.ReviewedByUserId = PeopleRepository.GetByLogin(rigManagerPassport)?.Id ?? 0;
            }

            return(base.Add(entity));
        }
示例#4
0
        private void AddMasterToChecklist(RigOapChecklist rigChecklist)
        {
            var master = AdminCustomRepository.GetByName(VerifierRole.Master.ToString());

            if (master != null && !string.IsNullOrEmpty(master.Value))
            {
                var masterPassport = master.Value;
                var masterUser     = PeopleRepository.GetByLogin(masterPassport);
                var masterOrder    = rigChecklist.VerifiedBy?.Count() + 1 ?? 1;

                rigChecklist.AddVerifier(masterUser.Id, VerifierRole.Master.ToString(), masterOrder);
            }
        }
示例#5
0
        private void AddOIMToChecklist(RigOapChecklist rigOapChecklist)
        {
            var oim = AdminCustomRepository.GetByName(VerifierRole.OIM.ToString());

            //OIM
            if (oim != null)
            {
                if (!string.IsNullOrEmpty(oim.Value))
                {
                    var oimPassport = oim.Value;
                    var oimUser     = PeopleRepository.GetByLogin(oimPassport);
                    var oimOrder    = rigOapChecklist.VerifiedBy?.Count() + 50 ?? 50;

                    if ((rigOapChecklist.VerifiedBy != null) && rigOapChecklist.VerifiedBy.Any())
                    {
                        //Check if the OIM User Exists
                        if (!rigOapChecklist.VerifiedBy.Any(v => v.UserId == oimUser?.Id && v.Role.Equals(oim.Name, StringComparison.InvariantCultureIgnoreCase)))
                        {
                            rigOapChecklist.VerifiedBy.Add(new RigOapChecklistVerifier()
                            {
                                Id = Guid.NewGuid(), RigOapChecklistId = rigOapChecklist.Id, Role = VerifierRole.OIM.ToString(), isReviewer = true, UserId = oimUser.Id, Order = oimOrder
                            });
                        }
                    }
                    else
                    {
                        rigOapChecklist.VerifiedBy = new List <RigOapChecklistVerifier>()
                        {
                            new RigOapChecklistVerifier()
                            {
                                Id = Guid.NewGuid(), RigOapChecklistId = rigOapChecklist.Id, Role = VerifierRole.OIM.ToString(), isReviewer = true, UserId = oimUser.Id, Order = oimOrder
                            }
                        };
                    }
                }
            }
        }