private void BtnSubmit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Login login = new Login();
         login.CustomerNumber = cmbCustomerNumber.Text;
         login.LoginID        = txtLogin.Text;
         login.Password       = txtPassword.Text;
         bool res = PolicyBL.LoginGenBL(login);
         MessageBox.Show("Login Credentials Generated");
         BtnClear_Click(sender, e);
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (PolicyException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            DataTable customerDetails = PolicyBL.GetAllTransactionIDBL(txtcustNum.Text);
            DataTable dt = customerDetails;

            dgTransac.ItemsSource = dt.DefaultView;
        }
 private void BtnSearch_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DataTable search = PolicyBL.SearchPolicyIDBL(txtpolicyID.Text);
         DataTable dt     = search;
         if (dt == null)
         {
             MessageBox.Show($"No Records found for {txtpolicyID.Text}");
         }
         else if (dt.Rows.Count == 0)
         {
             MessageBox.Show($"No Records found for {txtpolicyID.Text}");
         }
         else
         {
             dgPolicy.ItemsSource = dt.DefaultView;
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (PolicyException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataTable customerDetails = PolicyBL.GetAllCustomerBL();
            DataTable dt = customerDetails;

            dgCustomer.ItemsSource = dt.DefaultView;
        }
Exemple #5
0
 private void BtnSubmit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Product product = new Product();
         product.ProductName    = txtProductName.Text;
         product.ProductType    = cmbProductType.Text;
         product.CustomerNumber = cmbCustomerNo.Text;
         bool res = PolicyBL.AddProductBL(product);
         MessageBox.Show("Product Details have been added successfully");
         Clear_Click(sender, e);
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (PolicyException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void BtnSubmit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Login  login       = new Login();
         string confirmPass = string.Empty;
         login.CustomerNumber = cmbCustomerNumber.Text;
         login.LoginID        = txtLogin.Text;
         login.Password       = txtPassword.Password;
         confirmPass          = txtConfirmPass.Password;
         if (login.Password == confirmPass)
         {
             bool res = PolicyBL.LoginGenBL(login);
             MessageBox.Show("Login Credentials Generated");
             BtnClear_Click(sender, e);
             this.Close();
         }
         else
         {
             MessageBox.Show("Invalid Credentials");
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (PolicyException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #7
0
        public CustomerDetails()
        {
            InitializeComponent();
            DataTable customerDetails = PolicyBL.GetAllCustomerBL();
            DataTable dt = customerDetails;

            dgCustomer.ItemsSource = dt.DefaultView;
        }
        public void CheckPolicyTypeC()
        {
            PolicyBL policyBL = new PolicyBL();
            Policy   policy   = new Policy();

            policy.PolicyNumber = "C1200";
            Assert.AreEqual(policyBL.GetManagementFeePercentage(policy), 7);
        }
        public TransactionDetails()
        {
            InitializeComponent();
            DataTable customerDetails = PolicyBL.GetAllTransactionBL();
            DataTable dt = customerDetails;

            dgTrans.ItemsSource = dt.DefaultView;
        }
Exemple #10
0
        private void BtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            Customer customer = new Customer();

            customer.Gender = "X";
            customer.Smoker = "X";
            if (dpDob.Text == "")
            {
                MessageBox.Show("Please add the correct format of the date");
            }
            else
            {
                try
                {
                    customer.CustomerName = txtCustomerName.Text;
                    customer.Address      = txtAddress.Text;
                    customer.Telephone    = txtTelephone.Text;
                    if (rdGenderM.IsChecked == true)
                    {
                        customer.Gender = "M";
                    }
                    else if (rdGenderF.IsChecked == true)
                    {
                        customer.Gender = "F";
                    }
                    if (rdSmokerN.IsChecked == true)
                    {
                        customer.Smoker = "N";
                    }
                    else if (rdSmokerY.IsChecked == true)
                    {
                        customer.Smoker = "Y";
                    }


                    customer.Hobbies = txtHobbies.Text;
                    customer.Dob     = Convert.ToDateTime(dpDob.Text);
                    bool res = PolicyBL.AddCustomerBL(customer);
                    MessageBox.Show("Customer Details have been added successfully");
                    BtnClear_Click(sender, e);
                    LoginGen obj = new LoginGen();
                    obj.Show();
                }
                catch (SqlException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                catch (PolicyException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
        public void CheckComputeMaturity()
        {
            PolicyBL      policyBL = new PolicyBL();
            List <Policy> policies = new List <Policy>()
            {
                new Policy()
                {
                    PolicyNumber = "A1200", StartDate = DateTime.Parse("01/06/1986"), Premium = 1000, Membership = true, DiscretionaryBonus = 1000, UpliftPercentage = 40
                }
            };

            policyBL.ComputeMaturity(policies);
            Assert.AreNotEqual(policies[0].Maturity, decimal.MinValue);
        }
 public void ShowEndorsement()
 {
     string custnum = txtCnum.Text;
     DataTable dt = new DataTable();
     dt = PolicyBL.GetAllEndorsementCustBL(custnum);
     if (dt == null || dt.Rows.Count == 0)
     {
         MessageBox.Show($"No Endorsement Records generated for {custnum}");
     }
     else
     {
         dgendorsement.ItemsSource = dt.DefaultView;
     }
 }
Exemple #13
0
        public EndorsementPageAdmin()
        {
            InitializeComponent();
            DataTable endorsementDetails = PolicyBL.GetAllEndorsementBL();
            DataTable dt = endorsementDetails;

            if (dt == null || dt.Rows.Count == 0)
            {
                MessageBox.Show($"No Endorsement Records");
            }
            else
            {
                dgendorsement.ItemsSource = dt.DefaultView;
            }
        }
Exemple #14
0
        private void BtnReject_Click(object sender, RoutedEventArgs e)
        {
            txtStatus.Background = new SolidColorBrush(Colors.Red);
            txtStatus.Text       = "Rejected";
            EndorsementStatus endorsementstatus = new EndorsementStatus();
            int id = Convert.ToInt32(txtTransactionID.Text);

            endorsementstatus.CurrentStatus = txtStatus.Text;
            PolicyBL policyBL = new PolicyBL();
            bool     result   = policyBL.UpdateEndorsementStatusBL(id, txtStatus.Text);

            if (result != false)
            {
                DeleteEndorsement();
            }
        }
        private void BtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Policy policy = new Policy();
                policy.CustomerNumber = cmbCustomerNumber.Text;
                policy.ProductID      = cmbProductID.Text;
                policy.InsuredName    = txtInsuredName.Text;
                policy.InsuredAge     = Convert.ToInt32(txtInsuredAge.Text);
                policy.Nominee        = txtNominee.Text;
                policy.Relation       = txtRelation.Text;
                if (rdAnnu.IsChecked == true)
                {
                    policy.PremiumFrequency = "Annually";
                }
                else if (rdHalfY.IsChecked == true)
                {
                    policy.PremiumFrequency = "Half Yearly";
                }
                else if (rdMon.IsChecked == true)
                {
                    policy.PremiumFrequency = "Monthly";
                }
                else if (rdQuat.IsChecked == true)
                {
                    policy.PremiumFrequency = "Quaterly";
                }

                bool res = PolicyBL.AddPolicyBL(policy);
                MessageBox.Show("Policy Details have been added successfully");
                BtnClear_Click(sender, e);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (PolicyException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #16
0
        public void ShowOrigData()
        {
            DataTable dt = PolicyBL.SearchPolicyIDBL(txtPolicyID.Text);

            foreach (DataRow row in dt.Rows)
            {
                txtInsuredNameOrig.Text = row["InsuredName"].ToString();
                txtInsuredAgeOrig.Text  = row["InsuredAge"].ToString();
                txtDobOrig.Text         = row["Dob"].ToString();
                txtGenderOrig.Text      = row["Gender"].ToString();
                txtNomineeOrig.Text     = row["Nominee"].ToString();
                txtRelationOrig.Text    = row["Relation"].ToString();
                txtSmokerOrig.Text      = row["Smoker"].ToString();
                txtAddresOrig.Text      = row["Address"].ToString();
                txtTeleOrig.Text        = row["Telephone"].ToString();
                txtPrFreqOrig.Text      = row["PremiumFrequency"].ToString();
            }
        }
Exemple #17
0
        public void DeleteEndorsement()
        {
            Transaction transaction = new Transaction();

            transaction.PolicyID         = txtPolicyID.Text;
            transaction.TransactionID    = Convert.ToInt32(txtTransactionID.Text);
            transaction.InsuredName      = txtInsuredName.Text;
            transaction.InsuredAge       = Convert.ToInt32(txtInsuredAge.Text);
            transaction.Dob              = Convert.ToDateTime(txtDob.Text);
            transaction.Gender           = Convert.ToChar(txtGender.Text);
            transaction.Nominee          = txtNominee.Text;
            transaction.Relation         = txtRelation.Text;
            transaction.Smoker           = txtSmoker.Text;
            transaction.Address          = txtAddress.Text;
            transaction.Telephone        = txtTelephone.Text;
            transaction.PremiumFrequency = txtPreFreq.Text;
            transaction.CurrentStatus    = txtStatus.Text;
            PolicyBL policyBL = new PolicyBL();
            bool     res      = policyBL.AddTransactionBL(transaction);
        }
Exemple #18
0
        public void ShowEndorsementData()
        {
            PolicyBL  searchpolicy = new PolicyBL();
            DataTable dt           = searchpolicy.GetAllEndorsementPolicyIDBL(txtPolicyID.Text);

            foreach (DataRow row in dt.Rows)
            {
                txtInsuredName.Text = row["InsuredName"].ToString();
                txtInsuredAge.Text  = row["InsuredAge"].ToString();
                txtDob.Text         = row["Dob"].ToString();
                txtGender.Text      = row["Gender"].ToString();
                txtNominee.Text     = row["Nominee"].ToString();
                txtRelation.Text    = row["Relation"].ToString();
                txtSmoker.Text      = row["Smoker"].ToString();
                txtAddress.Text     = row["Address"].ToString();
                txtTelephone.Text   = row["Telephone"].ToString();
                txtPreFreq.Text     = row["PremiumFrequency"].ToString();
                txtStatus.Text      = row["CurrentStatus"].ToString();
            }
        }
 private void BtnSearch2_Click(object sender, RoutedEventArgs e)
 {
     if (txtName.Text == string.Empty || txtDob.Text == string.Empty)
     {
         MessageBox.Show("Please enter both the fields");
     }
     else
     {
         DateTime dofb = Convert.ToDateTime(txtDob.Text);
         try
         {
             DataTable dt = PolicyBL.SearchPolicyNameBL(txtName.Text, dofb);
             if (dt == null)
             {
                 MessageBox.Show($"No Records found for {txtName.Text}");
             }
             else if (dt.Rows.Count == 0)
             {
                 MessageBox.Show($"No Records found for {txtName.Text}");
             }
             else
             {
                 dgPolicyName.ItemsSource = dt.DefaultView;
             }
         }
         catch (SqlException ex)
         {
             MessageBox.Show(ex.Message);
         }
         catch (PolicyException ex)
         {
             MessageBox.Show(ex.Message);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Exemple #20
0
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            string   username = txtUsername.Text;
            string   password = txtPassword.Password;
            PolicyBL policyBL = new PolicyBL();
            int      res      = policyBL.LoginCheckBL(username, password);

            if (res == 1)
            {
                string    id = string.Empty, custnum = string.Empty;
                DataTable dt = new DataTable();
                dt = PolicyBL.LoginDeatilsBL(txtUsername.Text, txtPassword.Password);
                foreach (DataRow row in dt.Rows)
                {
                    id = row["LoginID"].ToString();
                }
                if (id.Equals("Administrator"))
                {
                    AdminHomepage obj = new AdminHomepage();
                    obj.Show();
                }
                else
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        custnum = row["CustomerNumber"].ToString();
                    }
                    txtCustomerNumber.Text = custnum;
                    CustomerHomepage obj1 = new CustomerHomepage();
                    obj1.txtCustNum.Text = custnum;
                    obj1.Show();
                }
            }
            else
            {
                MessageBox.Show("Login Failed. Please Check LoginID and Password");
            }
        }
Exemple #21
0
        /// <summary>
        /// Action does the Policy maturity calculation for input data received by CSV
        /// </summary>
        /// <returns>Confirmation Message</returns>
        public ActionResult Assessment()
        {
            try
            {
                string   inputFile     = Server.MapPath(ConstantVariables.inputFilePath);
                string   outputXMLFile = Server.MapPath(ConstantVariables.outputXMLFilePath);
                PolicyBL policyBL      = new PolicyBL();

                //Read input CSV and get the equivalent policy list
                List <Policy> policies = policyBL.PopulatePolicyFromCSV(inputFile);
                if (policies != null)
                {
                    //Compute Maturity for policy list based on business logic
                    policyBL.ComputeMaturity(policies);
                    //Write a xml file for computed maturity policy list
                    new XMLWriter().WriteXML(policies, outputXMLFile);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Exception on Home controller Assessment action", ex);
            }
            return(View());
        }
        public void SearchPolicy(string policyID)
        {
            DataTable dt = PolicyBL.SearchPolicyIDBL(policyID);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    txtproductType.Text = row["ProductType"].ToString();
                    txtproductName.Text = row["ProductName"].ToString();
                    txtinsuredName.Text = row["InsuredName"].ToString();
                    txtinsuredAge.Text  = row["InsuredAge"].ToString();
                    txtdob.Text         = row["Dob"].ToString();
                    txtnominee.Text     = row["Nominee"].ToString();
                    txtRelation.Text    = row["Relation"].ToString();
                    txtAddress.Text     = row["Address"].ToString();
                    txtTelephone.Text   = row["Telephone"].ToString();
                    string gender = row["Gender"].ToString();
                    if (gender != string.Empty)
                    {
                        if (gender.Equals("M"))
                        {
                            rdMale.IsChecked = true;
                        }
                        else if (gender.Equals("F"))
                        {
                            rdFemale.IsChecked = true;
                        }
                        else if (gender.Equals("O"))
                        {
                            rdOthers.IsChecked = true;
                        }
                    }
                    string premium = row["PremiumFrequency"].ToString();
                    if (premium != string.Empty)
                    {
                        if (premium.Equals("Monthly"))
                        {
                            rdMonth.IsChecked = true;
                        }
                        else if (premium.Equals("Half Yearly"))
                        {
                            rdHalf.IsChecked = true;
                        }
                        else if (premium.Equals("Quaterly"))
                        {
                            rdQuater.IsChecked = true;
                        }
                        else if (premium.Equals("Annually"))
                        {
                            rdAnnual.IsChecked = true;
                        }
                    }
                    string smoker = row["Smoker"].ToString();
                    if (smoker != string.Empty)
                    {
                        if (smoker.Equals("Y"))
                        {
                            rdYes.IsChecked = true;
                        }
                        else if (smoker.Equals("N"))
                        {
                            rdNo.IsChecked = true;
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("No Records to display");
            }
        }
        private void BtnUpdat_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Endorsement endorsement = new Endorsement();
                endorsement.PolicyID    = txtPolicyID.Text;
                endorsement.ProductType = txtproductType.Text;
                endorsement.ProductName = txtproductName.Text;
                endorsement.InsuredName = txtinsuredName.Text;
                endorsement.InsuredAge  = Convert.ToInt32(txtinsuredAge.Text);
                endorsement.Dob         = Convert.ToDateTime(dpDob.Text);
                if (rdMale.IsChecked == true)
                {
                    endorsement.Gender = "M";
                }
                else if (rdFemale.IsChecked == true)
                {
                    endorsement.Gender = "F";
                }
                else
                {
                    endorsement.Gender = "O";
                }
                endorsement.Nominee   = txtnominee.Text;
                endorsement.Relation  = txtRelation.Text;
                endorsement.Smoker    = rdYes.IsChecked == true ? "Y" : "N";
                endorsement.Address   = txtAddress.Text;
                endorsement.Telephone = txtTelephone.Text;
                if (rdAnnual.IsChecked == true)
                {
                    endorsement.PremiumFrequency = "Annually";
                }
                else if (rdHalf.IsChecked == true)
                {
                    endorsement.PremiumFrequency = "Half Yearly";
                }
                else if (rdMonth.IsChecked == true)
                {
                    endorsement.PremiumFrequency = "Monthly";
                }
                else if (rdQuater.IsChecked == true)
                {
                    endorsement.PremiumFrequency = "Quaterly";
                }
                PolicyBL policyBL = new PolicyBL();
                bool     res      = policyBL.AddEndorsementBL(endorsement);
                if (res != false)
                {
                    int           tid    = 0;
                    string        strcon = ConfigurationManager.ConnectionStrings["sqlpracticeConn"].ConnectionString;
                    SqlConnection connection;
                    SqlCommand    cmdGetID, cmdInsert;
                    connection = new SqlConnection(strcon);
                    connection.Open();
                    cmdGetID             = new SqlCommand("prctransactionID", connection);
                    cmdGetID.CommandType = CommandType.StoredProcedure;
                    cmdGetID.Parameters.AddWithValue("@policyID", txtPolicyID.Text);
                    SqlDataReader dr = cmdGetID.ExecuteReader();
                    while (dr.Read())
                    {
                        tid = dr.GetInt32(0);
                        MessageBox.Show("TransactionID: " + tid + " Generated for Update request. \n Administrator will approve or reject the request");
                    }
                    connection.Close();
                    connection = new SqlConnection(strcon);
                    connection.Open();
                    cmdInsert             = new SqlCommand("prcStatusupdate", connection);
                    cmdInsert.CommandType = CommandType.StoredProcedure;
                    cmdInsert.Parameters.AddWithValue("@transactionID", tid);
                    cmdInsert.ExecuteNonQuery();
                }
            }

            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (PolicyException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #24
0
        private void BtnAccept_Click(object sender, RoutedEventArgs e)
        {
            txtStatus.Background = new SolidColorBrush(Colors.Green);
            txtStatus.Text       = "Accepted";
            try
            {
                Endorsement endorsement = new Endorsement();
                endorsement.PolicyID         = txtPolicyID.Text;
                endorsement.InsuredName      = txtInsuredName.Text;
                endorsement.InsuredAge       = Convert.ToInt32(txtInsuredAge.Text);
                endorsement.Dob              = Convert.ToDateTime(txtDob.Text);
                endorsement.Gender           = txtGender.Text;
                endorsement.Nominee          = txtNominee.Text;
                endorsement.Relation         = txtRelation.Text;
                endorsement.Smoker           = txtSmoker.Text;
                endorsement.Address          = txtAddress.Text;
                endorsement.Telephone        = txtTelephone.Text;
                endorsement.PremiumFrequency = txtPreFreq.Text;
                PolicyBL policyBL = new PolicyBL();
                bool     res      = policyBL.UpdateEndorsementBL(endorsement);
                int      id       = Convert.ToInt32(txtTransactionID.Text);
                bool     result   = policyBL.UpdateEndorsementStatusBL(id, txtStatus.Text);

                if (res != false && result != false)
                {
                    Policys policy = new Policys();
                    policy.PolicyID         = txtPolicyID.Text;
                    policy.InsuredName      = txtInsuredName.Text;
                    policy.InsuredAge       = Convert.ToInt32(txtInsuredAge.Text);
                    policy.Nominee          = txtNominee.Text;
                    policy.Relation         = txtRelation.Text;
                    policy.PremiumFrequency = txtPreFreq.Text;
                    PolicyBL policyup = new PolicyBL();
                    bool     resut    = policyup.UpdatePolicyBL(policy);

                    Customer customer = new Customer();
                    customer.CustomerNumber = txtCustnum.Text;
                    customer.Dob            = Convert.ToDateTime(txtDob.Text);
                    customer.Gender         = txtGender.Text;
                    customer.Smoker         = txtSmoker.Text;
                    customer.Address        = txtAddress.Text;
                    customer.Telephone      = txtTelephone.Text;
                    PolicyBL policydate = new PolicyBL();
                    bool     resul      = policydate.UpdateCustomersBL(customer);

                    if (resut != false && resul != false)
                    {
                        DeleteEndorsement();
                    }
                }
            }

            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (PolicyException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #25
0
        public void CustIDGen()
        {
            string result = PolicyBL.CustIDGenBL(txtPolicyID.Text);

            txtCustnum.Text = result;
        }
        public void Process()
        {
            var policy = new PolicyBL();
            List <SYSFLEX_POLICY> policyList = policy.GetPolicy();
            string company       = ConfigKey.ReadSetting("Company");
            string integrationid = ConfigKey.ReadSetting("INTEGRATIONID");

            eConnectIntegration.CLASS.Response response;

            try
            {
                foreach (SYSFLEX_POLICY pol in policyList)
                {
                    log.WriteLog(0, "Inicia sincronización de Poliza: " + pol.POLICY_NUMBER.Trim());
                    var custAdd        = policy.SetCustomerAdditional(pol);
                    var syscustomer    = policy.GetPolicyParent(Convert.ToInt32(pol.CLIENT_ID));
                    var customerexists = policy.CheckCustomerExists(pol.POLICY_NUMBER, syscustomer.CUSTNMBR.ToString());
                    try
                    {
                        var custclass   = policy.GetCustomerClass(pol.LINE_OF_BUSINESS.Trim(), pol.POLICY_TYPE, pol.VEHICLE_TYPE, pol.ZONE, syscustomer.COUNTRY.Trim(), pol.CHANNEL, pol.SUPERVISOR, pol.GpProductID);
                        var classexists = policy.CheckCustomerClassExists(custclass);
                        if (!classexists)
                        {
                            response = policy.CreateCustomerClass(pol.LINE_OF_BUSINESS.Trim(),
                                                                  pol.POLICY_TYPE.Trim(),
                                                                  pol.VEHICLE_TYPE.Trim(),
                                                                  pol.ZONE.Trim(),
                                                                  syscustomer.COUNTRY.Trim(),
                                                                  pol.CHANNEL.Trim(),
                                                                  pol.SUPERVISOR.Trim(),
                                                                  pol.SUPERVISOR_CODE.GetValueOrDefault(), custclass, pol.GpProductID);

                            if (response.SUCCESS)
                            {
                                log.WriteLog(0, "Clase creada: " + custclass);
                            }
                            else
                            {
                                log.WriteLog(2, "Ocurrio un error al crear la clase: " + custclass + ". " + response.MESSAGE);
                            }
                        }
                        var gpcustomer = new RMClass.RMCustomer();

                        if (string.IsNullOrEmpty(syscustomer.CUSTNAME))
                        {
                            syscustomer.CUSTNAME = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.SHRTNAME))
                        {
                            syscustomer.SHRTNAME = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.STMTNAME))
                        {
                            syscustomer.STMTNAME = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.CNTCPRSN))
                        {
                            syscustomer.CNTCPRSN = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.ADDRESS1))
                        {
                            syscustomer.ADDRESS1 = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.CITY))
                        {
                            syscustomer.CITY = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.COUNTRY))
                        {
                            syscustomer.COUNTRY = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.PHNUMBR1))
                        {
                            syscustomer.PHNUMBR1 = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.PHNUMBR2))
                        {
                            syscustomer.PHNUMBR2 = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.PHNUMBR3))
                        {
                            syscustomer.PHNUMBR3 = "";
                        }

                        if (string.IsNullOrEmpty(syscustomer.fax))
                        {
                            syscustomer.fax = "";
                        }

                        gpcustomer.CUSTNMBR         = pol.POLICY_NUMBER;
                        gpcustomer.CUSTNAME         = syscustomer.CUSTNAME.Trim() + " " + syscustomer.SHRTNAME.Trim() + " " + syscustomer.STMTNAME.Trim();
                        gpcustomer.SHRTNAME         = syscustomer.CUSTNAME.Trim() + " " + syscustomer.STMTNAME;
                        gpcustomer.STMTNAME         = syscustomer.CUSTNAME.Trim() + " " + syscustomer.STMTNAME;
                        gpcustomer.CUSTCLASS        = custclass;
                        gpcustomer.CNTCPRSN         = syscustomer.CNTCPRSN;
                        gpcustomer.ADRSCODE         = "PRIMARY        ";
                        gpcustomer.ADDRESS1         = syscustomer.ADDRESS1;
                        gpcustomer.ADDRESS2         = syscustomer.ADDRESS2.GetValueOrDefault().ToString();
                        gpcustomer.ADDRESS3         = syscustomer.ADDRESS3.GetValueOrDefault().ToString();
                        gpcustomer.CITY             = syscustomer.CITY;
                        gpcustomer.COUNTRY          = syscustomer.COUNTRY;
                        gpcustomer.PHNUMBR1         = syscustomer.PHNUMBR1;
                        gpcustomer.PHNUMBR2         = syscustomer.PHNUMBR2;
                        gpcustomer.PHNUMBR3         = syscustomer.PHNUMBR3;
                        gpcustomer.FAX              = syscustomer.fax;
                        gpcustomer.INTEGRATIONID    = integrationid;
                        gpcustomer.CreateAddress    = 1;
                        gpcustomer.UpdateIfExists   = 1;
                        gpcustomer.UseCustomerClass = 1;
                        gpcustomer.SLPRSNID         = pol.AGENT_CODE.ToString();

                        var rmchildren = new RMParentIDChild();
                        List <RMParentIDChild> children = new List <RMParentIDChild>();
                        if (!customerexists)
                        {
                            rmchildren.CPRCSTNM = syscustomer.CUSTNMBR.ToString();
                            rmchildren.CUSTNMBR = pol.POLICY_NUMBER.Trim();
                            children.Add(rmchildren);
                        }


                        response = policy.CreateCustomer(gpcustomer, children.ToArray(), company);

                        if (response.SUCCESS)
                        {
                            log.WriteLog(0, "Poliza sincronizada correctamente: " + pol.POLICY_NUMBER.Trim());
                        }
                        else
                        {
                            log.WriteLog(2, "Ocurrió un error al sincronizar la póliza: " + pol.POLICY_NUMBER.Trim() + ". " + response.MESSAGE);
                        }
                        //log.escribirLog(0, "Finaliza la sincronización de Poliza: " + pol.POLICY_NUMBER.Trim());
                    }
                    catch (Exception ex)
                    {
                        log.LogExeption("Error al sincronizar la poliza: " + pol.POLICY_NUMBER.Trim(), 2, ex);
                    }
                }
            }
            catch (Exception ex)
            {
                log.LogExeption("Ocurrió un error: ", 2, ex);
                ///throw;
            }
        }
 public void Setup()
 {
     BL = new PolicyBL();
 }