Example #1
0
        public async Task <TransactionResponse> ApproveTransaction(TransactionRequest req)
        {
            TransactionResponse response = new TransactionResponse();

            try
            {
                TransactionResponse getItem = await dep.GetPost(req);

                TransactionLevelFacade  transactionLevelFacade  = new TransactionLevelFacade();
                TransactionLevelRequest transactionLevelRequest = new TransactionLevelRequest();
                transactionLevelRequest.ID = getItem.ListTransaction.FirstOrDefault().TrasanctionLevel.ID;
                TransactionLevelResponse transactionLevelResponse = new TransactionLevelResponse();
                transactionLevelResponse = await transactionLevelFacade.GetNextLevel(transactionLevelRequest);

                if (transactionLevelResponse.model == null)
                {
                    response.IsSuccess = false;
                    response.Message   = transactionLevelResponse.Message;
                    return(response);
                }

                req.TrasanctionLevel.ID = transactionLevelResponse.model.ID;

                response = await dep.ApproveTransaction(req);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                response.IsSuccess = false;
                response.Message   = ex.ToString();
            }
            return(response);
        }
Example #2
0
        public async Task <TransactionLevelResponse> GetCurrentLevel(TransactionLevelRequest request)
        {
            TransactionLevelResponse response = new TransactionLevelResponse();

            try
            {
                if (db != null)
                {
                    response.Message = "Success";
                    response.model   = await(from level in db.TransactionLevel
                                             join status in db.TransactionStatus
                                             on level.TransactionStatusId equals status.Id
                                             join step in db.TransactionStep
                                             on level.TransactionStepId equals step.Id
                                             where level.RowStatus == true && status.RowStatus == true &&
                                             step.RowStatus == true && request.ID == level.Id
                                             select new TransactionLevelViewModel
                    {
                        ID     = level.Id,
                        Status = new TransactionStatusViewModel
                        {
                            ID          = status.Id,
                            Name        = status.Name,
                            Description = status.Description,
                            Created     = status.Created,
                            Createdby   = status.CreatedBy,
                            Modified    = status.Modified,
                            ModifiedBy  = status.ModifiedBy,
                            RowStatus   = status.RowStatus
                        },
                        Name = level.Name,
                        Step = new TransactionStepViewModel
                        {
                            ID         = step.Id,
                            Name       = step.Name,
                            Created    = step.Created,
                            CreatedBy  = step.CreatedBy,
                            Modified   = step.Modified,
                            ModifiedBy = step.ModifiedBy,
                            RowStatus  = step.RowStatus
                        },
                        Sequence    = level.Sequence,
                        Created     = level.Created,
                        CreatedBy   = level.CreatedBy,
                        Description = level.Description,
                        Modified    = level.Modified,
                        ModifiedBy  = level.ModifiedBy,
                        RowStatus   = level.RowStatus
                    }
                                             ).FirstOrDefaultAsync();
                }
                else
                {
                    response.Message   = "Database Context is null";
                    response.IsSuccess = false;
                }
            }
            catch (Exception ex)
            {
                response.Message   = ex.ToString();;
                response.IsSuccess = false;
            }

            return(response);
        }