예제 #1
0
        public bool EndorsementPrecheck()
        {
            master.IsSessionAvailable();
            var userInfo = CommonMethods.GetUserDetails();
            var service  = CommonMethods.GetLogedInService();

            var req = new MotorEndorsementPreCheckRequest
            {
                DocNo = ddlMotorPolicies.SelectedIndex > 0 ? ddlMotorPolicies.SelectedItem.Text : string.Empty
            };

            var result = service.PostData <BKIC.SellingPoint.DTO.RequestResponseWrappers.ApiResponseWrapper
                                           <BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEndorsementPreCheckResponse>,
                                           BKIC.SellingPoint.DTO.RequestResponseWrappers.MotorEndorsementPreCheckRequest>
                             (BKIC.SellingPoint.DTO.Constants.MotorEndorsementURI.EndorsementPreCheck, req);

            if (result.StatusCode == 200 && result.Result.IsTransactionDone)
            {
                return(result.Result.IsAlreadyHave);
            }
            return(false);
        }
 /// <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
         });
     }
 }