Exemple #1
0
        private CcCreditChk SaveCreditCheckingForCustomer(string appId, int customerId, bool hasConsentScoreModel,
                                                          string createdByUserId)
        {
            var creditCheckingFromRepo = _creditCheckingRepo
                                         .Query(c => c.AppId == appId && c.CustomerId == customerId)
                                         .SingleOrDefault();

            if (creditCheckingFromRepo == null)
            {
                creditCheckingFromRepo = new CcCreditChk
                {
                    CustomerId          = customerId,
                    AppId               = appId,
                    CheckStatus         = BusinessConstant.CreditCheckingStatusOnProcess,
                    FlagManualNcb       = false,
                    MarketingSubmitTime = DateTime.Now,
                    Status              = BusinessConstant.StatusActive,
                    CreateBy            = createdByUserId,
                    CreateDate          = DateTime.Now,
                    FlagConsentSCRM     = hasConsentScoreModel
                };
            }

            _creditCheckingRepo.Add(creditCheckingFromRepo);
            //_creditCheckingRepo.Commit();

            return(creditCheckingFromRepo);
        }
Exemple #2
0
        public void SubmitToCreditChecking(string appId, int customerId, bool hasConsentScoreModel,
                                           ICollection <AttachmentUploadResource> attachmentUploadResourceFiles,
                                           UserProfile userProfile)
        {
            using (var transaction = _creditCheckingRepo.BeginTransaction())
            {
                CcCreditChk creditChecking = SaveCreditCheckingForCustomer(appId, customerId,
                                                                           hasConsentScoreModel, userProfile.UserId);

                _creditCheckingRepo.Commit();

                int creditCheckingId = creditChecking.Id;

                int attachmentFileCount = AddAttachmentFiles(appId, customerId,
                                                             creditCheckingId, attachmentUploadResourceFiles, userProfile.UserId);

                _attachmentRepo.Commit();

                _creditCheckingRepo.SaveConsentReceiveStatus(creditCheckingId, userProfile.UserId);

                _creditCheckingRepo.Commit();

                transaction.Commit();
            }
        }