Ejemplo n.º 1
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            Shop_Customer SC = new Shop_Customer();

            MySQLConnector.Customer C = DB.CustomerGetByID(int.Parse(listView1.SelectedItems[0].Text));
            SC.Cus_Address = C.B_Address;
            SC.Cus_Comp    = C.B_Company;
            SC.Cus_Email   = C.B_Email;
            SC.Cus_Name    = C.B_Name;
            SC.Cus_Phone   = C.B_Phone;

            if (SC.ShowDialog() == DialogResult.OK)
            {
                C.B_Name    = SC.Cus_Name;
                C.B_Company = SC.Cus_Comp;
                C.B_Address = SC.Cus_Address;
                C.B_Email   = SC.Cus_Email;
                C.B_Phone   = SC.Cus_Phone;

                if (DB.CustomerUpdate(C) == MySQLConnector.Result.Success)
                {
                    refreshList();
                }
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {// add new customer button
            Shop_Customer SC = new Shop_Customer();
            if (SC.ShowDialog() == DialogResult.OK)
            {
                MySQLConnector.Customer C = new MySQLConnector.Customer();
                C.B_Name = SC.Cus_Name;
                C.B_Company = SC.Cus_Comp;
                C.B_Address = SC.Cus_Address;
                C.B_Email = SC.Cus_Email;
                C.B_Phone = SC.Cus_Phone;

                if (DB.CustomerAdd(C) == MySQLConnector.Result.Success)
                {
                    refreshList();
                }

            }
            else { MessageBox.Show(SC.DialogResult.ToString()); }
        }