private void btnAccept_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtRFC.Text) || RegularExpressions.CheckIsRFC(txtRFC.Text)) { if (RegularExpressions.CheckIsNormalText(txtCompany.Text, 1, 100)) { if (RegularExpressions.CheckIsNormalText(txtAddress.Text, 0, 255)) { if (RegularExpressions.CheckIsNumber(txtPhone.Text, 10, 10)) { if (string.IsNullOrEmpty(txtEmail.Text) || RegularExpressions.CheckIskEmail(txtEmail.Text)) { if (RegularExpressions.CheckIsUrl(txtFacebook.Text)) { if (cboState.SelectedIndex < 1 || cboCity.SelectedIndex > -1) { byte[] logo = null; if (pcbLogo.Image != null) { logo = Tools.ConvertirImagenAByte(pcbLogo.Image); } if (BPrincipalCompany.Edit( objPrincipalCompany, !string.IsNullOrEmpty(txtRFC.Text) ? txtRFC.Text : null, txtCompany.Text, !string.IsNullOrEmpty(txtAddress.Text) ? txtAddress.Text : null, !string.IsNullOrEmpty(txtPhone.Text) ? txtPhone.Text : null, !string.IsNullOrEmpty(txtEmail.Text) ? txtEmail.Text : null, !string.IsNullOrEmpty(txtFacebook.Text) ? txtFacebook.Text : null, cboMode.SelectedIndex == 0 ? true : false, Convert.ToInt32(nudHoursToBackup.Value), Convert.ToInt32(nudDaysToDelete.Value), stPathPicture, logo, cboState.SelectedIndex > 0 ? cboState.Text : null, cboCity.SelectedIndex > -1 ? cboCity.Text : null, ObjForm_004.ObjSession )) { txtRFC.Enabled = false; txtCompany.Enabled = false; txtAddress.Enabled = false; txtPhone.Enabled = false; txtEmail.Enabled = false; txtFacebook.Enabled = false; cboState.Enabled = false; cboCity.Enabled = false; pcbLogo.Enabled = false; cboMode.Enabled = false; nudHoursToBackup.Enabled = false; nudDaysToDelete.Enabled = false; pcbLogo.Enabled = false; btnAccept.Visible = btnCancel.Visible = false; btnEdit.Visible = true; btnClose.Enabled = true; byAction = 0; MessageBox.Show(Preferences.GlobalSuccessOperation, Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(Preferences.GlobalErrorOperation, Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("The city must be selected if you selected some city.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); cboCity.Focus(); } } else { MessageBox.Show("The facebook isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtFacebook.Focus(); } } else { MessageBox.Show("The email isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtEmail.Focus(); } } else { MessageBox.Show("The phone isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtPhone.Focus(); } } else { MessageBox.Show("The address isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtAddress.Focus(); } } else { MessageBox.Show("The company isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCompany.Focus(); } } else { MessageBox.Show("The RFC isn't correct.", Preferences.TitleSoftware, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtRFC.Focus(); } }