コード例 #1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            int contactID = 0;
            // Dim contactID As Integer = 0

            int selectedRow = My.MyProject.Forms.FrmDisplayContacts.companiesBunifuDataGridView.CurrentCell.RowIndex;
            int companyID   = Conversions.ToInteger(My.MyProject.Forms.FrmDisplayContacts.companiesBunifuDataGridView.Rows[selectedRow].Cells[4].Value);

            if (!string.IsNullOrEmpty(firstNameTextBox.Text))
            {
                if (My.MyProject.Forms.FrmDisplayContacts.isNewContact == false)
                {
                    int selectedRowContact = My.MyProject.Forms.FrmDisplayContacts.contactsBunifuDataGridView.CurrentCell.RowIndex;
                    contactID = Conversions.ToInteger(My.MyProject.Forms.FrmDisplayContacts.contactsBunifuDataGridView.Rows[selectedRowContact].Cells[5].Value);
                }

                if (!string.IsNullOrEmpty(homeAddressRichTextBox.Text))
                {
                    db.saveAddress(secondAddress, companyID, "Contact", 0);
                }

                db.saveContact(contactID, companyID, firstNameTextBox.Text, lastNameTextBox.Text, Strings.Trim(areaWorkPhoneTextBox.Text + " " + workPhoneTextBox.Text), Strings.Trim(areaMobileTextBox.Text + " " + mobileTextBox.Text), Strings.Trim(areaFaxTextBox.Text + " " + faxTextBox.Text), Strings.Trim(emailTextBox.Text), extensionTextBox.Text, departamentComboBox.Text.ToUpper(), db.getLastAddress(companyID), notesRichTextBox.Text);
                Close();
            }
            else
            {
            }

            My.MyProject.Forms.FrmDisplayContacts.populateContacts("");
        }