Esempio n. 1
0
 internal static void UpdateClientDefendantInformation(ClientDefendantInformation defInfo, string fileID)
 {
     string query = string.Format(Constants.EXISTS_CLIENT_DEFENDANT_DETAILS_QUERY, fileID);
     object isPresent = DBHelper.GetScalarValue(query);
     int result = 0;
     if (isPresent == null)
     {
         query = string.Format(Constants.INSERT_CLIENT_DEFENDANT_DETAILS_QUERY, fileID, defInfo.LastName, defInfo.FirstName, defInfo.Address, defInfo.City, defInfo.State,
            defInfo.Zip, defInfo.HomePhone, defInfo.BusinessPhone, defInfo.DateOfBirth, defInfo.DrivingLicense);
         result = DBHelper.ExecuteNonQuery(query);
     }
     else
     {
         query = string.Format(Constants.UPDATE_CLIENT_DEFENDANT_DETAILS_QUERY, fileID, defInfo.LastName, defInfo.FirstName, defInfo.Address, defInfo.City, defInfo.State,
             defInfo.Zip, defInfo.HomePhone, defInfo.BusinessPhone, defInfo.DateOfBirth, defInfo.DrivingLicense);
         result = DBHelper.ExecuteNonQuery(query);
     }
     query = string.Format(Constants.EXISTS_CLIENT_DEFENDANT_ATTORNEY_DETAILS_QUERY, fileID);
     isPresent = DBHelper.GetScalarValue(query);
     if (isPresent == null)
     {
         query = string.Format(Constants.INSERT_CLIENT_DEFENDANT_ATTORNEY_DETAILS_QUERY, fileID, defInfo.AttorneyInfo.Firm, defInfo.AttorneyInfo.Attorney, defInfo.AttorneyInfo.Address,
             defInfo.AttorneyInfo.City, defInfo.AttorneyInfo.State, defInfo.AttorneyInfo.Zip, defInfo.AttorneyInfo.Phone);
         result = DBHelper.ExecuteNonQuery(query);
     }
     else
     {
         query = string.Format(Constants.UPDATE_CLIENT_DEFENDANT_ATTORNEY_DETAILS_QUERY, fileID, defInfo.AttorneyInfo.Firm, defInfo.AttorneyInfo.Attorney, defInfo.AttorneyInfo.Address,
             defInfo.AttorneyInfo.City, defInfo.AttorneyInfo.State, defInfo.AttorneyInfo.Zip, defInfo.AttorneyInfo.Phone);
         result = DBHelper.ExecuteNonQuery(query);
     }
 }
        private void btnSaveDefendantInfo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtDefendantLastName.Text) &&
                        string.IsNullOrEmpty(txtDefendantFirstName.Text) &&
                        string.IsNullOrEmpty(txtDefendantAddress.Text) &&
                        string.IsNullOrEmpty(txtDefendantCity.Text) &&
                        string.IsNullOrEmpty(txtDefendantState.Text) &&
                        string.IsNullOrEmpty(txtDefendantZip.Text) &&
                        string.IsNullOrEmpty(txtDefendantHomePhone.Text) &&
                        string.IsNullOrEmpty(txtDefendantBusinessPhone.Text) &&
                        dtDefendantDateOfBirth.SelectedDate == null &&
                        string.IsNullOrEmpty(txtDefendantDrivingLicense.Text) &&
                        string.IsNullOrEmpty(txtDefendantAttorneyFirm.Text) &&
                        string.IsNullOrEmpty(txtDefendantAttorneyName.Text) &&
                        string.IsNullOrEmpty(txtDefendantAttorneyAddress.Text) &&
                        string.IsNullOrEmpty(txtDefendantAttorneyCity.Text) &&
                        string.IsNullOrEmpty(txtDefendantAttorneyState.Text) &&
                        string.IsNullOrEmpty(txtDefendantAttorneyZip.Text) &&
                        string.IsNullOrEmpty(txtDefendantAttorneyPhone.Text))
                {
                    return;
                }
                ClientDefendantInformation defInfo = new ClientDefendantInformation();
                defInfo.LastName = txtDefendantLastName.Text;
                defInfo.FirstName = txtDefendantFirstName.Text;
                defInfo.Address = txtDefendantAddress.Text;
                defInfo.City = txtDefendantCity.Text;
                defInfo.State = txtDefendantState.Text;
                defInfo.Zip = txtDefendantZip.Text;
                defInfo.HomePhone = txtDefendantHomePhone.Text;
                defInfo.BusinessPhone = txtDefendantBusinessPhone.Text;
                if (dtDefendantDateOfBirth.SelectedDate != null)
                {
                    defInfo.DateOfBirth = DateTime.Parse(dtDefendantDateOfBirth.SelectedDate.Value.ToShortDateString());
                }
                defInfo.DrivingLicense = txtDefendantDrivingLicense.Text;

                defInfo.AttorneyInfo = new DefendantAttorneyInformation();
                defInfo.AttorneyInfo.Firm = txtDefendantAttorneyFirm.Text;
                defInfo.AttorneyInfo.Attorney = txtDefendantAttorneyName.Text;
                defInfo.AttorneyInfo.Address = txtDefendantAttorneyAddress.Text;
                defInfo.AttorneyInfo.City = txtDefendantAttorneyCity.Text;
                defInfo.AttorneyInfo.State = txtDefendantAttorneyState.Text;
                defInfo.AttorneyInfo.Zip = txtDefendantAttorneyZip.Text;
                defInfo.AttorneyInfo.Phone = txtDefendantAttorneyPhone.Text;

                BusinessLogic.UpdateClientDefendantInformation(defInfo, txtFileNo.Text);

                Helper.ShowInformationMessageBox("Client Defendant Information Saved.");
                btnSaveDefendantInfo.IsEnabled = false;
                btnCancelDefendantInfo.IsEnabled = false;
                btnEditDefendantInfo.IsEnabled = true;

                UpdateStatusClientDefendentInfo(true);
                UpdateStatusClientDefendentAttorneyInfo(true);

                dgClientFileList.SelectedIndex = -1;
                dgClientFileList.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                Helper.LogException(ex);
            }
        }
Esempio n. 3
0
        internal static void SaveClientDefendantInformation(ClientDefendantInformation defInfo, string fileID)
        {
            //"INSERT INTO DefendantAttorneyDetails(FileID, Firm, Attorney, Address, City, State, Zip, PhoneNumber) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')";
            string query = string.Format(Constants.INSERT_CLIENT_DEFENDANT_DETAILS_QUERY, fileID, defInfo.LastName, defInfo.FirstName, defInfo.Address, defInfo.City, defInfo.State,
                defInfo.Zip, defInfo.HomePhone, defInfo.BusinessPhone, defInfo.DateOfBirth, defInfo.DrivingLicense);
            int result = DBHelper.ExecuteNonQuery(query);

            query = string.Format(Constants.INSERT_CLIENT_DEFENDANT_ATTORNEY_DETAILS_QUERY, fileID, defInfo.AttorneyInfo.Firm, defInfo.AttorneyInfo.Attorney, defInfo.AttorneyInfo.Address,
                defInfo.AttorneyInfo.City, defInfo.AttorneyInfo.State, defInfo.AttorneyInfo.Zip, defInfo.AttorneyInfo.Phone);
            result = DBHelper.ExecuteNonQuery(query);
        }
        private void SaveDefendantInformation()
        {
            try
            {
                if (string.IsNullOrEmpty(txtDefendantLastName.Text) &&
                    string.IsNullOrEmpty(txtDefendantFirstName.Text) &&
                    string.IsNullOrEmpty(txtDefendantAddress.Text) &&
                    string.IsNullOrEmpty(txtDefendantCity.Text) &&
                    string.IsNullOrEmpty(txtDefendantState.Text) &&
                    string.IsNullOrEmpty(txtDefendantZip.Text) &&
                    string.IsNullOrEmpty(txtDefendantHomePhone.Text) &&
                    string.IsNullOrEmpty(txtDefendantBusinessPhone.Text) &&
                    dtDefendantDateOfBirth.SelectedDate == null &&
                    string.IsNullOrEmpty(txtDefendantDrivingLicense.Text) &&
                    string.IsNullOrEmpty(txtDefendantAttorneyFirm.Text) &&
                    string.IsNullOrEmpty(txtDefendantAttorneyName.Text) &&
                    string.IsNullOrEmpty(txtDefendantAttorneyAddress.Text) &&
                    string.IsNullOrEmpty(txtDefendantAttorneyCity.Text) &&
                    string.IsNullOrEmpty(txtDefendantAttorneyState.Text) &&
                    string.IsNullOrEmpty(txtDefendantAttorneyZip.Text) &&
                    string.IsNullOrEmpty(txtDefendantAttorneyPhone.Text))
                {
                    return;
                }
                ClientDefendantInformation defInfo = new ClientDefendantInformation();
                defInfo.LastName = txtDefendantLastName.Text;
                defInfo.FirstName = txtDefendantFirstName.Text;
                defInfo.Address = txtDefendantAddress.Text;
                defInfo.City = txtDefendantCity.Text;
                defInfo.State = txtDefendantState.Text;
                defInfo.Zip = txtDefendantZip.Text;
                defInfo.HomePhone = txtDefendantHomePhone.Text;
                defInfo.BusinessPhone = txtDefendantBusinessPhone.Text;
                defInfo.DateOfBirth = DateTime.Parse(dtDefendantDateOfBirth.SelectedDate.Value.ToShortDateString());
                defInfo.DrivingLicense = txtDefendantDrivingLicense.Text;

                defInfo.AttorneyInfo = new DefendantAttorneyInformation();
                defInfo.AttorneyInfo.Firm = txtDefendantAttorneyFirm.Text;
                defInfo.AttorneyInfo.Attorney = txtDefendantAttorneyName.Text;
                defInfo.AttorneyInfo.Address = txtDefendantAttorneyAddress.Text;
                defInfo.AttorneyInfo.City = txtDefendantAttorneyCity.Text;
                defInfo.AttorneyInfo.State = txtDefendantAttorneyState.Text;
                defInfo.AttorneyInfo.Zip = txtDefendantAttorneyZip.Text;
                defInfo.AttorneyInfo.Phone = txtDefendantAttorneyPhone.Text;

                BusinessLogic.SaveClientDefendantInformation(defInfo, txtFileNo.Text);
            }
            catch (Exception ex)
            {
                Helper.LogException(ex);
            }
        }