コード例 #1
0
        public async Task SetUpProperties()
        {
            IsReviewNeededForCurrentSpec = false;

            var tempAllCustomers = await CustomerDataAccess.GetAllCurrentAndProspectCustomers();

            AllCustomers = (tempAllCustomers != null) ? tempAllCustomers.ToList() : new List <CustomerModel>();

            var tempAllProcesses = await ProcessDataAccess.GetHydratedProcessesWithCurrentLockedRev();

            AllProcessesWithCurrentRev = (tempAllProcesses != null) ? tempAllProcesses.ToList() : new List <ProcessModel>();

            var tempAllSpecifications = await SpecificationDataAccess.GetAllHydratedSpecs();

            AllSpecifications = (tempAllSpecifications != null) ? tempAllSpecifications.ToList() : new List <SpecModel>();

            if (CurrentSpec != null)
            {
                var spaForSpecResult = await SpecProcessAssignDataAccess.GetAllActiveHydratedSpecProcessAssignForSpec(CurrentSpec.Id);

                if (spaForSpecResult != null && spaForSpecResult.Any())
                {
                    SpecProcessAssignsForCurrentSpec = spaForSpecResult.ToList();
                }

                IsReviewNeededForCurrentSpec = await SpecProcessAssignDataAccess.CheckIfReviewIsNeededForSpecId(CurrentSpec.Id);
            }
        }
コード例 #2
0
        public async Task <ActionResult> OnPostRemove()
        {
            if (SpecProcessAssignmentsToPost != null && SpecProcessAssignmentsToPost.Any())
            {
                await SetUpProperties(); //This is called here so AllSpecProcessAssigns is available to find the assignment(s) being sent back to the API.

                foreach (var assignment in SpecProcessAssignmentsToPost)
                {
                    var allIds       = assignment.Split("-"); //This will be a list of 3 ids: specId, specRevId, specAssignId seperated by a "-"
                    var specId       = int.Parse(allIds[0]);
                    var specRevId    = int.Parse(allIds[1]);
                    var specAssignId = int.Parse(allIds[2]);

                    var theSpecProcessAssignToRemove = AllSpecProcessAssigns.FirstOrDefault(i => i.SpecId == specId && i.SpecRevId == specRevId && i.SpecAssignId == specAssignId);
                    await SpecProcessAssignDataAccess.RemoveReviedNeeded(theSpecProcessAssignToRemove);
                }

                Message = new PopUpMessageModel()
                {
                    IsMessageGood = true,
                    Text          = "Specification-Process Assignments inactivated successfully"
                };
            }

            await SetUpProperties(); //This is called again to update the ReviewNeeded list because some were just removed based on the stuff above.

            return(Page());
        }
コード例 #3
0
        public async Task <ActionResult> OnPostKeep()
        {
            if (SpecProcessAssignmentsToPost != null && SpecProcessAssignmentsToPost.Any())
            {
                await SetUpProperties();

                foreach (var assignment in SpecProcessAssignmentsToPost)
                {
                    var allIds       = assignment.Split("-"); //This will be a list of 3 ids: specId, specRevId, specAssignId seperated by a "-"
                    var specId       = int.Parse(allIds[0]);
                    var specRevId    = int.Parse(allIds[1]);
                    var specAssignId = int.Parse(allIds[2]);

                    var theSpecProcessAssignToRemove = AllSpecProcessAssigns.FirstOrDefault(i => i.SpecId == specId && i.SpecRevId == specRevId && i.SpecAssignId == specAssignId);
                    await SpecProcessAssignDataAccess.CopyAfterReview(theSpecProcessAssignToRemove);
                }

                Message = new PopUpMessageModel()
                {
                    IsMessageGood = true,
                    Text          = "Specification-Process Assignments updated with new revisions successfully"
                };

                return(RedirectToPage("SpecProcessAssignReview", new { aMessage = "Specification-Process Assignments updated with new revisions successfully", isMessageGood = true }));
            }

            return(RedirectToPage("SpecProcessAssignReview", new { aMessage = "Nothing was selected", isMessageGood = false }));
        }
コード例 #4
0
        public async Task SetUpProperties()
        {
            AllNewSpecs           = new List <SpecRevModel>();
            AllNewProcessRevModel = new List <ProcessRevisionModel>();
            AllSpecIds            = new List <int>();

            var tempSpecProcessAssign = await SpecProcessAssignDataAccess.GetAllHydratedReviewNeededSpecProcessAssign();

            AllSpecProcessAssigns = (tempSpecProcessAssign != null) ? tempSpecProcessAssign.ToList() : null;

            if (AllSpecProcessAssigns != null)
            {
                foreach (var specProcessAssign in AllSpecProcessAssigns)
                {
                    if (!AllSpecIds.Contains(specProcessAssign.SpecId))
                    {
                        AllSpecIds.Add(specProcessAssign.SpecId);
                    }
                }

                foreach (var assign in AllSpecProcessAssigns)
                {
                    //Finding out if the spec is under review because of a spec rev up or a process rev up.
                    var theNewestSpecRev = (await SpecDataAccess.GetHydratedCurrentRevOfSpec(assign.SpecId)).SpecRevModels.FirstOrDefault();
                    if (theNewestSpecRev.InternalRev != assign.SpecRevId)
                    {
                        assign.IsViable = false;
                        if (!AllNewSpecs.Contains(theNewestSpecRev))
                        {
                            AllNewSpecs.Add(theNewestSpecRev);
                        }
                    }

                    var theNewestProcessRev = await ProcessDataAccess.GetHydratedCurrentProcessRev(assign.ProcessId);

                    if (theNewestProcessRev.ProcessRevId != assign.ProcessRevId)
                    {
                        AllNewProcessRevModel.Add(theNewestProcessRev);
                    }
                }
            }
        }
コード例 #5
0
        public async Task <ActionResult> OnPost()
        {
            var optionModels = new List <SpecProcessAssignOptionModel>();

            if (ChoiceId1 != null)
            {
                optionModels.Add(new SpecProcessAssignOptionModel()
                {
                    SpecId        = SpecId,
                    SpecRevId     = SpecInternalRevId,
                    SubLevelSeqId = 1, //TODO: Should this be hard-coded to 1?
                    ChoiceSeqId   = (byte)ChoiceId1
                });
            }

            if (ChoiceId2 != null)
            {
                optionModels.Add(new SpecProcessAssignOptionModel()
                {
                    SpecId        = SpecId,
                    SpecRevId     = SpecInternalRevId,
                    SubLevelSeqId = 2, //TODO: Should this be hard-coded to 2?
                    ChoiceSeqId   = (byte)ChoiceId2
                });
            }

            if (ChoiceId3 != null)
            {
                optionModels.Add(new SpecProcessAssignOptionModel()
                {
                    SpecId        = SpecId,
                    SpecRevId     = SpecInternalRevId,
                    SubLevelSeqId = 3, //TODO: Should this be hard-coded to 3?
                    ChoiceSeqId   = (byte)ChoiceId3
                });
            }

            if (ChoiceId4 != null)
            {
                optionModels.Add(new SpecProcessAssignOptionModel()
                {
                    SpecId        = SpecId,
                    SpecRevId     = SpecInternalRevId,
                    SubLevelSeqId = 4, //TODO: Should this be hard-coded to 4?
                    ChoiceSeqId   = (byte)ChoiceId4
                });
            }

            if (ChoiceId5 != null)
            {
                optionModels.Add(new SpecProcessAssignOptionModel()
                {
                    SpecId        = SpecId,
                    SpecRevId     = SpecInternalRevId,
                    SubLevelSeqId = 5, //TODO: Should this be hard-coded to 5?
                    ChoiceSeqId   = (byte)ChoiceId5
                });
            }

            if (ChoiceId6 != null)
            {
                optionModels.Add(new SpecProcessAssignOptionModel()
                {
                    SpecId        = SpecId,
                    SpecRevId     = SpecInternalRevId,
                    SubLevelSeqId = 6, //TODO: Should this be hard-coded to 6?
                    ChoiceSeqId   = (byte)ChoiceId6
                });
            }

            var theSpecProcessAssignModel = new Armis.BusinessModels.QualityModels.Spec.SpecProcessAssignModel()
            {
                SpecId       = SpecId,
                SpecRevId    = SpecInternalRevId,
                CustomerId   = CustomerId,
                ProcessId    = ProcessId,
                ProcessRevId = ProcessRevId,
                SpecProcessAssignOptionModels = optionModels
            };

            var areChoicesUnique = await SpecProcessAssignDataAccess.VerifyUniqueChoices(SpecId, SpecInternalRevId, CustomerId ?? 0, optionModels);

            if (ModelState.IsValid && areChoicesUnique)
            {
                await SpecProcessAssignDataAccess.PostSpecProcessAssign(theSpecProcessAssignModel);

                return(RedirectToPage("/Quality/Specification/SpecProcessAssign", new { aMessage = "Specification-Process assignment saved successfully", isMessageGood = true }));
            }
            else
            {
                if (!ModelState.IsValid)
                {
                    Message = new PopUpMessageModel()
                    {
                        Text          = "Process is required",
                        IsMessageGood = false
                    };

                    await SetUpProperties();

                    return(Page());
                }
                else if (!areChoicesUnique)
                {
                    return(RedirectToPage("/Quality/Specification/SpecProcessAssign", new { aMessage = "Another Specificaiton-Process assignment has already been created with those options", isMessageGood = false }));
                }

                return(RedirectToPage("/Error", new { ExMessage = "An unknown error occured" }));
            }
        }
コード例 #6
0
        public async Task SetUpProperties()
        {
            var tempSpecProcessAssign = await SpecProcessAssignDataAccess.GetAllActiveHydratedSpecProcessAssigns();

            AllSpecProcessAssigns = tempSpecProcessAssign.ToList();
        }