예제 #1
0
        public MandatoryList GetMandatoryListWithStatusApproveAndChangeRequest()
        {
            List <MandatoryListChangeRequest> mandatoryListChangeRequests = new List <MandatoryListChangeRequest>();
            MandatoryListChangeRequest        changeRequest = new MandatoryListChangeRequest()
            {
                DivisionCode   = "1010",
                DivisionNameAr = "Name Ar",
                DivisionNameEn = "Name En",

                Products = new List <MandatoryListProductChangeRequest>()
                {
                    GetMandatoryListProductChangeRequest(),
                    GetMandatoryListProductChangeRequest()
                }
            };

            changeRequest.Add();
            mandatoryListChangeRequests.Add(changeRequest);
            MandatoryList        mandatoryList = new MandatoryList();
            MandatoryListProduct product       = GetMandatoryListProdcut();

            mandatoryList.ChangeRequests = mandatoryListChangeRequests;
            mandatoryList.Products       = new List <MandatoryListProduct>()
            {
                product,
                product
            };
            mandatoryList.Add();
            mandatoryList.SendToApproval();
            mandatoryList.Approve();
            return(mandatoryList);
        }
예제 #2
0
        public async Task <MandatoryList> Add(MandatoryList entity)
        {
            var addedEntity = _dbContext.MandatoryLists.Add(entity);
            await _dbContext.SaveChangesAsync();

            return(addedEntity.Entity);
        }
예제 #3
0
        public MandatoryList GetMandatoryListWithOutProdcuts()
        {
            MandatoryList mandatoryList = new MandatoryList();

            mandatoryList.Products = new List <MandatoryListProduct>();
            mandatoryList.Add();
            return(mandatoryList);
        }
예제 #4
0
        public MandatoryList GetMandatoryListWithProdcuts()
        {
            MandatoryList        mandatoryList = new MandatoryList();
            MandatoryListProduct product       = GetMandatoryListProdcut();

            mandatoryList.Products = new List <MandatoryListProduct>()
            {
                product,
                product
            };
            mandatoryList.Add();

            return(mandatoryList);
        }
예제 #5
0
        public MandatoryList GetMandatoryListWithStatusRejected()
        {
            MandatoryList        mandatoryList = new MandatoryList();
            MandatoryListProduct product       = GetMandatoryListProdcut();

            mandatoryList.Products = new List <MandatoryListProduct>()
            {
                product,
                product
            };
            mandatoryList.Add();
            mandatoryList.SendToApproval();
            mandatoryList.Reject("Test");
            return(mandatoryList);
        }
예제 #6
0
        public MandatoryList GetMandatoryListWithStatusWaitingApprove()
        {
            MandatoryList        mandatoryList = new MandatoryList();
            MandatoryListProduct product       = GetMandatoryListProdcut();

            mandatoryList.Products = new List <MandatoryListProduct>()
            {
                product,
                product
            };
            mandatoryList.Add();
            mandatoryList.SendToApproval();

            return(mandatoryList);
        }
예제 #7
0
        private async Task AddChangeRequest(MandatoryList entity, MandatoryList dbEntity)
        {
            var changeRequest = _mapper.Map <MandatoryListChangeRequest>(entity);

            dbEntity.AddChangeRequest(changeRequest);
            await _mandatoryListCommands.Update(dbEntity);

            NotificationArguments NotificationArguments = new NotificationArguments
            {
                BodyEmailArgs    = new object[] { "", entity.DivisionNameAr, entity.DivisionCode },
                SubjectEmailArgs = new object[] { },
                PanelArgs        = new object[] { entity.DivisionNameAr, entity.DivisionCode },
                SMSArgs          = new object[] { entity.DivisionNameAr, entity.DivisionCode }
            };

            MainNotificationTemplateModel mainNotificationTemplateModel = new MainNotificationTemplateModel(NotificationArguments,
                                                                                                            $"MandatoryList/Details?id={Util.Encrypt(entity.Id)}",
                                                                                                            NotificationEntityType.MandatoryList,
                                                                                                            entity.Id.ToString());

            await _notificationAppService.SendNotificationForUsersByRoleName(NotificationOperations.MandatoryListApprover.MandatoryListProducts.SendUpdateMandatoryListToApprove, RoleNames.MandatoryListApprover, mainNotificationTemplateModel);
        }
예제 #8
0
 public async Task Update(MandatoryList entity)
 {
     _dbContext.MandatoryLists.Update(entity);
     await _dbContext.SaveChangesAsync();
 }