コード例 #1
0
        private void UpdateBtn_Click(object sender, EventArgs e)
        {
            Customer customer = new Customer();

            getDate(customer);
            if (UpdateBtn.Text == "Add Customer")
            {
                bool flag = controller.Insert(customer);

                if (flag)
                {
                    flag2 = flag;
                    MessageBox.Show(null, "Customer inserted successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(null, "Please check your input", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                customer.ID = id;

                bool flag = controller.Update(customer);

                if (flag)
                {
                    flag2 = flag;
                    MessageBox.Show(null, "Customer updated successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(null, "Please check your input", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }