コード例 #1
0
        public DataMessage Renew(USSDPolicy model)
        {
            DataHelper helper = new DataHelper(Configuration);

            SqlParameter[] sqlParameters =
            {
                new SqlParameter("@AuditUserID",           UserId),
                new SqlParameter("@InsuranceNumber",       model.InsuranceNumber),
                new SqlParameter("@RenewalDate",           model.Date),
                new SqlParameter("@ProductCode",           model.ProductCode),
                new SqlParameter("@EnrollmentOfficerCode", model.EnrollmentOfficerCode)
            };

            DataMessage message;

            try
            {
                var response = helper.Procedure("uspAPIRenewPolicy", sqlParameters);
                message = new RenewPolicyResponse(response.Code, false, 0).Message;
            }
            catch (Exception e)
            {
                message = new EditFamilyResponse(e).Message;
            }

            return(message);
        }
コード例 #2
0
        public IActionResult Renew_PolicyChf([FromBody] ChfPolicy model)
        {
            if (!ModelState.IsValid)
            {
                var error = ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage;
                return(BadRequest(new { success = false, message = error }));
            }

            USSDPolicy policy = new USSDPolicy()
            {
                InsuranceNumber       = model.InsuranceNumber,
                EnrollmentOfficerCode = model.OfficerCode,
                ProductCode           = model.ProductCode,
                Date = DateTime.UtcNow.ToString("yyyy/MM/dd")
            };

            JsonResult  resp    = (JsonResult)base.Renew_Policy(policy);
            DataMessage message = (DataMessage)resp.Value;

            var response = new RenewPolicyResponse(message.Code, false, 0).Message;

            if (!response.ErrorOccured)
            {
                return(Ok(new { success = true, message = response.MessageValue }));
            }
            else
            {
                return(BadRequest(new { success = false, message = response.MessageValue }));
            }
        }