Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataRow newRow = table.NewRow();

            newRow["FName"]    = textBox1.Text.Count() == 0 ? null : textBox1.Text;
            newRow["LName"]    = textBox2.Text.Count() == 0 ? null : textBox2.Text;
            newRow["Address1"] = textBox3.Text.Count() == 0 ? null : textBox3.Text;
            newRow["City"]     = textBox4.Text.Count() == 0 ? null : textBox4.Text;
            newRow["Phone"]    = textBox5.Text.Count() == 0 ? null : textBox5.Text;

            try
            {
                table.Rows.Add(newRow);

                DialogResult = System.Windows.Forms.DialogResult.OK;

                CustomersUpdates.InsertCustomers(table);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                this.Close();
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Вы уверены что хотите удалить этого клиента?", "DeleteDialog", MessageBoxButtons.OKCancel);

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                (dataGridView1.CurrentRow.DataBoundItem as DataRowView).Row.Delete();

                CustomersUpdates.DeleteCustomers(customers);
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                rowToEdit["FName"]    = textBox1.Text;
                rowToEdit["LName"]    = textBox2.Text;
                rowToEdit["Address1"] = textBox3.Text;
                rowToEdit["City"]     = textBox4.Text;
                rowToEdit["Phone"]    = textBox5.Text;

                CustomersUpdates.ChangeCustomers(rowToEdit);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            this.Close();
        }