Exemple #1
0
 public async Task <ActionResult <IFRSRespObj> > GetIFRSSetupData([FromQuery] IFRSSearchObj model)
 {
     try
     {
         var response = _repo.GetIFRSSetupData(model.SetUpId);
         var respList = new List <IFRSSetupDataObj> {
             response
         };
         return(new IFRSRespObj
         {
             SetUpData = respList,
         });
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new IFRSRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }
Exemple #2
0
        public async Task <ActionResult <InfProductTypeRegRespObj> > AddUpdateProductType([FromBody] AddUpdateInfProductTypeObj entity)
        {
            try
            {
                var user = await _serverRequest.UserDataAsync();

                InfProductTypeObj item = null;
                if (entity.ProductTypeId > 0)
                {
                    item = _repo.GetProductType(entity.ProductTypeId);
                    if (item == null)
                    {
                        return new InfProductTypeRegRespObj
                               {
                                   Status = new APIResponseStatus {
                                       IsSuccessful = false, Message = new APIResponseMessage {
                                           FriendlyMessage = "Item does not Exist"
                                       }
                                   }
                               }
                    }
                    ;
                }

                var domainObj = new inf_producttype();
                domainObj.ProductTypeId = entity.ProductTypeId > 0 ? entity.ProductTypeId : 0;
                domainObj.Name          = entity.Name;
                domainObj.Description   = entity.Description;
                domainObj.Active        = true;
                domainObj.Createdby     = user.UserName;
                domainObj.Createdon     = DateTime.Today;
                domainObj.Deleted       = false;
                domainObj.Updatedby     = user.UserName;
                domainObj.Updatedon     = entity.ProductTypeId > 0 ? DateTime.Today : DateTime.Today;

                var isDone = _repo.AddUpdateProductType(domainObj);
                return(new InfProductTypeRegRespObj
                {
                    ProductTypeId = domainObj.ProductTypeId,
                    Status = new APIResponseStatus {
                        IsSuccessful = isDone ? true : false, Message = new APIResponseMessage {
                            FriendlyMessage = isDone ? "successful" : "Unsuccessful"
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new InfProductTypeRegRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
Exemple #3
0
        public async Task <ActionResult <FeeRespObj> > GenerateExportFees()
        {
            try
            {
                var response = _repo.GenerateExportFees();

                return(new FeeRespObj
                {
                    export = response,
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new FeeRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
 public async Task <ActionResult <LoanReviewListObjRespObj> > GetLoanReviewApplicationbyLoanId([FromQuery] SearchQueryObj model)
 {
     try
     {
         var response = _repo.GetLoanReviewApplicationbyLoanId(model.LoanId);
         var respList = new List <LoanReviewApplicationObj> {
             response
         };
         return(new LoanReviewListObjRespObj
         {
             LoanReviewApplication = respList,
         });
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new LoanReviewListObjRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }
        public async Task <ActionResult <LoanReviewListObjRespObj> > UpdateLoanReviewApplicationLog([FromBody] ApprovalRecommendationObj model)
        {
            try
            {
                var identity = await _serverRequest.UserDataAsync();

                var user = identity.StaffName;

                var response = _repo.UpdateLoanReviewApplicationLog(model, user);
                return(new LoanReviewListObjRespObj
                {
                    LoanApprovalRecommendationLog = response,
                    Status = new APIResponseStatus {
                        IsSuccessful = true, Message = new APIResponseMessage {
                            FriendlyMessage = "Record Saved Successful"
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new LoanReviewListObjRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
Exemple #6
0
            public async Task <QuestionsRegRespObj> Handle(AnswerQuestionsCommand request, CancellationToken cancellationToken)
            {
                var response = new QuestionsRegRespObj {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage()
                    }
                };

                try
                {
                    var user = await _userManager.FindByNameAsync(request.UserName);

                    if (user != null)
                    {
                        if (!string.IsNullOrEmpty(user.SecurityAnswered))
                        {
                            if (user.SecurityAnswered.Trim().ToLower() == request.Answer.Trim().ToLower())
                            {
                                user.IsItQuestionTime = false;
                                user.EnableAtThisTime = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(10));
                                await _userManager.UpdateAsync(user);
                            }
                            else
                            {
                                response.Status.IsSuccessful            = false;
                                response.Status.Message.FriendlyMessage = $"Unable to Identify user account with this answer";
                                return(response);
                            }
                        }
                        else
                        {
                            response.Status.IsSuccessful            = false;
                            response.Status.Message.FriendlyMessage = $"No Security questions found";
                            return(response);
                        }
                    }
                    else
                    {
                        response.Status.IsSuccessful            = false;
                        response.Status.Message.FriendlyMessage = $"Invalid user Name";
                        return(response);
                    }

                    response.Status.IsSuccessful            = true;
                    response.Status.Message.FriendlyMessage = $"Successfully";
                    return(response);
                }
                catch (Exception ex)
                {
                    #region Log error to file
                    var errorCode = ErrorID.Generate(4);
                    _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");

                    response.Status.Message.FriendlyMessage  = "Error occured!! Unable to process request";
                    response.Status.Message.TechnicalMessage = $"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}";
                    return(response);

                    #endregion
                }
            }
        public async Task <SendEmailRespObj> SendSpecificMessageAsync(EmailMessageObj email)
        {
            var response = new SendEmailRespObj {
                Status = new APIResponseStatus {
                    IsSuccessful = true, Message = new APIResponseMessage()
                }
            };

            try
            {
                var gosGatewayClient = _httpClientFactory.CreateClient("GOSDEFAULTGATEWAY");

                var jsonContent = JsonConvert.SerializeObject(email);
                var buffer      = Encoding.UTF8.GetBytes(jsonContent);
                var byteContent = new ByteArrayContent(buffer);
                byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                var result = await gosGatewayClient.PostAsync(ApiRoutes.IdentitySeverRequests.SEND_EMAIL_TO_SPECIFIC_OFFICERS, byteContent);

                var resultString = await result.Content.ReadAsStringAsync();

                response = JsonConvert.DeserializeObject <SendEmailRespObj>(resultString);
                return(response);
            }
            catch (Exception ex)
            {
                #region Log error
                var errorCode = ErrorID.Generate(4);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                throw ex;
                #endregion
            }
        }
Exemple #8
0
        public async Task Send(EmailMessage emailMessage)
        {
            try
            {
                var mimeMsg = new MimeMessage();
                mimeMsg.From.AddRange(emailMessage.FromAddresses.Select(x => new MailboxAddress(x.Name, x.Address)));
                mimeMsg.To.AddRange(emailMessage.ToAddresses.Select(x => new MailboxAddress(x.Name, x.Address)));
                mimeMsg.Subject = emailMessage.Subject;

                mimeMsg.Body = new TextPart(TextFormat.Html)
                {
                    Text = emailMessage.Content
                };
                await _asyncRetryPolicy.ExecuteAsync(async() => {
                    using (var client = new SmtpClient())
                    {
                        client.Connect(_emailConfiguration.SmtpServer, _emailConfiguration.SmtpPort, false);
                        client.AuthenticationMechanisms.Remove("XOAUTH2");
                        client.Authenticate(_emailConfiguration.SmtpUsername, _emailConfiguration.SmtpPassword);
                        await client.SendAsync(mimeMsg);
                        await client.DisconnectAsync(true);
                    }
                });
            }
            catch (SocketException ex)
            {
                var errorId = ErrorID.Generate(4);
                _logger.LogInformation($"EmailService {errorId}", $"Error Message{ ex?.Message}");
                throw ex;
            }
        }
 public async Task <ActionResult <LoanApplicationRespObj> > GetRunningLoanApplicationByCustomer([FromQuery] LoanApplicationSearchObj model)
 {
     try
     {
         var response = _repo.GetRunningLoanApplicationByCustomer(model.CustomerId);
         //var resplist = new List<LoanApplicationObj> { response };
         return(new LoanApplicationRespObj
         {
             LoanApplications = response,
         });
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new LoanApplicationRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }
Exemple #10
0
        public async Task <ActionResult <LoanRespObj> > GetManagedLoanInformation([FromQuery] LoanSearchObj model)
        {
            try
            {
                var response = _repo.GetManagedLoanInformation(model.LoanId);

                return(new LoanRespObj
                {
                    ManageLoans = response,
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new LoanRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
        public async Task <ActionResult <CollateralCustomerRespObj> > AddOrUpdateCollateralCustomerConsumptionAsync([FromBody] CollateralCustomerConsumptionObj model)
        {
            try
            {
                var user = await _serverRequest.UserDataAsync();

                var createdBy = user.UserName;
                model.CreatedBy = createdBy;
                model.UpdatedBy = createdBy;
                var isDone = await _collateralCustomerConsumptionRepository.AddOrUpdateCollateralCustomerConsumptionAsync(model);

                return(new CollateralCustomerRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = true, Message = new APIResponseMessage {
                            FriendlyMessage = "Successful"
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new CollateralCustomerRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
Exemple #12
0
 public async Task <ActionResult <CreditLoanRespObj> > GetAllCreditLoan()
 {
     try
     {
         var response = _repo.GetAllCreditLoan();
         return(Ok(new CreditLoanRespObj
         {
             Loans = _mapper.Map <List <credit_loan_obj> >(response),
             Status = new APIResponseStatus
             {
                 IsSuccessful = true,
                 Message = new APIResponseMessage {
                     FriendlyMessage = response.Count() > 0 ? "Search record found" : "No record found"
                 }
             },
         }));
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new CreditLoanRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }
Exemple #13
0
        public async Task <AuthenticationResult> CustomerLoginAsync(ApplicationUser user)
        {
            try
            {
                return(await CustomerGenerateAuthenticationResultForUserAsync(user));
            }
            catch (Exception ex)
            {
                #region Log error
                var errorCode = ErrorID.Generate(4);
                _logger.Error($"ErrorID : LoginAsync{errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new AuthenticationResult
                {
                    Status = new APIResponseStatus
                    {
                        Message = new APIResponseMessage
                        {
                            FriendlyMessage = "Error occured!! Please try again later",
                            MessageId = errorCode,
                            TechnicalMessage = $"ErrorID : LoginAsync{errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}"
                        }
                    }
                });

                #endregion
            }
        }
Exemple #14
0
 public async Task <ActionResult <IFRSRespObj> > RunImpairment()
 {
     try
     {
         var response = _repo.RunImpairment();
         return(new IFRSRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = response ? true : false, Message = new APIResponseMessage {
                     FriendlyMessage = response ? "Successful" : "Unsuccessful"
                 }
             }
         });
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new IFRSRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }
        public async Task <ActionResult <EmailResponseObj> > LeftOverReminder(int SwitchValue)
        {
            try
            {
                var done = await _appSettingService.LeftOverReminder(SwitchValue);

                return(new EmailResponseObj
                {
                    IsSuccessful = done ? true : false,
                    Status = new APIResponseStatus
                    {
                        IsSuccessful = done ? true : false,
                    }
                });
            }
            catch (Exception ex)
            {
                var errorId = ErrorID.Generate(4);
                _logger.LogInformation($"ApplicationSettingController{errorId}", $"Error Message{ ex?.InnerException?.Message ?? ex?.Message}");
                return(new EmailResponseObj
                {
                    Status = new APIResponseStatus
                    {
                        IsSuccessful = false,
                        Message = new APIResponseMessage
                        {
                            FriendlyMessage = "Something went wrong",
                            MessageId = $"ApplicationSettingController{errorId}",
                            TechnicalMessage = ex?.InnerException?.Message ?? ex?.Message
                        }
                    }
                });
            }
        }
 public async Task <ActionResult <LoanApplicationRespObj> > GetOfferletterDecisionStatus([FromQuery] LoanApplicationSearchObj model)
 {
     try
     {
         var isDone = _repo.GetOfferletterDecisionStatus(model.LoanApplicationId);
         //var resplist = new List<LoanApplicationObj> { response };
         return(new LoanApplicationRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = isDone ? true : false, Message = new APIResponseMessage {
                     FriendlyMessage = isDone ? "Accepted" : "Not Accepted"
                 }
             }
         });
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new LoanApplicationRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }
Exemple #17
0
            public async Task <SingleQuestionsRespObj> Handle(GetQuestionQuery request, CancellationToken cancellationToken)
            {
                var response = new SingleQuestionsRespObj {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage()
                    }
                };

                try
                {
                    var solList = new List <QuestionsObj>();
                    var user    = await _userManager.FindByNameAsync(request.UserName);

                    var Questionss = new QuestionsObj();
                    if (user != null)
                    {
                        if (!string.IsNullOrEmpty(user.SecurityAnswered))
                        {
                            var Questions = await _serverRequest.GetQuestionsAsync();

                            if (Questions.Questions.Count() > 0)
                            {
                                var actuaulQuestion = Questions.Questions.FirstOrDefault(d => d.QuestionId == user.QuestionId);

                                Questionss.QuestionId = actuaulQuestion.QuestionId;
                                Questionss.Qiestion   = actuaulQuestion.Qiestion;
                            }
                        }
                        else
                        {
                            response.Status.IsSuccessful            = false;
                            response.Status.Message.FriendlyMessage = $"No Security questions found";
                            return(response);
                        }
                    }
                    else
                    {
                        response.Status.IsSuccessful            = false;
                        response.Status.Message.FriendlyMessage = $"Invalid user Name";
                        return(response);
                    }

                    response.Status.IsSuccessful            = true;
                    response.Question                       = Questionss;
                    response.Status.Message.FriendlyMessage = $"Successfully";
                    return(response);
                }
                catch (Exception ex)
                {
                    #region Log error to file
                    var errorCode = ErrorID.Generate(4);
                    _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");

                    response.Status.Message.FriendlyMessage  = "Error occured!! Unable to process request";
                    response.Status.Message.TechnicalMessage = $"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}";
                    return(response);

                    #endregion
                }
            }
 public async Task <ActionResult <ExposureRespObj> > GetExposureParameterByID(int ExposureParamaterId)
 {
     try
     {
         var response = _exposure.GetExposureParameterByID(ExposureParamaterId);
         var resplist = new List <ExposureObj> {
             response
         };
         return(new ExposureRespObj
         {
             Exposure = resplist,
         });
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new ExposureRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }
            public async Task <QuestionsRespObj> Handle(GetAllQuestionsQuery request, CancellationToken cancellationToken)
            {
                var response = new QuestionsRespObj {
                    Status = new APIResponseStatus {
                        IsSuccessful = true, Message = new APIResponseMessage()
                    }
                };

                try
                {
                    var sol = await _data.Questions.ToListAsync();

                    response.Questions = sol.Select(a => new QuestionsObj {
                        QuestionId = a.QuestionId,
                        Qiestion   = a.Question
                    }).ToList();

                    response.Status.IsSuccessful            = true;
                    response.Status.Message.FriendlyMessage = sol.Count() > 0 ? string.Empty : "Successfully";
                    return(response);
                }
                catch (Exception ex)
                {
                    #region Log error to file
                    var errorCode = ErrorID.Generate(4);
                    _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");

                    response.Status.IsSuccessful             = false;
                    response.Status.Message.FriendlyMessage  = "Error occured!! Unable to delete item";
                    response.Status.Message.TechnicalMessage = $"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}";
                    return(response);

                    #endregion
                }
            }
        public async Task <ActionResult <ExposureRespObj> > AddUpdateCreditCategory([FromBody] ExposureObj model)
        {
            try
            {
                var identity = await _serverRequest.UserDataAsync();

                var user = identity.UserName;

                model.CreatedBy = user;

                var isDone = await _exposure.AddUpdateExposureParameter(model);

                return(new ExposureRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = isDone ? true : false, Message = new APIResponseMessage {
                            FriendlyMessage = isDone ? "successful" : "Unsuccessful"
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new ExposureRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
        public async Task <ActionResult <OperatingAccountRespObj> > AddOrUpdateOperatingAccountAsync([FromBody] OperatingAccountObj model)
        {
            try
            {
                var isDone = await _repo.AddOrUpdateOperatingAccountAsync(model);

                return(new OperatingAccountRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = isDone ? true : false, Message = new APIResponseMessage {
                            FriendlyMessage = isDone ? "Successful" : "Unsuccessful"
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                return(new OperatingAccountRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
Exemple #22
0
 public async Task <ActionResult <LoanScheduleRespObj> > GeneratePeriodicLoanSchedule([FromBody] LoanPaymentScheduleInputObj model)
 {
     try
     {
         var response = _repo.GeneratePeriodicLoanSchedule(model);
         return(new LoanScheduleRespObj
         {
             LoanPaymentSchedule = response,
             Status = new APIResponseStatus {
                 IsSuccessful = true, Message = new APIResponseMessage {
                     FriendlyMessage = "Successful Generated"
                 }
             }
         });
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new LoanScheduleRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = ex.Message, TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }
        public async Task <ActionResult <LoanReviewListObjRespObj> > AddLoanBooking([FromBody] LoanReviewApplicationObj model)
        {
            try
            {
                var identity = await _serverRequest.UserDataAsync();

                var user = identity.UserName;

                model.CreatedBy = user;
                model.UpdatedBy = user;

                var response = await _repo.AddUpdateLMSApplication(model);

                return(response);
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new LoanReviewListObjRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
Exemple #24
0
        public async Task <ActionResult <LoanScheduleRegRespObj> > AddTempLoanSchedule([FromQuery] LoanScheduleSearchObj search)
        {
            try
            {
                var res = await _repo.AddTempLoanSchedule(search.LoanId, search.loanInput);

                return(new LoanScheduleRegRespObj
                {
                    response = res,
                    Status = new APIResponseStatus {
                        IsSuccessful = res ? true : false, Message = new APIResponseMessage {
                            FriendlyMessage = res ? "successful" : "Unsuccessful"
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new LoanScheduleRegRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
        public async Task <ActionResult <LoanApplicationRespObj> > UploadLoanReviewOfferLetter()
        {
            try
            {
                var postedFile        = _httpContextAccessor.HttpContext.Request.Form.Files;
                var fileName          = _httpContextAccessor.HttpContext.Request.Form.Files["supportDocument"].FileName;
                var fileExtention     = Path.GetExtension(fileName);
                var loanApplicationId = Convert.ToInt32(_httpContextAccessor.HttpContext.Request.Form["loanApplicationId"]);
                var reportStatus      = Convert.ToString(_httpContextAccessor.HttpContext.Request.Form["reportStatus"]);

                var user = await _serverRequest.UserDataAsync();

                var createdBy = user.UserName;
                var byteArray = new byte[0];
                foreach (var fileBit in postedFile)
                {
                    if (fileBit.Length > 0)
                    {
                        using (var ms = new MemoryStream())
                        {
                            await fileBit.CopyToAsync(ms);

                            byteArray = (ms.ToArray());
                        }
                    }
                }

                var model = new LoanApplicationObj
                {
                    LoanApplicationId = loanApplicationId,
                    ReportStatus      = reportStatus,
                    SupportDocument   = byteArray,
                    CreatedBy         = createdBy
                };

                var isDone = await _repo.UploadLoanReviewOfferLetter(model);

                return(new LoanApplicationRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = isDone ? true : false, Message = new APIResponseMessage {
                            FriendlyMessage = isDone ? "Record saved successfully" : "Record not saved"
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new LoanApplicationRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
Exemple #26
0
 public async Task <ActionResult <LookupRespObj> > GetAllLoanScheduleType()
 {
     try
     {
         var response = _repo.GetAllLoanScheduleType();
         return(new LookupRespObj
         {
             LookUp = response,
             Status = new APIResponseStatus {
                 IsSuccessful = true, Message = new APIResponseMessage {
                     FriendlyMessage = "Successful"
                 }
             }
         });
     }
     catch (Exception ex)
     {
         var errorCode = ErrorID.Generate(5);
         _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
         return(new LookupRespObj
         {
             Status = new APIResponseStatus {
                 IsSuccessful = false, Message = new APIResponseMessage {
                     FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                 }
             }
         });
     }
 }
Exemple #27
0
        public async Task <ActionResult <InfProductRespObj> > GetAllProduct()
        {
            try
            {
                var user = await _serverRequest.UserDataAsync();

                var createdBy = user.UserName;
                var response  = _repo.GetAllProduct();
                return(new InfProductRespObj
                {
                    InfProducts = response,
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new InfProductRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
Exemple #28
0
            public async Task<QuestionsRespObj> Handle(GetQuestionQueryQuery request, CancellationToken cancellationToken)
            {
                var response = new QuestionsRespObj { Status = new APIResponseStatus { IsSuccessful = true, Message = new APIResponseMessage() } };

                try
                {
                    var sol = await _data.Questions.FindAsync(request.QuestionsId);
                    var solList = new List<QuestionsObj>();
                    if (sol != null)
                    {
                        var Questionss = new QuestionsObj()
                        {
                            QuestionId = sol.QuestionId,
                            Qiestion = sol.Question
                        };
                        solList.Add(Questionss);
                    } 
                    response.Status.Message.FriendlyMessage = solList.Count()>0 ? string.Empty : "Successfully";
                    response.Questions = solList;
                    return response; 
                }
                catch (Exception ex)
                {
                    #region Log error to file 
                    var errorCode = ErrorID.Generate(4);
                    _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");

                    response.Status.IsSuccessful = false;
                    response.Status.Message.FriendlyMessage = "Error occured!! Unable to delete item";
                    response.Status.Message.TechnicalMessage = $"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}";
                    return response;
                    #endregion
                }
            }
Exemple #29
0
        public async Task <ActionResult <RepaymentTypeRespObj> > GetAllRepaymentTypeAsync()
        {
            try
            {
                var response = await _repo.GetAllRepaymentTypeAsync();

                return(new RepaymentTypeRespObj
                {
                    RepaymentType = _mapper.Map <List <RepaymentTypeObj> >(response),
                    Status = new APIResponseStatus {
                        IsSuccessful = true, Message = new APIResponseMessage {
                            FriendlyMessage = "Successful"
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new RepaymentTypeRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }
Exemple #30
0
        public async Task <ActionResult <IFRSRespObj> > AddUpdateMacroEconomicVariable([FromBody] MacroEconomicVariableObj model)
        {
            try
            {
                var identity = await _identityServer.UserDataAsync();

                var user = identity.UserName;

                model.CreatedBy = user;
                model.UpdatedBy = user;

                var response = _repo.AddUpdateMacroEconomicVariable(model);
                return(new IFRSRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = response ? true : false, Message = new APIResponseMessage {
                            FriendlyMessage = response ? "Record saved Successfully" : "Unsuccessful"
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                var errorCode = ErrorID.Generate(5);
                _logger.Error($"ErrorID : {errorCode} Ex : {ex?.Message ?? ex?.InnerException?.Message} ErrorStack : {ex?.StackTrace}");
                return(new IFRSRespObj
                {
                    Status = new APIResponseStatus {
                        IsSuccessful = false, Message = new APIResponseMessage {
                            FriendlyMessage = "Error Occurred", TechnicalMessage = ex?.Message, MessageId = errorCode
                        }
                    }
                });
            }
        }