Пример #1
0
 public TransactionWrapper IntegrateRenewalMotorInsurance()
 {
     try
     {
         SellingPointSQL.weds(MotorTableIntegration.RenewalInsuranceIntegration);
         return(new TransactionWrapper {
             IsTransactionDone = true
         });
     }
     catch (Exception ex)
     {
         return(new TransactionWrapper {
             IsTransactionDone = false, TransactionErrorMessage = ex.Message
         });
     }
 }
Пример #2
0
 public TransactionWrapper IntegrateDomesticInsuranceMaster()
 {
     try
     {
         SellingPointSQL.weds(DomesticTableIntegration.DomesticDetailsIntegration);
         return(new TransactionWrapper()
         {
             IsTransactionDone = true
         });
     }
     catch (Exception exc)
     {
         return(new TransactionWrapper()
         {
             IsTransactionDone = false, TransactionErrorMessage = exc.Message
         });
     }
 }
Пример #3
0
 public TransactionWrapper IntegrateInsuredMaster()
 {
     try
     {
         SellingPointSQL.weds(MasterTablesIntegration.InsuredMasterIntegration);
         return(new TransactionWrapper()
         {
             IsTransactionDone = true
         });
     }
     catch (Exception exc)
     {
         return(new TransactionWrapper()
         {
             IsTransactionDone = false, TransactionErrorMessage = exc.Message
         });
     }
 }
Пример #4
0
 public TransactionWrapper IntegrateDomesticToOracle(long domesticID)
 {
     try
     {
         SqlParameter[] para = new SqlParameter[] {
             new SqlParameter("@DomesticID", domesticID)
         };
         SellingPointSQL.eds(StoredProcedure.MSSQLToOracle.DomesticInsurance.IntegrateDomesticDetails, para);
         return(new TransactionWrapper()
         {
             IsTransactionDone = true
         });
     }
     catch (Exception exc)
     {
         return(new TransactionWrapper()
         {
             IsTransactionDone = false, TransactionErrorMessage = exc.Message
         });
     }
 }
        public TransactionWrapper IntegrateInsuredMasterToOracle(string insuranceCode)
        {
            try
            {
                SqlParameter[] para = new SqlParameter[] {
                    new SqlParameter("@InsuredCode", insuranceCode)
                };

                SellingPointSQL.eds(StoredProcedure.MSSQLToOracle.InsuredMaster.IntegrateInsuredMaster, para);

                return(new TransactionWrapper()
                {
                    IsTransactionDone = true
                });
            }
            catch (Exception exc)
            {
                return(new TransactionWrapper()
                {
                    IsTransactionDone = false, TransactionErrorMessage = exc.Message
                });
            }
        }
Пример #6
0
        public TransactionWrapper IntegrateTravelToOracle(long travelId)
        {
            try
            {
                SqlParameter[] para = new SqlParameter[] {
                    new SqlParameter("@TRAVELID", travelId)
                };

                SellingPointSQL.eds(StoredProcedure.MSSQLToOracle.TravelInsurance.IntegrateTravelInsuraceByTravelId, para);

                return(new TransactionWrapper()
                {
                    IsTransactionDone = true
                });
            }
            catch (Exception exc)
            {
                return(new TransactionWrapper()
                {
                    IsTransactionDone = false, TransactionErrorMessage = exc.Message
                });
            }
        }
Пример #7
0
        public TransactionWrapper MoveIntegrationToOracle(long mototorEndorsementID)
        {
            try
            {
                SqlParameter[] para = new SqlParameter[] {
                    new SqlParameter("@EndorsementID", mototorEndorsementID)
                };

                SellingPointSQL.eds(StoredProcedure.MSSQLToOracle.MotorEndorsement.PushOracleMotorEndorsement, para);

                return(new TransactionWrapper()
                {
                    IsTransactionDone = true
                });
            }
            catch (Exception exc)
            {
                return(new TransactionWrapper()
                {
                    IsTransactionDone = false, TransactionErrorMessage = exc.Message
                });
            }
        }
        public BKIC.SellingPoint.DL.BO.HomeInsurancePolicyResponse InsertHome(BO.HomeInsurancePolicyDetails policy)
        {
            try
            {
                var req = new BO.HomeProductRequest
                {
                    Type      = "fetch",
                    Agency    = policy.HomeInsurancePolicy.Agency,
                    AgentCode = policy.HomeInsurancePolicy.AgentCode,
                    MainClass = policy.HomeInsurancePolicy.MainClass,
                    SubClass  = policy.HomeInsurancePolicy.SubClass
                };
                BO.HomeProductResponse productRes = _adminRepository.GetHomeProduct(req);
                if (productRes != null && productRes.IsTransactionDone && productRes.HomeProducts.Count > 0)
                {
                    var homeProduct = productRes.HomeProducts[0];
                    if (homeProduct != null)
                    {
                        Calculate(policy, homeProduct);
                        var policyRecord = InsertHomeMain(policy, policy.HomeInsurancePolicy.IsRenewal ? HomeInsuranceSP.InsertHomeRenewal : HomeInsuranceSP.InsertHome);
                        if (policyRecord != null && policyRecord.IsInserted)
                        {
                            CalculateCommission(homeProduct, policy.HomeInsurancePolicy, policyRecord.NewHomeID,
                                                policyRecord.DocumentNumber, policyRecord.LinkID, policyRecord.RenewalCount);

                            if (policyRecord.NewHomeID > 0 && !IsHIR && policy.HomeInsurancePolicy.IsActivePolicy)
                            {
                                try
                                {
                                    new Task(() =>
                                    {
                                        SqlParameter[] para = new SqlParameter[]
                                        {
                                            new SqlParameter("@HomeID", policyRecord.NewHomeID)
                                        };
                                        SellingPointSQL.eds("MIG_IntegrateHomeDetails", para);
                                    }).Start();
                                }
                                catch (AggregateException ex)
                                {
                                    foreach (Exception inner in ex.InnerExceptions)
                                    {
                                        _mail.SendMailLogError(inner.Message, policy.HomeInsurancePolicy.InsuredCode,
                                                               "HomeInsurance", policy.HomeInsurancePolicy.Agency, true);
                                    }
                                }
                            }
                            return(new BO.HomeInsurancePolicyResponse()
                            {
                                IsTransactionDone = true,
                                HomeId = policyRecord.NewHomeID,
                                IsHIR = IsHIR,
                                DocumentNo = policyRecord.DocumentNumber,
                                RenewalCount = policyRecord.RenewalCount
                            });
                        }
                    }
                    return(new BKIC.SellingPoint.DL.BO.HomeInsurancePolicyResponse()
                    {
                        IsTransactionDone = false,
                        TransactionErrorMessage = "Product not found"
                    });
                }
                return(new BKIC.SellingPoint.DL.BO.HomeInsurancePolicyResponse()
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = "Product not found"
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #9
0
        public BKIC.SellingPoint.DL.BO.MotorInsurancePolicyResponse InsertMotor(BO.MotorInsurancePolicy policy)
        {
            try
            {
                var req = new BO.MotorProductRequest
                {
                    Type      = "fetch",
                    Agency    = policy.Agency,
                    AgentCode = policy.AgencyCode,
                    MainClass = policy.Mainclass,
                    SubClass  = policy.Subclass,
                };
                BO.MotorProductMasterResponse productRes = _adminRepository.GetMotorProduct(req);
                if (productRes != null && productRes.IsTransactionDone && productRes.motorProductMaster.Count > 0)
                {
                    BO.MotorProductMaster product = productRes.motorProductMaster[0];
                    if (product != null)
                    {
                        Calculate(policy, product);
                        var policyRecord = InsertMotorMain(policy, policy.IsRenewal ? MotorInsuranceSP.MotorRenewalInsert : MotorInsuranceSP.MotorInsert);
                        if (policyRecord != null && policyRecord.IsInserted)
                        {
                            CalculateCommission(product, policy, policyRecord.NewMotorID, policyRecord.DocumentNumber,
                                                policyRecord.LinkID, policyRecord.RenewalCount);

                            if (!IsHIR && policy.IsActivePolicy)
                            {
                                try
                                {
                                    new Task(() =>
                                    {
                                        SqlParameter[] para = new SqlParameter[]
                                        {
                                            new SqlParameter("@MotorID", policyRecord.NewMotorID)
                                        };
                                        SellingPointSQL.eds("MIG_IntegrateMotorDetails", para);
                                    }).Start();
                                }
                                catch (AggregateException ex)
                                {
                                    foreach (Exception inner in ex.InnerExceptions)
                                    {
                                        _mail.SendMailLogError(inner.Message, policy.InsuredCode, "MotorInsurance", policy.Agency, true);
                                    }
                                }
                            }
                            return(new BKIC.SellingPoint.DL.BO.MotorInsurancePolicyResponse()
                            {
                                IsTransactionDone = true,
                                IsHIR = IsHIR,
                                MotorID = policyRecord.NewMotorID,
                                DocumentNo = policyRecord.DocumentNumber,
                                RenewalCount = policyRecord.RenewalCount
                            });
                        }
                    }
                    return(new BKIC.SellingPoint.DL.BO.MotorInsurancePolicyResponse()
                    {
                        IsTransactionDone = false,
                        TransactionErrorMessage = "Product not found"
                    });
                }
                return(new BKIC.SellingPoint.DL.BO.MotorInsurancePolicyResponse()
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = "Product not found"
                });
            }
            catch (Exception ex)
            {
                _mail.SendMailLogError(ex.Message, policy.InsuredCode, "MotorInsurance", policy.Agency, false);
                return(new MotorInsurancePolicyResponse()
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = ex.ToString()
                });
            }
        }