private void button6_Click(object sender, EventArgs e)
 {
     try
     {
         System.DateTime sdate = default(System.DateTime);
         System.DateTime date2 = default(System.DateTime);
         sdate = startdatetimepicker.Value;
         date2 = lastdatetimepicker.Value;
         string updatequery = string.Format("delete from CUSTOMER  where CUSTOMERID = ('{0}')", Convert.ToInt32(customeridtextbox.Text));
         EventMangementSystemClass.Update(updatequery);
         customernametextbox.Clear();
         customeridtextbox.Clear();
         maskedTextBox2.Clear();
         textBox2.Clear();
         maskedTextBox1.Clear();
         startdatetimepicker.ResetText();
         STATUS.Clear();
         lastdatetimepicker.ResetText();
         CUSTOMER_INFORMATION_Load(sender, e);
         dataGridView2.Refresh();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                System.DateTime sdate = default(System.DateTime);
                System.DateTime date2 = default(System.DateTime);
                sdate = startdatetimepicker.Value;
                date2 = lastdatetimepicker.Value;

                string updatequery = string.Format("UPDATE customer SET NAME = ('{0}'), CONTACTNUMBER = ('{1}'), [ADDRESS] = ('{2}'), NIC = ('{3}'), JOINDATE = ('{4}'), [STATUS] = ('{5}'), LEAVEDATE = ('{6}')  WHERE CUSTOMERID =('{7}')", customernametextbox.Text, maskedTextBox2.Text, textBox2.Text, maskedTextBox1.Text, sdate, STATUS.Text, date2, Convert.ToInt32(customeridtextbox.Text));
                EventMangementSystemClass.Update(updatequery);
                customernametextbox.Clear();
                customeridtextbox.Clear();
                maskedTextBox2.Clear();
                textBox2.Clear();
                maskedTextBox1.Clear();
                startdatetimepicker.ResetText();
                STATUS.Clear();
                lastdatetimepicker.ResetText();
                CUSTOMER_INFORMATION_Load(sender, e);
                dataGridView2.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void button2_Click(object sender, EventArgs e)
 {
     customernametextbox.Clear();
     customeridtextbox.Clear();
     maskedTextBox2.Clear();
     textBox2.Clear();
     maskedTextBox1.Clear();
     startdatetimepicker.ResetText();
     STATUS.Clear();
     lastdatetimepicker.ResetText();
 }