Example #1
0
 public RR.DomesticHelpPolicyResponse PostDomesticPolicy(RR.DomesticPolicyDetails policydetails)
 {
     try
     {
         if (ModelState.IsValid)
         {
             BLO.DomesticPolicyDetails policy = new BLO.DomesticPolicyDetails();
             policy.DomesticHelp.Agency                    = policydetails.DomesticHelp.Agency;
             policy.DomesticHelp.AgentCode                 = policydetails.DomesticHelp.AgentCode;
             policy.DomesticHelp.AgentBranch               = policydetails.DomesticHelp.AgentBranch;
             policy.DomesticHelp.MainClass                 = policydetails.DomesticHelp.MainClass;
             policy.DomesticHelp.SubClass                  = policydetails.DomesticHelp.SubClass;
             policy.DomesticHelp.DomesticID                = policydetails.DomesticHelp.DomesticID;
             policy.DomesticHelp.InsuredCode               = policydetails.DomesticHelp.InsuredCode;
             policy.DomesticHelp.InsuredName               = policydetails.DomesticHelp.InsuredName;
             policy.DomesticHelp.CPR                       = policydetails.DomesticHelp.CPR;
             policy.DomesticHelp.InsurancePeroid           = policydetails.DomesticHelp.InsurancePeroid;
             policy.DomesticHelp.NoOfDomesticWorkers       = policydetails.DomesticHelp.NoOfDomesticWorkers;
             policy.DomesticHelp.PolicyStartDate           = policydetails.DomesticHelp.PolicyStartDate;
             policy.DomesticHelp.DomesticWorkType          = policydetails.DomesticHelp.DomesticWorkType;
             policy.DomesticHelp.IsPhysicalDefect          = policydetails.DomesticHelp.IsPhysicalDefect;
             policy.DomesticHelp.PhysicalDefectDescription = policydetails.DomesticHelp.PhysicalDefectDescription;
             policy.DomesticHelp.CreatedBy                 = policydetails.DomesticHelp.CreatedBy;
             policy.DomesticHelp.AuthorizedBy              = policydetails.DomesticHelp.IsActivePolicy == true ? policydetails.DomesticHelp.CreatedBy : 0;
             policy.DomesticHelp.Mobile                    = policydetails.DomesticHelp.Mobile;
             policy.DomesticHelp.IsSaved                   = policydetails.DomesticHelp.IsSaved;
             policy.DomesticHelp.IsActivePolicy            = policydetails.DomesticHelp.IsActivePolicy;
             policy.DomesticHelp.CommissionAmount          = policydetails.DomesticHelp.CommissionAmount;
             policy.DomesticHelp.Remarks                   = policydetails.DomesticHelp.Remarks;
             policy.DomesticHelp.AccountNumber             = policydetails.DomesticHelp.AccountNumber;
             policy.DomesticHelp.PaymentType               = policydetails.DomesticHelp.PaymentType;
             policy.DomesticHelp.CommissionAfterDiscount   = policydetails.DomesticHelp.CommissionAfterDiscount;
             policy.DomesticHelp.PremiumAfterDiscount      = policydetails.DomesticHelp.PremiumAfterDiscount;
             policy.DomesticHelp.UserChangedPremium        = policydetails.DomesticHelp.UserChangedPremium;
             policy.DomesticHelpMemberdt                   = GetDomesticHelpMembers(policydetails, policy);
             BLO.DomesticHelpPolicyResponse result = _domesticHelpRepo.PostDomesticPolicy(policy);
             return(_mapper.Map <BLO.DomesticHelpPolicyResponse, RR.DomesticHelpPolicyResponse>(result));
         }
         else
         {
             var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));
             return(new RR.DomesticHelpPolicyResponse()
             {
                 IsTransactionDone = false,
                 TransactionErrorMessage = message
             });
         }
     }
     catch (Exception ex)
     {
         return(new RR.DomesticHelpPolicyResponse()
         {
             IsTransactionDone = false,
             TransactionErrorMessage = ex.Message
         });
     }
 }
Example #2
0
        private DataTable GetDomesticHelpMembers(RR.DomesticPolicyDetails policyDetails, BLO.DomesticPolicyDetails policy)
        {
            DataTable member = new DataTable();

            if (policyDetails.DomesticHelpMemberList.Count > 0)
            {
                member.Columns.Add("INSUREDCODE", typeof(string));
                member.Columns.Add("INSUREDNAME", typeof(string));
                member.Columns.Add("SUMINSURED", typeof(decimal));
                member.Columns.Add("PREMIUMAMOUNT", typeof(decimal));
                member.Columns.Add("EXPIRYDATE", typeof(DateTime));
                member.Columns.Add("ADDRESS1", typeof(string));
                member.Columns.Add("OCCUPATION", typeof(string));
                member.Columns.Add("NATIONALITY", typeof(string));
                member.Columns.Add("PASSPORT", typeof(string));
                member.Columns.Add("DOB", typeof(DateTime));
                member.Columns.Add("SEX", typeof(char));
                member.Columns.Add("ITEMSERIALNO", typeof(int));
                member.Columns.Add("MAINCLASS", typeof(string));
                member.Columns.Add("SUBCLASS", typeof(string));
                member.Columns.Add("DATEOFSUBMISSION", typeof(DateTime));
                member.Columns.Add("COMMENCEDATE", typeof(DateTime));
                member.Columns.Add("IDENTITYNO", typeof(string));
                member.Columns.Add("OCCUPATIONOTHER", typeof(string));
                member.Columns.Add("CREATEDBY", typeof(int));
                member.Columns.Add("CREATEDDATE", typeof(string));

                foreach (var members in policyDetails.DomesticHelpMemberList)
                {
                    member.Rows.Add(policy.DomesticHelp.InsuredCode, members.Name, 0, 0, null,
                                    members.AddressType, members.Occupation, members.Nationality, members.Passport, members.DOB,
                                    members.Sex, members.ItemserialNo, "", "", null, policy.DomesticHelp.PolicyStartDate, members.CPRNumber, "",
                                    policy.DomesticHelp.CreatedBy, null);
                }
            }
            return(member);
        }