コード例 #1
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            New_Vendor SC = new New_Vendor();

            MySQLConnector.Vendor V = DB.VendorGetByID(int.Parse(listView1.SelectedItems[0].Text));
            SC.CarPlate       = V.CarPlate;
            SC.CarColor       = V.CarColor;
            SC.DriversLicense = V.DriverLicense;
            SC.Text           = "Update Vendor";
            File.WriteAllBytes("Temp.jpg", StringToByteArray(V.DriverLicense));

            if (SC.ShowDialog() == DialogResult.OK)
            {
                V.CarPlate      = SC.CarPlate;
                V.CarColor      = SC.CarColor;
                V.DriverLicense = SC.DriversLicense;
                if (String.IsNullOrEmpty(V.DriverLicense))
                {
                    V.DriverLicense = "Temp.jpg";
                }
                if (DB.VendorUpdate(V) == MySQLConnector.Result.Success)
                {
                    refreshList();
                }
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            New_Vendor V = new New_Vendor()
            {
            };

            if (V.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    DB.VendorAdd(new MySQLConnector.Vendor()
                    {
                        CarPlate = V.CarPlate, CarColor = V.CarColor, DriverLicense = V.DriversLicense
                    });
                }
                catch (Exception)
                {
                }
            }
        }