private void buttonX1_Click(object sender, EventArgs e) { prod = new GProduct(); prod.Name = textBoxX1.Text; prod.Description = textBoxX2.Text; prod.Quantity = (ushort)integerInput2.Value; prod.Price = (ushort)integerInput1.Value; prod.ProductType = (GProductType)byte.Parse(((ComboItem)comboBoxEx1.SelectedItem).Value.ToString()); Done = true; this.Close(); }
private void buttonItem12_Click(object sender, EventArgs e) { try { GProduct prod = prodCtrl1.GetSelectedCommand(); if (prod != null) { if (Admins.admin.RemoveProduct(prod.ProductID.ToString())) { MessageBoxEx.Show("Supprimé avec succès", "Produits", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch { } }
private void addMessageToList(GProduct cmd) { try { ListViewItem item = this.listViewEx1.Items.Add(new ListViewItem(cmd.ProductID.ToString())); item.Tag = cmd; item.SubItems.Add(cmd.Name); item.SubItems.Add(cmd.Quantity.ToString()); item.SubItems.Add(cmd.Price.ToString()); item.SubItems.Add(cmd.Description); item.SubItems.Add(cmd.ProductType.ToString()); item.SubItems.Add(cmd.ProductDate.ToString()); } catch (Exception ex) { //GigSpace.LogError(ex); } }
public void AddCMD(GProduct cmd) { try { if (this.listViewEx1.InvokeRequired) { addMessageDelegate d = new addMessageDelegate(addMessageToList); listViewEx1.Invoke(d, cmd); } else { addMessageToList(cmd); } } catch (Exception ex) { // GigSpace.LogError(ex); } }
private void buttonItem15_Click(object sender, EventArgs e) { try { GProduct prod = prodCtrl1.GetSelectedCommand(); if (prod != null) { Addinfrm frm = new Addinfrm(prod.ProductID, (byte)prod.ProductType); frm.ShowDialog(); if (frm.Done) { if ((byte)prod.ProductType <= 4) { Vehicle v = frm.v; if (Admins.admin.AddVehicle(prod.ProductID.ToString(), v.Color1, v.Color2, v.Sale, v.Featured, v.Speed, v.Fuel, v.Places, v.Tuning, v.PrixIG, v.Water, v.Category)) { MessageBoxEx.Show("Informations du produit " + prod.ProductID.ToString() + " ajouté avec succès", "Produits", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if ((byte)prod.ProductType == 5) { House h = frm.h; if (Admins.admin.AddHouse(prod.ProductID.ToString(), h.Pieces, h.IdInt, h.Sale, h.Featured, h.Ville, h.Popularity, h.Garage, h.GarageMap, h.Wall, h.WallMap, h.PrixIG, h.Jardin, h.Piscine, h.Category)) { MessageBoxEx.Show("Informations du produit " + prod.ProductID.ToString() + " ajouté avec succès", "Produits", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if ((byte)prod.ProductType <= 7) { Bizz b = frm.b; if (Admins.admin.AddBizz(prod.ProductID.ToString(), b.Stock, b.Sale, b.Featured, b.Ville, b.Popularity, b.Depot, b.DepotMap, b.PrixIG, b.Category)) { MessageBoxEx.Show("Informations du produit " + prod.ProductID.ToString() + " ajouté avec succès", "Produits", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } } catch { } }
public void Init() { try { listViewEx1.Items.Clear(); Admins.SetSTAT("Recherche des produits..."); GProduct scmd = new GProduct(); // AddCMD(scmd); foreach (GProduct cmd in Admins.admin.GetProducts("1,30")) { AddCMD(cmd); } Admins.SetSTAT("Recherche terminé"); } catch { } }
private void buttonItem17_Click(object sender, EventArgs e) { try { GProduct prod = prodCtrl1.GetSelectedCommand(); if (prod != null) { AddPicsfrm frm = new AddPicsfrm(prod, true); frm.ShowDialog(); if (frm.Done) { if (Admins.admin.ModifyPictures(prod.ProductID.ToString(), frm.textBoxX2.Text, frm.textBoxX3.Text, frm.textBoxX4.Text)) { MessageBoxEx.Show("Les images du produit ont été modifié (" + prod.ProductID.ToString() + ") avec succès", "Produits", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch { } }
private void buttonItem11_Click(object sender, EventArgs e) { try { GProduct prod = prodCtrl1.GetSelectedCommand(); if (prod != null) { ProdFrm frm = new ProdFrm(prod); frm.ShowDialog(); if (frm.Done) { if (Admins.admin.ModifyProduct(prod.ProductID.ToString(), frm.prod.Name, frm.prod.Description, (int)frm.prod.Quantity, frm.prod.Price, (byte)frm.prod.ProductType)) { MessageBoxEx.Show("Produit modifié " + prod.ProductID.ToString() + " avec succès", "Produits", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } catch { } }
public ProdFrm(GProduct prod) { InitializeComponent(); this.Text = "Modification du produit : ID_" + prod.ProductID.ToString(); comboBoxEx1.SelectedItem = comboItem1; textBoxX1.Text = prod.Name; textBoxX2.Text = prod.Description; integerInput1.Value = (int)prod.Price; integerInput2.Value = (int)prod.Quantity; if (prod.ProductType == GProductType.Voitures) { comboBoxEx1.SelectedItem = comboItem1; } else if (prod.ProductType == GProductType.Bateaux) { comboBoxEx1.SelectedItem = comboItem2; } else if (prod.ProductType == GProductType.Avions) { comboBoxEx1.SelectedItem = comboItem3; } else if (prod.ProductType == GProductType.Semi) { comboBoxEx1.SelectedItem = comboItem4; } else if (prod.ProductType == GProductType.Maisons) { comboBoxEx1.SelectedItem = comboItem5; } else if (prod.ProductType == GProductType.Bizz) { comboBoxEx1.SelectedItem = comboItem6; } else if (prod.ProductType == GProductType.Usines) { comboBoxEx1.SelectedItem = comboItem7; } }
public AddPicsfrm(GProduct prod) { InitializeComponent(); this.Text += " ID_" + prod.ProductID.ToString(); }
public AddPicsfrm(GProduct prod, bool mod) { InitializeComponent(); this.Text = "Modification des images du produit ID_" + prod.ProductID.ToString(); }