private void btnSaveClientAutoInfo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtClientAutoInsuranceCompany.Text) &&
                       string.IsNullOrEmpty(txtClientAutoAddress.Text) &&
                       string.IsNullOrEmpty(txtClientAutoCity.Text) &&
                       string.IsNullOrEmpty(txtClientAutoState.Text) &&
                       string.IsNullOrEmpty(txtClientAutoZip.Text) &&
                       string.IsNullOrEmpty(txtClientAutoPhoneNumber.Text) &&
                       string.IsNullOrEmpty(txtPolicyNumber.Text) &&
                       dtEffectiveStartDate.SelectedDate == null &&
                       dtEffectiveEndtDate.SelectedDate == null &&
                       string.IsNullOrEmpty(txtMedPayAvailable.Text) &&
                       string.IsNullOrEmpty(txtAmount.Text) &&
                       string.IsNullOrEmpty(txtLiabilityMinimumCoverage.Text) &&
                       string.IsNullOrEmpty(txtLiabilityMaximumCoverage.Text) &&
                       string.IsNullOrEmpty(txtUMIMinimum.Text) &&
                       string.IsNullOrEmpty(txtUMIMaximum.Text) &&
                       string.IsNullOrEmpty(txtReimbursable.Text) &&
                       string.IsNullOrEmpty(txtClientAutoInfoNotes.Text))
                {
                    return;
                }

                ClientAutoInformation autoInfo = new ClientAutoInformation();
                autoInfo.InsuranceCompany = txtClientAutoInsuranceCompany.Text;
                autoInfo.Address = txtClientAutoAddress.Text;
                autoInfo.City = txtClientAutoCity.Text;
                autoInfo.State = txtClientAutoState.Text;
                autoInfo.Zip = txtClientAutoZip.Text;
                autoInfo.PhoneNumber = txtClientAutoPhoneNumber.Text;
                autoInfo.Adjuster = txtClientAutoAdjuster.Text;
                autoInfo.PolicyNumber = txtPolicyNumber.Text;
                if (dtEffectiveStartDate.SelectedDate != null)
                {
                    autoInfo.EffectiveStartDate = DateTime.Parse(dtEffectiveStartDate.SelectedDate.Value.ToShortDateString());
                }
                if (dtEffectiveEndtDate.SelectedDate != null)
                {
                    autoInfo.EffectiveEndDate = DateTime.Parse(dtEffectiveEndtDate.SelectedDate.Value.ToShortDateString());
                }
                autoInfo.MedPayAvailable = txtMedPayAvailable.Text;
                autoInfo.Amout = txtAmount.Text;
                autoInfo.LiabilityMinimumCoverage = txtLiabilityMinimumCoverage.Text;
                autoInfo.LiabilityMaximumCoverage = txtLiabilityMaximumCoverage.Text;
                autoInfo.UMIMinimum = txtUMIMinimum.Text;
                autoInfo.UMIMaximum = txtUMIMaximum.Text;
                autoInfo.Reimbursable = txtReimbursable.Text;
                autoInfo.Notes = txtClientAutoInfoNotes.Text;

                BusinessLogic.UpdateClientAutoInformation(autoInfo, txtFileNo.Text);

                Helper.ShowInformationMessageBox("Client Auto Information Saved.");
                btnCancelClientAutoInfo.IsEnabled = false;
                btnSaveClientAutoInfo.IsEnabled = false;
                btnEditClientAutoInfo.IsEnabled = true;
                UpdateStatusClientAutoInfo(true);

            }
            catch (Exception ex)
            {
                Helper.LogException(ex);
            }
        }
Exemple #2
0
 internal static void UpdateClientAutoInformation(ClientAutoInformation autoInfo, string fileID)
 {
     string query = string.Format(Constants.EXISTS_CLIENT_AUTO_DETAILS_QUERY, fileID);
     object isPresent = DBHelper.GetScalarValue(query);
     int result = 0;
     if (isPresent == null)
     {
         query = string.Format(Constants.INSERT_CLIENT_AUTO_DETAILS_QUERY, fileID, autoInfo.InsuranceCompany, autoInfo.Address, autoInfo.City, autoInfo.State, autoInfo.Zip, autoInfo.PhoneNumber, autoInfo.Adjuster);
         result = DBHelper.ExecuteNonQuery(query);
     }
     else
     {
         query = string.Format(Constants.UPDATE_CLIENT_AUTO_DETAILS_QUERY, fileID, autoInfo.InsuranceCompany, autoInfo.Address, autoInfo.City, autoInfo.State, autoInfo.Zip, autoInfo.PhoneNumber, autoInfo.Adjuster);
         result = DBHelper.ExecuteNonQuery(query);
     }
     query = string.Format(Constants.EXISTS_CLIENT_POLICY_DETAILS_QUERY, fileID);
     isPresent = DBHelper.GetScalarValue(query);
     if (isPresent == null)
     {
         query = string.Format(Constants.INSERT_CLIENT_POLICY_DETAILS_QUERY, fileID, autoInfo.PolicyNumber, autoInfo.EffectiveStartDate.ToString(), GetNonNullIntValue(autoInfo.Amout), autoInfo.EffectiveEndDate.ToString(), GetNonNullIntValue(autoInfo.LiabilityMinimumCoverage), GetNonNullIntValue(autoInfo.LiabilityMaximumCoverage), GetNonNullIntValue(autoInfo.UMIMinimum), GetNonNullIntValue(autoInfo.UMIMaximum), autoInfo.Notes, autoInfo.MedPayAvailable, autoInfo.Reimbursable);
         result = DBHelper.ExecuteNonQuery(query);
     }
     {
         query = string.Format(Constants.UPDATE_CLIENT_POLICY_DETAILS_QUERY, fileID, autoInfo.PolicyNumber, autoInfo.EffectiveStartDate.ToString(), GetNonNullIntValue(autoInfo.Amout), autoInfo.EffectiveEndDate.ToString(), GetNonNullIntValue(autoInfo.LiabilityMinimumCoverage), GetNonNullIntValue(autoInfo.LiabilityMaximumCoverage), GetNonNullIntValue(autoInfo.UMIMinimum), GetNonNullIntValue(autoInfo.UMIMaximum), autoInfo.Notes, autoInfo.MedPayAvailable, autoInfo.Reimbursable);
         result = DBHelper.ExecuteNonQuery(query);
     }
 }
        private void SaveClientAutoInformation()
        {
            try
            {
                if (string.IsNullOrEmpty(txtClientAutoInsuranceCompany.Text) &&
                    string.IsNullOrEmpty(txtClientAutoAddress.Text) &&
                    string.IsNullOrEmpty(txtClientAutoCity.Text) &&
                    string.IsNullOrEmpty(txtClientAutoState.Text) &&
                    string.IsNullOrEmpty(txtClientAutoZip.Text) &&
                    string.IsNullOrEmpty(txtClientAutoPhoneNumber.Text) &&
                    string.IsNullOrEmpty(txtPolicyNumber.Text) &&
                    dtEffectiveStartDate.SelectedDate == null &&
                    dtEffectiveEndtDate.SelectedDate == null &&
                    string.IsNullOrEmpty(txtMedPayAvailable.Text) &&
                    string.IsNullOrEmpty(txtAmount.Text) &&
                    string.IsNullOrEmpty(txtLiabilityMinimumCoverage.Text) &&
                    string.IsNullOrEmpty(txtLiabilityMaximumCoverage.Text) &&
                    string.IsNullOrEmpty(txtUMIMinimum.Text) &&
                    string.IsNullOrEmpty(txtUMIMaximum.Text) &&
                    string.IsNullOrEmpty(txtReimbursable.Text) &&
                    string.IsNullOrEmpty(txtClientAutoInfoNotes.Text))
                {
                    return;
                }

                ClientAutoInformation autoInfo = new ClientAutoInformation();
                autoInfo.InsuranceCompany = txtClientAutoInsuranceCompany.Text;
                autoInfo.Address = txtClientAutoAddress.Text;
                autoInfo.City = txtClientAutoCity.Text;
                autoInfo.State = txtClientAutoState.Text;
                autoInfo.Zip = txtClientAutoZip.Text;
                autoInfo.PhoneNumber = txtClientAutoPhoneNumber.Text;
                autoInfo.Adjuster = txtClientAutoAdjuster.Text;
                autoInfo.PolicyNumber = txtPolicyNumber.Text;
                autoInfo.EffectiveStartDate = DateTime.Parse(dtEffectiveStartDate.SelectedDate.Value.ToShortDateString());
                autoInfo.EffectiveEndDate = DateTime.Parse(dtEffectiveEndtDate.SelectedDate.Value.ToShortDateString());
                autoInfo.MedPayAvailable = txtMedPayAvailable.Text;
                autoInfo.Amout = txtAmount.Text;
                autoInfo.LiabilityMinimumCoverage = txtLiabilityMinimumCoverage.Text;
                autoInfo.LiabilityMaximumCoverage = txtLiabilityMaximumCoverage.Text;
                autoInfo.UMIMinimum = txtUMIMinimum.Text;
                autoInfo.UMIMaximum = txtUMIMaximum.Text;
                autoInfo.Reimbursable = txtReimbursable.Text;
                autoInfo.Notes = txtClientAutoInfoNotes.Text;

                BusinessLogic.SaveClientAutoInformation(autoInfo, txtFileNo.Text);
            }
            catch (Exception ex)
            {
                Helper.LogException(ex);
            }
        }