public bool registerNewIndividualPaymentRequest(InsuranceCase insuranceCase, int individualClientId)
        {
            InsurerDAO insurerDAO = new InsurerDAO();
            bool       result     = insurerDAO.registerNewIndividualPaymentRequest(insuranceCase, individualClientId);

            return(result);
        }
        private void submitPaymentRequest_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(policeNumberInput.Text) || insuranseCaseInput.SelectedItem == null)
            {
                label1.Text = "Проверьте заполнение всех полей.";
            }
            else
            {
                InsuranceCase insuranceCase            = (InsuranceCase)insuranseCaseInput.SelectedItem;
                int           legalClientId            = Int32.Parse(policeNumberInput.Text);
                RegisterNewLegalPaymentRequest command = new RegisterNewLegalPaymentRequest();
                bool result = command.registerNewLegalPaymentRequest(insuranceCase, legalClientId);
                if (result == true)
                {
                    policeNumberInput.Clear();
                    insuranseCaseInput.ResetText();

                    label1.Text = "Обращение за выплатой успешно зарегистрировано.";
                }
                if (result == false)
                {
                    label1.Text = "Не удалось зарегистрировать обращение.";
                }
            }
        }
        private void submit_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(insuranceCaseNameInput.Text) || paymentProcentInput.Value == 0 || insurancePoliceDropDown.SelectedItem == null)
            {
                resultLabel.Text = "Проверьте заполнение всех полей.";
            }
            else
            {
                InsuranceCase insuranceCase = new InsuranceCase();
                insuranceCase.InsuranceCaseName = insuranceCaseNameInput.Text;
                insuranceCase.PaymentProcent    = paymentProcentInput.Value;


                InsuranceCategory category = (InsuranceCategory)insurancePoliceDropDown.SelectedItem;
                insuranceCase.InsuranceCategory = category;



                RegisterNewInsuranceCaseCommand command = new RegisterNewInsuranceCaseCommand();
                bool result = command.registerNewInsuranceCase(insuranceCase);

                if (result == true)
                {
                    insuranceCaseNameInput.Clear();
                    insurancePoliceDropDown.ResetText();
                    paymentProcentInput.ResetText();
                    resultLabel.Text = "Новый страховой случай успешно зарегистрирован.";
                }
                if (result == false)
                {
                    resultLabel.Text = "Не удалось зарегистрировать новый страховой случай.";
                }
            }
        }
Example #4
0
        public bool registerNewLegalPaymentRequest(InsuranceCase insuranceCase, int legalClientId)
        {
            bool       result     = true;
            InsurerDAO insurerDAO = new InsurerDAO();

            result = insurerDAO.registerNewLegalPaymentRequest(insuranceCase, legalClientId);
            return(result);
        }
        public static bool validateNewInsuranceCaseInfo(InsuranceCase insuranceCase)
        {
            bool result = true;

            if (String.IsNullOrEmpty(insuranceCase.InsuranceCaseName))
            {
                result = false;
            }
            if (insuranceCase.PaymentProcent == 0)
            {
                result = false;
            }
            return(result);
        }
        public bool registerNewInsuranceCase(InsuranceCase insuranceCase)
        {
            bool result = true;

            if (!Validator.validateNewInsuranceCaseInfo(insuranceCase))
            {
                throw new ArgumentException();
            }

            InsurerDAO insurerDAO = new InsurerDAO();

            result = insurerDAO.registerNewInsuranceCase(insuranceCase);

            return(result);
        }