Пример #1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (lastName_tb.Text != "")
     {
         CustomerControl customerControl = new CustomerControl();
         dataGridView1.DataSource = customerControl.SearchCustomer(lastName_tb.Text);
     }
     else
     {
         MessageBox.Show("Must enter last name", "Error");
     }
 }
Пример #2
0
        private void edit_button_Click(object sender, EventArgs e)
        {
            string   firstName       = first_name_tb.Text;
            string   lastName        = last_name_tb.Text;
            string   email           = email_tb.Text;
            string   phone           = phone_tb.Text;
            string   notes           = notes_tb.Text;
            DateTime currentCallDate = current_date.Value;
            DateTime callBack        = call_back_date.Value;

            CustomerControl customerControl = new CustomerControl();

            customerControl.EditCustomer(new Customer(idCustomerSelected, firstName, lastName, email, phone, notes, currentCallDate, callBack));

            MessageBox.Show("Successfully modified data");
            Close();
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 1)
            {
                DialogResult answer = MessageBox.Show("Are you sure delete data?", "important", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                if (answer == DialogResult.OK)
                {
                    CustomerControl customerControl = new CustomerControl();

                    int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);

                    customerControl.DeleteCustomer(id);
                }
            }
            else
            {
                MessageBox.Show("You must select a row to delete customer data", "Error!");
            }
        }
Пример #4
0
        private void register_button_Click(object sender, EventArgs e)
        {
            string   firstName       = first_name_tb.Text;
            string   lastName        = last_name_tb.Text;
            string   email           = email_tb.Text;
            string   phone           = phone_tb.Text;
            string   notes           = notes_tb.Text;
            DateTime currentCallDate = current_date.Value;
            DateTime callBack        = call_back_date.Value;

            CustomerControl customerControl = new CustomerControl();

            customerControl.InsertCustomer(new Customer(firstName, lastName, email, phone, notes, currentCallDate, callBack));

            MessageBox.Show("Successful registeres customer", "Successfull regitration!");
            first_name_tb.Text = "";
            last_name_tb.Text  = "";
            email_tb.Text      = "";
            phone_tb.Text      = "";
            notes_tb.Text      = "";
        }
        private void FrmOptionsCustomers_Load(object sender, EventArgs e)
        {
            CustomerControl customerControl = new CustomerControl();

            dataGridView1.DataSource = customerControl.ListCustomers();
        }
        private void btnCallToday_Click(object sender, EventArgs e)
        {
            CustomerControl customerControl = new CustomerControl();

            dataGridView1.DataSource = customerControl.ListCustomersToCallToday();
        }