コード例 #1
0
        /// <summary>
        /// Calculate endorsement premium by endorsement type.
        /// </summary>
        /// <param name="travelEndorsement">Endorement quote request.</param>
        /// <returns>Returns endorsement premium and commision.</returns>
        public TravelEndorsementQuoteResponse GetTravelEndorsementQuote(TravelEndorsementQuote travelEndorsement)
        {
            try
            {
                SqlParameter[] paras = new SqlParameter[]
                {
                    new  SqlParameter("@Agency", travelEndorsement.Agency),
                    new  SqlParameter("@AgentCode", travelEndorsement.AgentCode),
                    new SqlParameter("@DocumentNo", travelEndorsement.DocumentNo ?? ""),
                    new  SqlParameter("@MainClass", travelEndorsement.MainClass),
                    new  SqlParameter("@SubClass", travelEndorsement.SubClass),
                    new  SqlParameter("@EffectiveFromDate", travelEndorsement.EffectiveFromDate),
                    new  SqlParameter("@EffectiveToDate", travelEndorsement.EffectiveToDate),
                    new  SqlParameter("@CancelationDate", travelEndorsement.CancelationDate),
                    new  SqlParameter("@PaidPremium", travelEndorsement.PaidPremium),
                    new SqlParameter("@NewSumInsured", travelEndorsement.NewSumInsured),
                    new SqlParameter("@RefundType", travelEndorsement.RefundType),
                    new SqlParameter("@PolicyPeriodName", travelEndorsement.PolicyPeriodName),
                    new  SqlParameter("@EndorsementType", travelEndorsement.EndorsementType),
                };
                List <SPOut> outParams = new List <SPOut>()
                {
                    new SPOut()
                    {
                        OutPutType = SqlDbType.Decimal, ParameterName = "@EndorsementPremium", Precision = 38, Scale = 3
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.Decimal, ParameterName = "@Commission", Precision = 38, Scale = 3
                    }
                };

                object[] dataSet            = BKICSQL.GetValues(TravelEndorsementSP.GetQuote, paras, outParams);
                var      endorsementPremium = string.IsNullOrEmpty(dataSet[0].ToString()) ? 0 : decimal.Parse(dataSet[0].ToString(), CultureInfo.InvariantCulture.NumberFormat);
                var      commission         = string.IsNullOrEmpty(dataSet[1].ToString()) ? 0 : decimal.Parse(dataSet[1].ToString(), CultureInfo.InvariantCulture.NumberFormat);

                return(new TravelEndorsementQuoteResponse()
                {
                    IsTransactionDone = true,
                    EndorsementPremium = endorsementPremium,
                    Commision = commission
                });
            }
            catch (Exception ex)
            {
                return(new TravelEndorsementQuoteResponse()
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = ex.Message
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// Get quote for the domestic help policy.
        /// </summary>
        /// <param name="domesticQuoteRequest">domestic quote request.</param>
        /// <returns></returns>
        public DomesticHelpQuoteResponse GetDomesticHelpQuote(DomesticHelpQuote domesticQuoteRequest)
        {
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@InsurancePeroid", domesticQuoteRequest.InsurancePeroid),
                    new SqlParameter("@NumberOfDomesticWorkers", domesticQuoteRequest.NumberOfDomesticWorkers)
                    //In future it may be added.
                    // new SqlParameter("@Agency",pQuoteInputs.Agency)
                    // new SqlParameter("@AgentCode",pQuoteInputs.AgentCode)
                    // new SqlParameter("@MainClass",pQuoteInputs.MainClass)
                    // new SqlParameter("@SubClass",pQuoteInputs.SubClass)
                };

                List <SPOut> outParams = new List <SPOut>()
                {
                    new SPOut()
                    {
                        OutPutType = SqlDbType.Decimal, ParameterName = "@PremiumBeforeDiscount", Precision = 38, Scale = 3
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.Decimal, ParameterName = "@PremiumAfterDiscount", Precision = 38
                    }
                };

                object[] dataSet = BKICSQL.GetValues(StoredProcedures.DomesticHelpInsuranceSP.GetQuote, para, outParams);
                var      premiumBeforeDiscount = decimal.Parse(Convert.ToString(dataSet[0]));
                return(new DomesticHelpQuoteResponse()
                {
                    IsTransactionDone = true,
                    PremiumAfterDiscount = 0,
                    PremiumBeforeDiscount = premiumBeforeDiscount
                });
            }
            catch (Exception ex)
            {
                return(new DomesticHelpQuoteResponse()
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = ex.Message
                });
            }
        }
コード例 #3
0
        /// <summary>
        /// Sender key.
        /// </summary>
        /// <param name="key">Key</param>
        /// <returns></returns>
        public MailMessageResponse GetMessageByKey(string key)
        {
            try
            {
                MailMessageResponse response = new MailMessageResponse();
                response.IsTransactionDone = true;

                List <SPOut> outParams = new List <SPOut>()
                {
                    new SPOut()
                    {
                        OutPutType = SqlDbType.NVarChar, ParameterName = "@Message", Size = int.MaxValue
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.NVarChar, Size = 250, ParameterName = "@SendMailTo"
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.NVarChar, Size = int.MaxValue, ParameterName = "@Subject"
                    }
                };

                SqlParameter[] para = new SqlParameter[] {
                    new SqlParameter("@Key", key)
                };

                object[] dataSet = BKICSQL.GetValues(StoredProcedures.Mail.GetMessageBykey, para, outParams);
                response.Message = dataSet[0].ToString();
                response.Email   = Convert.ToString(dataSet[1]);
                response.Subject = Convert.ToString(dataSet[2]);

                return(response);
            }
            catch (Exception exc)
            {
                return(new MailMessageResponse()
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = exc.Message
                });
            }
        }
コード例 #4
0
 /// <summary>
 /// Check the if the policy already have saved endorsement,if it is there don't allow to pass the new endorsement.
 /// </summary>
 /// <param name="request">Endorsement precheck request.</param>
 /// <returns>Returns there an endorsemnt with saved staus or not.</returns>
 public MotorEndorsementPreCheckResponse EndorsementPrecheck(MotorEndorsementPreCheckRequest request)
 {
     try
     {
         SqlParameter[] paras = new SqlParameter[]
         {
             new  SqlParameter("@docNo", request.DocNo),
             new SqlParameter("@type", Constants.Insurance.Motor)
         };
         List <SPOut> outParams = new List <SPOut>()
         {
             new SPOut()
             {
                 OutPutType    = SqlDbType.Bit,
                 ParameterName = "@IsAlreadyHaveEndorsement", Precision = 38, Scale = 3
             },
         };
         var      alreadyHave = false;
         object[] dataSet     = BKICSQL.GetValues(AdminSP.EndorsementPreCheck, paras, outParams);
         if (dataSet != null && dataSet[0] != null)
         {
             alreadyHave = string.IsNullOrEmpty(dataSet[0].ToString()) ? false : Convert.ToBoolean(dataSet[0].ToString());
         }
         return(new MotorEndorsementPreCheckResponse()
         {
             IsTransactionDone = true,
             IsAlreadyHave = alreadyHave,
             EndorsementNo = ""
         });
     }
     catch (Exception ex)
     {
         return(new MotorEndorsementPreCheckResponse()
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
コード例 #5
0
        /// <summary>
        /// Fetch insurance product codes.
        /// e.g for the insurance type domestichelp MAINCLASS is PADN.
        /// </summary>
        /// <param name="agency">Agency.</param>
        /// <param name="agencyCode">Agent Code.</param>
        /// <param name="insuranceTypeID">Insurance TypeID(1-domesticHelp, 2-Travel)</param>
        /// <returns></returns>
        public string FetchInsuranceProductCode(string agency, string agencyCode, int insuranceTypeID)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@Agency", agency),
                new SqlParameter("@AgentCode", agencyCode),
                new SqlParameter("@InsuranceTypeID", insuranceTypeID)
            };
            List <SPOut> outParams = new List <SPOut>()
            {
                new SPOut()
                {
                    OutPutType = SqlDbType.NVarChar, ParameterName = "@MainClass", Size = 50
                }
            };

            object[] dataSet = BKICSQL.GetValues(DropDownSP.FetchInsuranceProductCode, param, outParams);
            if (dataSet != null && dataSet[0] != null)
            {
                return(dataSet[0].ToString());
            }
            return(string.Empty);
        }
コード例 #6
0
        /// <summary>
        /// Post the domestic policy.
        /// </summary>
        /// <param name="details">Domestic policy details.</param>
        /// <returns>Posted domestic id, document number and hir status.</returns>
        public DomesticHelpPolicyResponse PostDomesticPolicy(DomesticPolicyDetails details)
        {
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@DomesticID", details.DomesticHelp.DomesticID),
                    new SqlParameter("@Agency", details.DomesticHelp.Agency ?? string.Empty),
                    new SqlParameter("@AgentCode", details.DomesticHelp.AgentCode ?? string.Empty),
                    new SqlParameter("@AgentBranch", details.DomesticHelp.AgentBranch ?? string.Empty),
                    new SqlParameter("@InsuredCode", details.DomesticHelp.InsuredCode ?? string.Empty),
                    new SqlParameter("@InsuredName", details.DomesticHelp.InsuredName ?? string.Empty),
                    new SqlParameter("@CPR", details.DomesticHelp.CPR ?? string.Empty),
                    new SqlParameter("@InsurancePeroid", details.DomesticHelp.InsurancePeroid),
                    new SqlParameter("@NumberOfDomesticWorkers", details.DomesticHelp.NoOfDomesticWorkers),
                    new SqlParameter("@PolicyStartDate", details.DomesticHelp.PolicyStartDate),
                    new SqlParameter("@DomesticworkerType", details.DomesticHelp.DomesticWorkType ?? string.Empty),
                    new SqlParameter("@IsPhysicalDefect", details.DomesticHelp.IsPhysicalDefect == "Yes"? true : false),
                    new SqlParameter("@PhysicalDescription", string.IsNullOrEmpty(details.DomesticHelp.PhysicalDefectDescription)?"":details.DomesticHelp.PhysicalDefectDescription),
                    new SqlParameter("@MobileNumber", details.DomesticHelp.Mobile ?? string.Empty),
                    new SqlParameter("@Createdby", details.DomesticHelp.CreatedBy),
                    new SqlParameter("@AuthorizedBy", details.DomesticHelp.AuthorizedBy),
                    new SqlParameter("@dt", details.DomesticHelpMemberdt),
                    new SqlParameter("@IsSaved", details.DomesticHelp.IsSaved),
                    new SqlParameter("@IsActive", details.DomesticHelp.IsActivePolicy),
                    new SqlParameter("@PaymentType", details.DomesticHelp.PaymentType),
                    new SqlParameter("@Remarks", details.DomesticHelp.Remarks),
                    new SqlParameter("@AccountNumber", details.DomesticHelp.AccountNumber),
                    new SqlParameter("@PremiumAfterDiscountAmount", details.DomesticHelp.PremiumAfterDiscount),
                    new SqlParameter("@CommisionAfterDiscountAmount", details.DomesticHelp.CommissionAfterDiscount),
                    new SqlParameter("@UserChangedPremium", details.DomesticHelp.UserChangedPremium),
                    new SqlParameter("@MainClass", details.DomesticHelp.MainClass),
                    new SqlParameter("@SubClass", details.DomesticHelp.SubClass),
                };
                List <SPOut> outParams = new List <SPOut>()
                {
                    new SPOut()
                    {
                        OutPutType = SqlDbType.Int, ParameterName = "@NewDomesticID"
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.Bit, ParameterName = "@IsHIR"
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.NVarChar, ParameterName = "@DocumentNumber", Size = 50
                    },
                };
                object[] dataSet    = BKICSQL.GetValues(StoredProcedures.DomesticHelpInsuranceSP.PostDomesticPolicy, para, outParams);
                var      domesticID = Convert.ToInt64(dataSet[0]);
                var      IsHIR      = Convert.ToBoolean(dataSet[1]);
                var      documentNo = Convert.ToString(dataSet[2]);

                if (!IsHIR && details.DomesticHelp.IsActivePolicy)
                {
                    try
                    {
                        new Task(() =>
                        {
                            OracleDBIntegration.DBObjects.TransactionWrapper oracleResult =
                                _oracleDomesticInsurance.IntegrateDomesticToOracle((int)domesticID);
                        }).Start();
                    }
                    catch (AggregateException ex)
                    {
                        foreach (Exception inner in ex.InnerExceptions)
                        {
                            _mail.SendMailLogError(inner.Message, details.DomesticHelp.InsuredCode,
                                                   "DomesticHelp", details.DomesticHelp.Agency, true);
                        }
                    }
                }
                return(new DomesticHelpPolicyResponse()
                {
                    IsTransactionDone = true,
                    DomesticID = domesticID,
                    IsHIR = IsHIR,
                    DocumentNo = documentNo
                });
            }
            catch (Exception ex)
            {
                _mail.SendMailLogError(ex.Message, details.DomesticHelp.InsuredCode,
                                       "DomesticHelp", details.DomesticHelp.Agency, false);
                return(new DomesticHelpPolicyResponse()
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = ex.Message
                });
            }
        }
コード例 #7
0
        private BO.PolicyRecord InsertHomeMain(BO.HomeInsurancePolicyDetails policy, string spName)
        {
            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@HomeID", policy.HomeInsurancePolicy.HomeID),
                new SqlParameter("@InsuredCode", policy.HomeInsurancePolicy.InsuredCode),
                new SqlParameter("@InsuredName", policy.HomeInsurancePolicy.InsuredName),
                new SqlParameter("@CPR", policy.HomeInsurancePolicy.CPR),
                new SqlParameter("@Agency", policy.HomeInsurancePolicy.Agency),
                new SqlParameter("@AgentCode", policy.HomeInsurancePolicy.AgentCode),
                new SqlParameter("@BranchCode", policy.HomeInsurancePolicy.AgentBranch),
                new SqlParameter("@MainClass", policy.HomeInsurancePolicy.MainClass),
                new SqlParameter("@SubClass", policy.HomeInsurancePolicy.SubClass),
                new SqlParameter("@MobileNumber", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.Mobile)
                                                                      ? policy.HomeInsurancePolicy.Mobile:""),

                new SqlParameter("@PolicyStartDate", policy.HomeInsurancePolicy.PolicyStartDate != null?
                                 policy.HomeInsurancePolicy.PolicyStartDate:(object)DBNull.Value),

                new SqlParameter("@BuildingValue", policy.HomeInsurancePolicy.BuildingValue),
                new SqlParameter("@ContentValue", policy.HomeInsurancePolicy.ContentValue),
                new SqlParameter("@JewelleryValue", policy.HomeInsurancePolicy.JewelleryValue),
                new SqlParameter("@BuildingAge", policy.HomeInsurancePolicy.BuildingAge),
                new SqlParameter("@IsPropertyMortgaged", policy.HomeInsurancePolicy.IsPropertyMortgaged),
                new SqlParameter("@FinancierCode", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.FinancierCode)
                                                                       ? policy.HomeInsurancePolicy.FinancierCode : ""),

                new SqlParameter("@IsSafePropertyInsured", policy.HomeInsurancePolicy.IsSafePropertyInsured),
                new SqlParameter("@JewelleryCover", policy.HomeInsurancePolicy.JewelleryCover),
                new SqlParameter("@IsRiotStrikeDamage", policy.HomeInsurancePolicy.IsRiotStrikeDamage),
                new SqlParameter("@IsJointOwnership", policy.HomeInsurancePolicy.IsJointOwnership),

                new SqlParameter("@JointOwnerName", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.JointOwnerName)
                                                                        ? policy.HomeInsurancePolicy.JointOwnerName :""),
                new SqlParameter("@NamePolicyReasonSeekingReasons", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.NamePolicyReasonSeekingReasons)
                                                                                      ? policy.HomeInsurancePolicy.NamePolicyReasonSeekingReasons : ""),

                new SqlParameter("@IsPropertyInConnectionTrade", policy.HomeInsurancePolicy.IsPropertyInConnectionTrade),
                new SqlParameter("@IsPropertyCoveredOtherInsurance", policy.HomeInsurancePolicy.IsPropertyCoveredOtherInsurance),
                new SqlParameter("@IsPropertyInsuredSustainedAnyLoss", policy.HomeInsurancePolicy.IsPropertyInsuredSustainedAnyLoss),
                new SqlParameter("@IsPropertyUndergoingConstruction", policy.HomeInsurancePolicy.IsPropertyUndergoingConstruction),
                new SqlParameter("@IsSingleItemAboveContents", policy.HomeInsurancePolicy.IsSingleItemAboveContents),

                new SqlParameter("@BuildingNo", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.BuildingNo)?
                                 policy.HomeInsurancePolicy.BuildingNo:""),

                new SqlParameter("@FlatNo", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.FlatNo) ?  policy.HomeInsurancePolicy.FlatNo:""),
                new SqlParameter("@HouseNo", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.HouseNo) ? policy.HomeInsurancePolicy.HouseNo:""),
                new SqlParameter("@NoOfFloors", policy.HomeInsurancePolicy.NoOfFloors),
                new SqlParameter("@Area", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.Area) ? policy.HomeInsurancePolicy.Area:""),
                new SqlParameter("@BuildingType", policy.HomeInsurancePolicy.BuildingType),
                new SqlParameter("@RoadNo", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.RoadNo) ? policy.HomeInsurancePolicy.RoadNo:""),
                new SqlParameter("@BlockNo", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.BlockNo) ? policy.HomeInsurancePolicy.BlockNo:""),
                new SqlParameter("@ResidanceTypeCode", policy.HomeInsurancePolicy.BuildingType == 1 ? "H" : "F"),
                new SqlParameter("@FFPNumber", !string.IsNullOrEmpty(policy.HomeInsurancePolicy.FFPNumber) ? policy.HomeInsurancePolicy.FFPNumber:""),
                new SqlParameter("@IsRequireDomestic", policy.HomeInsurancePolicy.IsRequireDomestic),
                new SqlParameter("@NumberOfDomesticWorker", policy.HomeInsurancePolicy.NoOfDomesticWorker),
                new SqlParameter("@CreatedBy", policy.HomeInsurancePolicy.CreatedBy),
                new SqlParameter("@AuthorizedBy", policy.HomeInsurancePolicy.AuthorizedBy),
                new SqlParameter("@IsSaved", policy.HomeInsurancePolicy.IsSaved),
                new SqlParameter("@IsActive", policy.HomeInsurancePolicy.IsActivePolicy),
                new SqlParameter("@PaymentType", string.IsNullOrEmpty(policy.HomeInsurancePolicy.PaymentType) ? string.Empty : policy.HomeInsurancePolicy.PaymentType),
                new SqlParameter("@AccountNumber", string.IsNullOrEmpty(policy.HomeInsurancePolicy.AccountNumber)? string.Empty : policy.HomeInsurancePolicy.AccountNumber),
                new SqlParameter("@Remarks", string.IsNullOrEmpty(policy.HomeInsurancePolicy.Remarks) ? string.Empty : policy.HomeInsurancePolicy.Remarks),
                new SqlParameter("@HomeSubItemsdt", policy.HomeSubItemsdt),
                new SqlParameter("@HomeDomesticdt", policy.HomeDomesticHelpdt),
                new SqlParameter("@PremiumBeforeDiscount", PremiumBeforeDiscount),
                new SqlParameter("@PremiumAfterDiscount", PremiumAfterDiscount),
                new SqlParameter("@CommissionBeforeDiscount", CommissionBeforeDiscount),
                new SqlParameter("@CommissionAfterDiscount", CommissionAfterDiscount),
                new SqlParameter("@TaxOnPremiumBeforeDiscount", TaxOnPremiumBeforeDiscount),
                new SqlParameter("@TaxOnPremiumAfterDiscount", TaxOnPremiumAfterDiscount),
                new SqlParameter("@TaxOnCommissionBeforeDiscount", TaxOnCommissionBeforeDiscount),
                new SqlParameter("@TaxOnCommissionAfterDiscount", TaxOnCommissionAfterDiscount),
                new SqlParameter("@BuildingPremium", BuildingPremium),
                new SqlParameter("@ContentPremium", ContentPremium),
                new SqlParameter("@TotalPremium", TotalPremium),
                new SqlParameter("@BuildingRiot", BuildingRiot),
                new SqlParameter("@ContentRiot", ContentRiot),
                new SqlParameter("@TotalRiot", TotalRiot),
                new SqlParameter("@JewelleryAmount", JewellerAmount),
                new SqlParameter("@DomesticHelperAmount", DomesticHelperAmount),
                new SqlParameter("@Discount", Discount),
                new SqlParameter("@RiotRate", RiotRate),
                new SqlParameter("@Rate", BaseBuildingContentRate),
                new SqlParameter("@IsHIR", IsHIR),
                new SqlParameter("@HIRReason", HIRReason ?? string.Empty),
                new SqlParameter("@HIRStatus", HIRStatus),
                new SqlParameter("@UserChangedPremium", policy.HomeInsurancePolicy.UserChangedPremium),
                new SqlParameter("@OldDocumentNumber", policy.HomeInsurancePolicy.OldDocumentNumber ?? string.Empty),
                new SqlParameter("@RenewalDocumentNumber", policy.HomeInsurancePolicy.DocumentNo ?? string.Empty),
                new SqlParameter("@OldRenewalCount", policy.HomeInsurancePolicy.RenewalCount),
                new SqlParameter("@RenewalDelayedDays", policy.HomeInsurancePolicy.RenewalDelayedDays),
                new SqlParameter("@ActualRenewalStartDate", policy.HomeInsurancePolicy.ActualRenewalStartDate.HasValue ? policy.HomeInsurancePolicy.ActualRenewalStartDate : (object)DBNull.Value)
            };
            List <SPOut> outParams = new List <SPOut>()
            {
                new SPOut()
                {
                    OutPutType = SqlDbType.Int, ParameterName = "@NewHomeID"
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.NVarChar, ParameterName = "@DocumentNumber", Size = 100
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.NVarChar, ParameterName = "@LinkIDNew", Size = 100
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.Int, ParameterName = "@RenewalCount"
                },
            };

            object[] dataSet      = BKICSQL.GetValues(spName, paras, outParams);
            var      HomeID       = Convert.ToInt64(dataSet[0]);
            var      DocNo        = Convert.ToString(dataSet[1]);
            var      LinkID       = Convert.ToString(dataSet[2]);
            var      RenewalCount = Convert.ToInt32(dataSet[3]);

            return(new BO.PolicyRecord
            {
                IsInserted = true,
                DocumentNumber = DocNo,
                LinkID = LinkID,
                NewHomeID = HomeID,
                RenewalCount = RenewalCount
            });
        }
コード例 #8
0
        /// <summary>
        /// Insert the new user to the database.
        /// </summary>
        /// <param name="details">User details.</param>
        /// <returns>User inserted or not.</returns>
        public PostUserDetailsResult InsertUserMasterDetails(UserMaster details)
        {
            try
            {
                bool isExist = false;

                Match password = Regex.Match(details.Password, Constants.RegularExpressions.PasswordStrength);
                if (!password.Success)
                {
                    return(new PostUserDetailsResult {
                        PasswordStrength = true
                    });
                }
                if (details.Type != "edit")
                {
                    SqlParameter[] param = new SqlParameter[] {
                        new SqlParameter("@UserName", details.UserName)
                    };
                    List <SPOut> outParams = new List <SPOut>()
                    {
                        new SPOut()
                        {
                            OutPutType = SqlDbType.Bit, ParameterName = "@IsUserNameExists"
                        },
                    };
                    object[] dataSet = BKICSQL.GetValues(UsersSP.UserNamePrecheck, param, outParams);
                    isExist = dataSet[0].ToString() == "True" ? true : false;
                }

                if (!isExist)
                {
                    SqlParameter[] para = new SqlParameter[] {
                        new SqlParameter("@Id", details.Id),
                        new SqlParameter("@Agency", string.IsNullOrEmpty(details.Agency)?"":details.Agency),
                        new SqlParameter("@AgentCode", details.AgentCode ?? string.Empty),
                        new SqlParameter("@AgentBranch", details.AgentBranch ?? string.Empty),
                        new SqlParameter("@UserID", details.UserID ?? string.Empty),
                        new SqlParameter("@UserName", details.UserName ?? string.Empty),
                        new SqlParameter("@CreatedDate", details.CreatedDate),
                        // new SqlParameter("@Password", details.Password),
                        //new SqlParameter("@PasswordExpiryDate", details.PasswordExpiryDate),
                        new SqlParameter("@Mobile", details.Mobile ?? string.Empty),
                        new SqlParameter("@Email", details.Email ?? string.Empty),
                        new SqlParameter("@IsActive", true),
                        new SqlParameter("@StaffNo", details.StaffNo),
                        new SqlParameter("@Role", details.Role ?? string.Empty),
                        new SqlParameter("@CreatedBy", details.CreatedBy),
                        new SqlParameter("@Type", details.Type)
                    };

                    if (details.Type == "insert")
                    {
                        Membership.CreateUser(details.UserName, details.Password, details.Email);

                        //Roles.AddUserToRole(details.UserName, Constants.Roles.User);
                        Roles.AddUserToRole(details.UserName, details.Role);
                    }
                    else if (details.Type == "edit")
                    {
                        var memUser = Membership.GetUser(details.UserName);
                        memUser.Email = details.Email;
                        memUser.ChangePassword(memUser.ResetPassword(), details.Password);
                        //memUser.ResetPassword(details.Password);
                        Membership.UpdateUser(memUser);
                    }
                    BKICSQL.enq(UsersSP.PostUserMaster, para);
                    return(new PostUserDetailsResult
                    {
                        IsTransactionDone = true
                    });
                }
                else
                {
                    return(new PostUserDetailsResult
                    {
                        IsUserAlreadyExists = true
                    });
                }
            }
            catch (Exception ex)
            {
                return(new PostUserDetailsResult
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = ex.Message
                });
            }
        }
コード例 #9
0
        private PolicyRecord InsertMotorMain(MotorInsurancePolicy policy, string spName)
        {
            DataTable optionalCovers = new DataTable();

            optionalCovers.Columns.Add("CoverCode", typeof(string));
            optionalCovers.Columns.Add("CoverDescription", typeof(string));
            optionalCovers.Columns.Add("CoverAmount", typeof(decimal));
            optionalCovers.Columns.Add("IsOptionalCover", typeof(bool));

            if (policy.OptionalCovers != null && policy.OptionalCovers.Count > 0)
            {
                foreach (var cover in policy.OptionalCovers)
                {
                    optionalCovers.Rows.Add(cover.CoverCode, cover.CoverDescription,
                                            cover.CoverAmount, 1);
                }
            }
            SqlParameter[] paras = new SqlParameter[]
            {
                new SqlParameter("@MotorID", policy.MotorID),
                new SqlParameter("@InsuredCode", policy.InsuredCode),
                new SqlParameter("@DOB", policy.DOB),
                new SqlParameter("@YearOfMake", policy.YearOfMake),
                new SqlParameter("@VehicleMake", policy.VehicleMake),
                new SqlParameter("@VehicleModel", policy.VehicleModel),
                new SqlParameter("@vehicleTypeCode", policy.vehicleTypeCode),
                new SqlParameter("@vehicleBodyType", policy.vehicleBodyType),
                new SqlParameter("@VehicleSumInsured", policy.VehicleValue),
                new SqlParameter("@BasePremium", policy.PremiumAmount),
                new SqlParameter("@PolicyCommenceDate", policy.PolicyCommencementDate),
                new SqlParameter("@PolicyEndDate", policy.PolicyEndDate),
                new SqlParameter("@RegistrationNumber", policy.RegistrationNumber ?? ""),
                new SqlParameter("@ChassisNo", policy.ChassisNo),
                new SqlParameter("@EngineCC", policy.EngineCC),
                new SqlParameter("@FinancierCompanyCode", !string.IsNullOrEmpty(policy.FinancierCompanyCode) ? policy.FinancierCompanyCode : ""),
                new SqlParameter("@ExcessType", !string.IsNullOrEmpty(policy.ExcessType) ? policy.ExcessType : ""),
                new SqlParameter("@dt", optionalCovers),
                new SqlParameter("OptionalCoverAmount", policy.OptionalCoverAmount),
                new SqlParameter("@IsUnderBCFC", policy.IsUnderBCFC),
                new SqlParameter("@SeatingCapacity", policy.SeatingCapacity),
                new SqlParameter("@Createdby", policy.CreatedBy),
                new SqlParameter("@AuthorizedBy", policy.AuthorizedBy),
                new SqlParameter("@IsSaved", policy.IsSaved),
                new SqlParameter("@IsActive", policy.IsActivePolicy),
                new SqlParameter("@PaymentAuthorization", policy.PaymentAuthorizationCode ?? ""),
                new SqlParameter("@TransactionNo", policy.TransactionNo ?? ""),
                new SqlParameter("@PaymentType", policy.PaymentType ?? ""),
                new SqlParameter("@AccountNumber", policy.AccountNumber ?? ""),
                new SqlParameter("@Remarks", policy.Remarks ?? ""),
                new SqlParameter("@MainClass", policy.Mainclass ?? ""),
                new SqlParameter("@SubClass", policy.Subclass ?? ""),
                new SqlParameter("@Agency", policy.Agency),
                new SqlParameter("@AgentCode", policy.AgencyCode),
                new SqlParameter("@AgentBranch", policy.AgentBranch),
                new SqlParameter("ExcessAmount", ExcessAmount),
                new SqlParameter("@PremiumBeforeDiscount", PremiumBeforeDiscount),
                new SqlParameter("@PremiumAfterDiscount", PremiumAfterDiscount),
                new SqlParameter("@CommissionBeforeDiscount", CommissionBeforeDiscount),
                new SqlParameter("@CommissionAfterDiscount", CommissionAfterDiscount),
                new SqlParameter("@TaxOnPremiumBeforeDiscount", TaxOnPremiumBeforeDiscount),
                new SqlParameter("@TaxOnPremiumAfterDiscount", TaxOnPremiumAfterDiscount),
                new SqlParameter("@TaxOnCommissionBeforeDiscount", TaxOnCommissionBeforeDiscount),
                new SqlParameter("@TaxOnCommissionAfterDiscount", TaxOnCommissionAfterDiscount),
                new SqlParameter("@Discount", Discount),
                new SqlParameter("@IsHIR", IsHIR),
                new SqlParameter("@HIRReason", HIRReason ?? string.Empty),
                new SqlParameter("@HIRStatus", HIRStatus),
                new SqlParameter("@UserChangedPremium", policy.UserChangedPremium),
                new SqlParameter("@AgeLoadingAmount", AgeLoadingAmount),
                new SqlParameter("@ExcessDiscountPercent", ExcessDiscountPercent),
                new SqlParameter("@ExcessAdditionalAmount", ExcessAdditionalAmount),
                new SqlParameter("@ClaimLoadingPercent", ClaimLoadPercent),
                new SqlParameter("@ClaimLoadingAmount", ClaimLoadingAmount),
                new SqlParameter("@ClaimAmount", policy.ClaimAmount),
                new SqlParameter("@OtherLoadingAmount", policy.LoadAmount),
                new SqlParameter("@OldDocumentNumber", policy.OldDocumentNumber ?? string.Empty),
                new SqlParameter("@RenewalDocumentNumber", policy.DocumentNo ?? string.Empty),
                new SqlParameter("@OldRenewalCount", policy.RenewalCount),
                new SqlParameter("@RenewalDelayedDays", policy.RenewalDelayedDays),
                new SqlParameter("@ActualRenewalStartDate", policy.ActualRenewalStartDate.HasValue ? policy.ActualRenewalStartDate : (object)DBNull.Value)
            };
            List <SPOut> outParams = new List <SPOut>()
            {
                new SPOut()
                {
                    OutPutType = SqlDbType.BigInt, ParameterName = "@NewMotorID"
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.NVarChar, ParameterName = "@DocumentNumber", Size = 100
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.NVarChar, ParameterName = "@LinkIDNew", Size = 100
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.Int, ParameterName = "@RenewalCount"
                },
            };

            object[] dataSet      = BKICSQL.GetValues(spName, paras, outParams);
            var      MotorID      = Convert.ToInt64(dataSet[0] != null ? dataSet[0] : 0);
            var      DocNo        = Convert.ToString(dataSet[1]);
            var      LinkID       = Convert.ToString(dataSet[2]);
            var      RenewalCount = Convert.ToInt32(dataSet[3]);

            return(new PolicyRecord
            {
                IsInserted = true,
                DocumentNumber = DocNo,
                LinkID = LinkID,
                NewMotorID = MotorID,
                RenewalCount = RenewalCount
            });
        }
コード例 #10
0
        private MotorEndorsementResult InsertAdminMotorEndorsement(BO.MotorEndorsement motorEndorsement)
        {
            try
            {
                SqlParameter[] paras = new SqlParameter[]
                {
                    new  SqlParameter("@MotorID", motorEndorsement.MotorID),
                    new  SqlParameter("@MotorendorsementID", motorEndorsement.MotorEndorsementID),
                    new  SqlParameter("@EndorsementType", motorEndorsement.EndorsementType ?? ""),
                    new  SqlParameter("@Agency", motorEndorsement.Agency),
                    new  SqlParameter("@AgentCode", motorEndorsement.AgencyCode),
                    new  SqlParameter("@BranchCode", motorEndorsement.AgentBranch ?? ""),
                    new SqlParameter("@CreatedBy", motorEndorsement.CreatedBy),
                    new  SqlParameter("@DocumentNo", motorEndorsement.DocumentNo ?? ""),
                    new  SqlParameter("@InsuredCode", motorEndorsement.InsuredCode ?? ""),
                    new  SqlParameter("@OldInsuredCode", motorEndorsement.OldInsuredCode ?? " "),
                    new  SqlParameter("@InsuredName", motorEndorsement.InsuredName ?? ""),
                    new  SqlParameter("@OldInsuredName", motorEndorsement.OldInsuredName ?? ""),
                    new  SqlParameter("@RegistrationNo", motorEndorsement.RegistrationNo ?? ""),
                    new  SqlParameter("@OldRegistrationNo", motorEndorsement.OldRegistrationNo ?? ""),
                    new  SqlParameter("@ChassisNo", motorEndorsement.ChassisNo ?? ""),
                    new  SqlParameter("@OldChassisNo", motorEndorsement.OldChassisNo ?? ""),
                    new  SqlParameter("@VechicleValue", motorEndorsement.VehicleValue),
                    new  SqlParameter("@Premium", motorEndorsement.PremiumAmount),
                    new  SqlParameter("@FinanceCompany", motorEndorsement.FinancierCompanyCode ?? ""),
                    new  SqlParameter("@MainClass", motorEndorsement.Mainclass ?? ""),
                    new  SqlParameter("@SubClass", motorEndorsement.Subclass ?? ""),
                    new  SqlParameter("@CommencementDate", motorEndorsement.PolicyCommencementDate),
                    new  SqlParameter("@ExpireDate", motorEndorsement.ExpiryDate),
                    new  SqlParameter("@ExtendedExpireDate", motorEndorsement.ExtendedExpireDate.HasValue ? motorEndorsement.ExtendedExpireDate.Value : (object)DBNull.Value),
                    new  SqlParameter("@CancelDate", motorEndorsement.CancelDate.HasValue ? motorEndorsement.CancelDate.Value : (object)DBNull.Value),
                    new  SqlParameter("@PaymentDate", motorEndorsement.PaymentDate.HasValue ? motorEndorsement.PaymentDate.Value : (object)DBNull.Value),
                    new  SqlParameter("@PaymentType", motorEndorsement.PaymentType ?? ""),
                    new  SqlParameter("@AccountNumber", motorEndorsement.AccountNumber ?? ""),
                    new  SqlParameter("@Remarks", motorEndorsement.Remarks ?? ""),
                    new  SqlParameter("@Source", motorEndorsement.Source ?? ""),
                    new  SqlParameter("@IsSaved", motorEndorsement.IsSaved),
                    new  SqlParameter("@IsActive", motorEndorsement.IsActivePolicy),
                    new  SqlParameter("@RefoundAmount", motorEndorsement.RefundAmount),
                    new  SqlParameter("@RefoundAfterDiscount", motorEndorsement.RefundAfterDiscount),
                    new  SqlParameter("@NewPremium", motorEndorsement.NewPremium),
                    new  SqlParameter("@NewSumInsured", motorEndorsement.NewSumInsured),
                    new SqlParameter("@NewExcess", motorEndorsement.NewExcess),
                    new SqlParameter("@CPR", motorEndorsement.CPR),
                    new SqlParameter("PremiumBeforeDiscount", motorEndorsement.PremiumBeforeDiscount),
                    new SqlParameter("@PremiumAfterDiscount", motorEndorsement.PremiumAfterDiscount),
                    new SqlParameter("@CommissionBeforeDiscount", motorEndorsement.CommisionBeforeDiscount),
                    new SqlParameter("@CommissionAfterDiscount", motorEndorsement.CommissionAfterDiscount),
                    new SqlParameter("@UserChangedPremium", motorEndorsement.UserChangedPremium),
                    new SqlParameter("@VehicleMake", motorEndorsement.VehicleMake),
                    new SqlParameter("@VehicleModel", motorEndorsement.VehicleModel),
                    new SqlParameter("@VehicleYear", motorEndorsement.VehicleYear),
                    new SqlParameter("@VehicleBodyType", motorEndorsement.VehicleBodyType),
                    new SqlParameter("@Tonnage", motorEndorsement.EngineCC)
                };
                List <SPOut> outParams = new List <SPOut>()
                {
                    new SPOut()
                    {
                        OutPutType = SqlDbType.BigInt, ParameterName = "@NewMotorEndorsementID"
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.NVarChar, ParameterName = "@EndorsementNumber", Size = 50
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.NVarChar, ParameterName = "@DocumentNumber", Size = 50
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.NVarChar, ParameterName = "@EndorsementLinkID", Size = 50
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.Int, ParameterName = "@EndorsementCount"
                    },
                };

                object[] dataSet = BKICSQL.GetValues(MotorEndorsementSP.PostAdminMotorEndorsement, paras, outParams);

                var endorsementID     = string.IsNullOrEmpty(dataSet[0].ToString()) ? 0 : Convert.ToInt64(dataSet[0].ToString());
                var endorsementNumber = string.IsNullOrEmpty(dataSet[1].ToString()) ? string.Empty : Convert.ToString(dataSet[1].ToString());
                var documentNumber    = string.IsNullOrEmpty(dataSet[2].ToString()) ? string.Empty : Convert.ToString(dataSet[2].ToString());
                var endorsementLinkID = string.IsNullOrEmpty(dataSet[3].ToString()) ? string.Empty : Convert.ToString(dataSet[3].ToString());
                var endorsementCount  = string.IsNullOrEmpty(dataSet[4].ToString()) ? 0 : Convert.ToInt32(dataSet[4].ToString());

                return(new MotorEndorsementResult()
                {
                    IsTransactionDone = true,
                    EndorsementNo = endorsementNumber,
                    MotorEndorsementID = endorsementID,
                    LinkID = endorsementLinkID,
                    DocumentNo = documentNumber,
                    EndorsementCount = endorsementCount
                });
            }
            catch (Exception ex)
            {
                _mail.SendMailLogError(ex.Message, motorEndorsement.InsuredCode, "MotorEndorsement", motorEndorsement.Agency, false);
                return(new MotorEndorsementResult()
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = ex.Message
                });
            }
        }
コード例 #11
0
        private MotorEndorsementResult InsertMotorEndorsement(BO.MotorEndorsement motorEndorsement)
        {
            DataTable motorCovers = new DataTable();

            motorCovers.Columns.Add("CoverCode", typeof(string));
            motorCovers.Columns.Add("CoverDescription", typeof(string));
            motorCovers.Columns.Add("CoverAmount", typeof(decimal));
            motorCovers.Columns.Add("AddedByEndorsement", typeof(bool));

            if (motorEndorsement.Covers != null && motorEndorsement.Covers.Count > 0)
            {
                foreach (var cover in motorEndorsement.Covers)
                {
                    motorCovers.Rows.Add(cover.CoverCode, cover.CoverDescription, cover.CoverAmount, cover.AddedByEndorsement);
                }
            }
            SqlParameter[] paras = new SqlParameter[]
            {
                new  SqlParameter("@MotorID", motorEndorsement.MotorID),
                new  SqlParameter("@MotorendorsementID", motorEndorsement.MotorEndorsementID),
                new  SqlParameter("@EndorsementType", motorEndorsement.EndorsementType ?? ""),
                new  SqlParameter("@Agency", motorEndorsement.Agency),
                new  SqlParameter("@AgentCode", motorEndorsement.AgencyCode),
                new  SqlParameter("@BranchCode", motorEndorsement.AgentBranch ?? ""),
                new SqlParameter("@CreatedBy", motorEndorsement.CreatedBy),
                new  SqlParameter("@DocumentNo", motorEndorsement.DocumentNo ?? ""),
                new  SqlParameter("@InsuredCode", motorEndorsement.InsuredCode ?? ""),
                new  SqlParameter("@OldInsuredCode", motorEndorsement.OldInsuredCode ?? " "),
                new  SqlParameter("@InsuredName", motorEndorsement.InsuredName ?? ""),
                new  SqlParameter("@OldInsuredName", motorEndorsement.OldInsuredName ?? ""),
                new  SqlParameter("@RegistrationNo", motorEndorsement.RegistrationNo ?? ""),
                new  SqlParameter("@OldRegistrationNo", motorEndorsement.OldRegistrationNo ?? ""),
                new  SqlParameter("@ChassisNo", motorEndorsement.ChassisNo ?? ""),
                new  SqlParameter("@OldChassisNo", motorEndorsement.OldChassisNo ?? ""),
                new  SqlParameter("@VechicleValue", motorEndorsement.VehicleValue),
                new  SqlParameter("@Premium", motorEndorsement.PremiumAmount),
                new  SqlParameter("@FinanceCompany", motorEndorsement.FinancierCompanyCode ?? ""),
                new  SqlParameter("@MainClass", motorEndorsement.Mainclass ?? ""),
                new  SqlParameter("@SubClass", motorEndorsement.Subclass ?? ""),
                new  SqlParameter("@CommencementDate", motorEndorsement.PolicyCommencementDate),
                new  SqlParameter("@ExpireDate", motorEndorsement.ExpiryDate),
                new  SqlParameter("@ExtendedExpireDate", motorEndorsement.ExtendedExpireDate.HasValue ? motorEndorsement.ExtendedExpireDate.Value : (object)DBNull.Value),
                new  SqlParameter("@CancelDate", motorEndorsement.CancelDate.HasValue ? motorEndorsement.CancelDate.Value : (object)DBNull.Value),
                new  SqlParameter("@PaymentDate", motorEndorsement.PaymentDate.HasValue ? motorEndorsement.PaymentDate.Value : (object)DBNull.Value),
                new  SqlParameter("@PaymentType", motorEndorsement.PaymentType ?? ""),
                new  SqlParameter("@AccountNumber", motorEndorsement.AccountNumber ?? ""),
                new  SqlParameter("@Remarks", motorEndorsement.Remarks ?? ""),
                new  SqlParameter("@Source", motorEndorsement.Source ?? ""),
                new  SqlParameter("@RefundType", motorEndorsement.RefundType ?? ""),
                new  SqlParameter("@IsSaved", motorEndorsement.IsSaved),
                new  SqlParameter("@IsActive", motorEndorsement.IsActivePolicy),
                new SqlParameter("@dt", motorCovers),
                new  SqlParameter("@RefoundAmount", motorEndorsement.RefundAmount),
                new  SqlParameter("@RefoundAfterDiscount", motorEndorsement.RefundAfterDiscount),
                new SqlParameter("@NewExcess", motorEndorsement.NewExcess),
                new SqlParameter("@CPR", motorEndorsement.CPR),
                new SqlParameter("@PremiumBeforeDiscount", motorEndorsement.PremiumBeforeDiscount),
                new SqlParameter("@PremiumAfterDiscount", motorEndorsement.PremiumAfterDiscount),
                new SqlParameter("@CommissionBeforeDiscount", motorEndorsement.CommisionBeforeDiscount),
                new SqlParameter("@CommissionAfterDiscount", motorEndorsement.CommissionAfterDiscount),
                new SqlParameter("@UserChangedPremium", motorEndorsement.UserChangedPremium),
                new SqlParameter("@VehicleMake", motorEndorsement.VehicleMake),
                new SqlParameter("@VehicleModel", motorEndorsement.VehicleModel),
                new SqlParameter("@VehicleYear", motorEndorsement.VehicleYear),
                new SqlParameter("@VehicleBodyType", motorEndorsement.VehicleBodyType),
                new SqlParameter("@Tonnage", motorEndorsement.EngineCC)
            };
            List <SPOut> outParams = new List <SPOut>()
            {
                new SPOut()
                {
                    OutPutType = SqlDbType.BigInt, ParameterName = "@NewMotorEndorsementID"
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.NVarChar, ParameterName = "@EndorsementNumber", Size = 50
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.NVarChar, ParameterName = "@DocumentNumber", Size = 50
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.NVarChar, ParameterName = "@EndorsementLinkID", Size = 50
                },
                new SPOut()
                {
                    OutPutType = SqlDbType.Int, ParameterName = "@EndorsementCount"
                },
            };

            object[] dataSet = BKICSQL.GetValues(MotorEndorsementSP.PostMotorEndorsement, paras, outParams);

            var endorsementID     = string.IsNullOrEmpty(dataSet[0].ToString()) ? 0 : Convert.ToInt64(dataSet[0].ToString());
            var endorsementNumber = string.IsNullOrEmpty(dataSet[1].ToString()) ? string.Empty : Convert.ToString(dataSet[1].ToString());
            var documentNumber    = string.IsNullOrEmpty(dataSet[2].ToString()) ? string.Empty : Convert.ToString(dataSet[2].ToString());
            var endorsementLinkID = string.IsNullOrEmpty(dataSet[3].ToString()) ? string.Empty : Convert.ToString(dataSet[3].ToString());
            var endorsementCount  = string.IsNullOrEmpty(dataSet[4].ToString()) ? 0: Convert.ToInt32(dataSet[4].ToString());

            return(new MotorEndorsementResult()
            {
                IsTransactionDone = true,
                EndorsementNo = endorsementNumber,
                MotorEndorsementID = endorsementID,
                LinkID = endorsementLinkID,
                DocumentNo = documentNumber,
                EndorsementCount = endorsementCount
            });
        }
コード例 #12
0
        /// <summary>
        /// Calculate endorsement premium by endorsement type.
        /// </summary>
        /// <param name="homeEndorsement">Endorement quote request.</param>
        /// <returns>Returns endorsement premium and commision.</returns>
        public MotorEndorsementQuoteResult GetMotorEndorsementQuote(MotorEndorsementQuote motorEndorsement)
        {
            if (motorEndorsement.EndorsementType == MotorEndorsementTypes.ChangeSumInsured)
            {
                try
                {
                    SqlParameter[] paras = new SqlParameter[]
                    {
                        new  SqlParameter("@Agency", motorEndorsement.Agency),
                        new  SqlParameter("@AgentCode", motorEndorsement.AgentCode),
                        new  SqlParameter("@MainClass", motorEndorsement.MainClass),
                        new  SqlParameter("@SubClass", motorEndorsement.SubClass),
                        new SqlParameter("@InsuredCode", motorEndorsement.InsuredCode),
                        new  SqlParameter("@EffectiveFromDate", motorEndorsement.EffectiveFromDate),
                        new  SqlParameter("@EffectiveToDate", motorEndorsement.EffectiveToDate),
                        //new  SqlParameter("@PaidPremium",motorEndorsement.PaidPremium),
                        new  SqlParameter("@NewSumInsured", motorEndorsement.NewSumInsured),
                        new  SqlParameter("@EndorsementType", motorEndorsement.EndorsementType),
                        new SqlParameter("@DocumentNo", motorEndorsement.DocumentNo)
                    };
                    List <SPOut> outParams = new List <SPOut>()
                    {
                        new SPOut()
                        {
                            OutPutType = SqlDbType.Decimal, ParameterName = "@EndorsementPremium", Precision = 38, Scale = 3
                        },
                        new SPOut()
                        {
                            OutPutType = SqlDbType.Decimal, ParameterName = "@RefundPremium", Precision = 38, Scale = 3
                        },
                        new SPOut()
                        {
                            OutPutType = SqlDbType.Decimal, ParameterName = "@RefundVat", Precision = 38, Scale = 3
                        },
                    };

                    object[] dataSet = BKICSQL.GetValues(MotorEndorsementSP.GetAdminQuote, paras, outParams);

                    var endorsementPremium = string.IsNullOrEmpty(dataSet[0].ToString()) ? 0 : decimal.Parse(dataSet[0].ToString(), CultureInfo.InvariantCulture.NumberFormat);
                    var refundPremium      = string.IsNullOrEmpty(dataSet[1].ToString()) ? 0 : decimal.Parse(dataSet[1].ToString(), CultureInfo.InvariantCulture.NumberFormat);
                    var refundVat          = string.IsNullOrEmpty(dataSet[2].ToString()) ? 0 : decimal.Parse(dataSet[2].ToString(), CultureInfo.InvariantCulture.NumberFormat);

                    return(new MotorEndorsementQuoteResult()
                    {
                        IsTransactionDone = true,
                        EndorsementPremium = endorsementPremium,
                        RefundPremium = refundPremium,
                        RefundVat = refundVat
                    });
                }
                catch (Exception ex)
                {
                    return(new MotorEndorsementQuoteResult()
                    {
                        IsTransactionDone = false,
                        TransactionErrorMessage = ex.Message
                    });
                }
            }
            else
            {
                try
                {
                    SqlParameter[] paras = new SqlParameter[]
                    {
                        new  SqlParameter("@Agency", motorEndorsement.Agency),
                        new  SqlParameter("@AgentCode", motorEndorsement.AgentCode),
                        new SqlParameter("DocumentNo", motorEndorsement.DocumentNo),
                        new  SqlParameter("@MainClass", motorEndorsement.MainClass),
                        new  SqlParameter("@SubClass", motorEndorsement.SubClass),
                        new SqlParameter("@OldInsuredCode", motorEndorsement.InsuredCode ?? string.Empty),
                        new  SqlParameter("@NewInsuredCode", motorEndorsement.NewInsuredCode),
                        new  SqlParameter("@EffectiveFromDate", motorEndorsement.EffectiveFromDate),
                        new  SqlParameter("@EffectiveToDate", motorEndorsement.EffectiveToDate),
                        new  SqlParameter("@CancelationDate", motorEndorsement.CancelationDate),
                        new  SqlParameter("@ExtendedDays", motorEndorsement.ExtendedDays),
                        new  SqlParameter("@PaidPremium", motorEndorsement.PaidPremium),
                        new  SqlParameter("@SumInsured", motorEndorsement.OldSumInsured),
                        new  SqlParameter("@EndorsementType", motorEndorsement.EndorsementType ?? ""),
                        new  SqlParameter("@RefundType", motorEndorsement.RefundType ?? ""),
                    };
                    List <SPOut> outParams = new List <SPOut>()
                    {
                        new SPOut()
                        {
                            OutPutType = SqlDbType.Decimal, ParameterName = "@EndorsementPremium", Precision = 38, Scale = 3
                        },
                        new SPOut()
                        {
                            OutPutType = SqlDbType.Decimal, ParameterName = "@Commission", Precision = 38, Scale = 3
                        },
                        new SPOut()
                        {
                            OutPutType = SqlDbType.Decimal, ParameterName = "@RefundVat", Precision = 38, Scale = 3
                        },
                    };

                    object[] dataSet            = BKICSQL.GetValues(MotorEndorsementSP.GetQuote, paras, outParams);
                    var      endorsementPremium = string.IsNullOrEmpty(dataSet[0].ToString()) ? 0 : decimal.Parse(dataSet[0].ToString(), CultureInfo.InvariantCulture.NumberFormat);
                    var      commission         = string.IsNullOrEmpty(dataSet[1].ToString()) ? 0 : decimal.Parse(dataSet[1].ToString(), CultureInfo.InvariantCulture.NumberFormat);
                    var      refundVat          = string.IsNullOrEmpty(dataSet[2].ToString()) ? 0 : decimal.Parse(dataSet[2].ToString(), CultureInfo.InvariantCulture.NumberFormat);

                    return(new MotorEndorsementQuoteResult()
                    {
                        IsTransactionDone = true,
                        EndorsementPremium = endorsementPremium,
                        Commision = commission,
                        RefundVat = refundVat
                    });
                }
                catch (Exception ex)
                {
                    return(new MotorEndorsementQuoteResult()
                    {
                        IsTransactionDone = false,
                        TransactionErrorMessage = ex.Message
                    });
                }
            }
        }
コード例 #13
0
        /// <summary>
        /// Insert the travel endorsement.
        /// </summary>
        /// <param name="travelEndorsement">Travel endorsement details.</param>
        /// <returns>Travelendorsementid, Travelendorementnumber.</returns>
        public TravelEndorsementResponse PostTravelEndorsement(BO.TravelEndorsement travelEndorsement)
        {
            try
            {
                DataTable member = new DataTable();
                member.Columns.Add("TRAVELID", typeof(Int64));
                member.Columns.Add("DOCUMENTNO", typeof(string));
                member.Columns.Add("ITEMSERIALNO", typeof(Int32));
                member.Columns.Add("ITEMNAME", typeof(string));
                member.Columns.Add("SUMINSURED", typeof(decimal));
                member.Columns.Add("FOREIGNSUMINSURED", typeof(decimal));
                member.Columns.Add("CATEGORY", typeof(string));
                member.Columns.Add("TITLE", typeof(string));
                member.Columns.Add("SEX", typeof(string));
                member.Columns.Add("DATEOFBIRTH", typeof(DateTime));
                member.Columns.Add("AGE", typeof(string));
                member.Columns.Add("PREMIUMAMOUNT", typeof(decimal));
                member.Columns.Add("MAKE", typeof(string));
                member.Columns.Add("OCCUPATIONCODE", typeof(string));
                member.Columns.Add("CPR", typeof(string));
                member.Columns.Add("PASSPORT", typeof(string));
                member.Columns.Add("FIRSTNAME", typeof(string));
                member.Columns.Add("MIDDLENAME", typeof(string));
                member.Columns.Add("LASTNAME", typeof(string));
                member.Columns.Add("CREATEDBY", typeof(int));
                member.Columns.Add("CREATEDDATE", typeof(DateTime));
                member.Columns.Add("UPDATEDBY", typeof(int));
                member.Columns.Add("UPDATEDDATE", typeof(DateTime));
                member.Columns.Add("LINKID", typeof(string));
                if (travelEndorsement.TravelMembers.Count > 0)
                {
                    foreach (var members in travelEndorsement.TravelMembers)
                    {
                        members.UpdatedDate = DateTime.Now;
                        //members.CreatedDate = DateTime.Now;
                        //members.DateOfBirth = DateTime.Now;

                        member.Rows.Add(members.TravelID, members.DocumentNo, members.ItemSerialNo, members.ItemName, members.SumInsured,
                                        members.ForeignSumInsured, members.Category, members.Title, members.Sex, members.DateOfBirth, members.Age,
                                        members.PremiumAmount, members.Make, members.OccupationCode, members.CPR, members.Passport, members.FirstName,
                                        members.MiddleName, members.LastName, members.CreatedBy, members.CreatedDate, members.UpdatedBy, members.UpdatedDate, "");
                    }
                }

                SqlParameter[] paras = new SqlParameter[]
                {
                    new  SqlParameter("@TravelID", travelEndorsement.TravelID),
                    new  SqlParameter("@TravelendorsementID", travelEndorsement.TravelEndorsementID),
                    new  SqlParameter("@EndorsementType", travelEndorsement.EndorsementType ?? ""),
                    new  SqlParameter("@Agency", travelEndorsement.Agency),
                    new  SqlParameter("@AgentCode", travelEndorsement.AgencyCode),
                    new  SqlParameter("@BranchCode", travelEndorsement.AgentBranch ?? ""),
                    new SqlParameter("@CreatedBy", travelEndorsement.CreatedBy),
                    new  SqlParameter("@DocumentNo", travelEndorsement.DocumentNo ?? ""),
                    new  SqlParameter("@InsuredCode", travelEndorsement.InsuredCode ?? ""),
                    new  SqlParameter("@InsuredName", travelEndorsement.InsuredName ?? ""),
                    new  SqlParameter("@Premium", travelEndorsement.PremiumAmount),
                    new  SqlParameter("@FinanceCompany", travelEndorsement.FinancierCompanyCode ?? ""),
                    new  SqlParameter("@MainClass", travelEndorsement.Mainclass ?? ""),
                    new  SqlParameter("@SubClass", travelEndorsement.Subclass ?? ""),
                    new  SqlParameter("@CommencementDate", travelEndorsement.PolicyCommencementDate),
                    new  SqlParameter("@ExpireDate", travelEndorsement.ExpiryDate),
                    new  SqlParameter("@ExtendedExpireDate", travelEndorsement.ExtendedExpireDate.HasValue ? travelEndorsement.ExtendedExpireDate.Value : (object)DBNull.Value),
                    new  SqlParameter("@CancelDate", travelEndorsement.CancelDate.HasValue ? travelEndorsement.CancelDate.Value : (object)DBNull.Value),
                    new  SqlParameter("@PaymentDate", travelEndorsement.PaymentDate.HasValue ? travelEndorsement.PaymentDate.Value : (object)DBNull.Value),
                    new  SqlParameter("@PaymentType", travelEndorsement.PaymentType ?? ""),
                    new  SqlParameter("@AccountNumber", travelEndorsement.AccountNumber ?? ""),
                    new  SqlParameter("@Remarks", travelEndorsement.Remarks ?? ""),
                    new  SqlParameter("@Source", travelEndorsement.Source ?? ""),
                    new  SqlParameter("@IsSaved", travelEndorsement.IsSaved),
                    new  SqlParameter("@IsActive", travelEndorsement.IsActivePolicy),
                    new SqlParameter("@dt", member),
                    new SqlParameter("@RefundType", travelEndorsement.RefundType ?? ""),
                    new SqlParameter("@PolicyPeriodName", travelEndorsement.PolicyPeriodName ?? ""),
                    new SqlParameter("@NewPremium", travelEndorsement.NewPremium),
                    new  SqlParameter("@RefoundAmount", travelEndorsement.RefundAmount),
                    new  SqlParameter("@RefoundAfterDiscount", travelEndorsement.RefundAfterDiscount),
                    new SqlParameter("@PremiumBeforeDiscount", travelEndorsement.PremiumBeforeDiscount),
                    new SqlParameter("@PremiumAfterDiscount", travelEndorsement.PremiumAfterDiscount),
                    new SqlParameter("@CommissionBeforeDiscount", travelEndorsement.CommisionBeforeDiscount),
                    new SqlParameter("@CommissionAfterDiscount", travelEndorsement.CommissionAfterDiscount),
                    new SqlParameter("@UserChangedPremium", travelEndorsement.UserChangedPremium),
                };
                List <SPOut> outParams = new List <SPOut>()
                {
                    new SPOut()
                    {
                        OutPutType = SqlDbType.BigInt, ParameterName = "@NewTravelEndorsementID"
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.Bit, ParameterName = "@IsHIR"
                    },
                    new SPOut()
                    {
                        OutPutType = SqlDbType.NVarChar, ParameterName = "@EndorsementNumber", Size = 50
                    },
                };

                object[] dataSet = BKICSQL.GetValues(TravelEndorsementSP.PostTravelEndorsement, paras, outParams);

                var endorsementID     = string.IsNullOrEmpty(dataSet[0].ToString()) ? 0 : Convert.ToInt64(dataSet[0].ToString());
                var isHIR             = string.IsNullOrEmpty(dataSet[1].ToString()) ? false : Convert.ToBoolean(dataSet[1].ToString());
                var EndorsementNumber = string.IsNullOrEmpty(dataSet[2].ToString()) ? string.Empty : Convert.ToString(dataSet[2].ToString());
                return(new TravelEndorsementResponse()
                {
                    IsTransactionDone = true,
                    EndorsementNo = EndorsementNumber,
                    TravelEndorsementID = endorsementID,
                    IsHIR = isHIR
                });
            }
            catch (Exception ex)
            {
                _mail.SendMailLogError(ex.Message, travelEndorsement.InsuredCode, "MotorEndorsement", travelEndorsement.Agency, false);
                return(new TravelEndorsementResponse()
                {
                    IsTransactionDone = false,
                    TransactionErrorMessage = ex.Message
                });
            }
        }