Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtFirstName.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtLastName.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtAge.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtState.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtCity.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtAddress.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtZip.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtSalary.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtWork.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtEducation.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (txtStory.Text == "")
            {
                MessageBox.Show("Please make sure there is no empty information.");
                valid = false;
            }
            if (valid == true)
            {
                edit = true;
            }

            if (edit == true)
            {
                try
                {
                    DLL.EditInfo(txtID.Text, txtFirstName.Text, txtLastName.Text, txtAge.Text, txtState.Text, txtCity.Text, txtAddress.Text, txtZip.Text, txtWork.Text, txtSalary.Text, txtEducation.Text, txtStory.Text);
                    DLL.LogChanges(txtID.Text, txtFirstName.Text, txtLastName.Text, txtAge.Text, txtState.Text, txtCity.Text, txtAddress.Text, txtZip.Text, txtGradutated.Text, txtAdmin.Text, txtWork.Text, txtSalary.Text, txtEducation.Text, txtStory.Text, txtShare.Text);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "An unexpected error occured while saving changes.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                MessageBox.Show("Please make sure there is no empty information.");
            }
            MessageBox.Show("Save successful!");
            Disable();
        }