private void BTNADD_Click(object sender, EventArgs e) { MemoryStream ms = new MemoryStream(); PICIMAGE.Image.Save(ms, PICIMAGE.Image.RawFormat); byte[] arr = ms.ToArray(); if (_ISUPDATE == false) { CLASS_PRODUCTS.SP_ADDNEWPRODUCT(TXTPRODUCTNAME.Text, TXTPRODUCTDESC.Text, arr, TXTBUYPRICE.Text, TXTSELLPRICE.Text, (int)CMBCAT.SelectedValue, (int)CMBAM.SelectedValue, (int)CMBSN.SelectedValue, TXTBARCODE.Text); MessageBox.Show("تم اضافة المنتج"); foreach (Control item in groupBox1.Controls) { if (item is TextBox) { item.Text = string.Empty; } } } else { CLASS_PRODUCTS.SP_PRODUCTUPDATE(FRM_PRODUCTMANAGEMENT.ID, TXTPRODUCTNAME.Text, TXTPRODUCTDESC.Text, arr, TXTBUYPRICE.Text, TXTSELLPRICE.Text, (int)CMBCAT.SelectedValue, (int)CMBAM.SelectedValue, (int)CMBSN.SelectedValue, TXTBARCODE.Text); MessageBox.Show("تم تعديل المنتج"); } }
private void btnADD_Click(object sender, EventArgs e) { try { MemoryStream ms = new MemoryStream(); PICIMAGE.Image.Save(ms, PICIMAGE.Image.RawFormat); byte[] arr = ms.ToArray(); if (_CheckForm == "New") { if (txtSerialNumber.Text != string.Empty && txtName.Text != string.Empty) { CLASS_PRODUCTS.SP_ADDNEWPRODUCTS((int)cmbMarque.SelectedValue, (int)cmbCategory.SelectedValue, arr, txtName.Text, txtDescription.Text, double.Parse(txtPrice.Text), txtSerialNumber.Text, txtUser.Text, (int)cmbEmplacement.SelectedValue, _Checked, leasedate, txtdeliveryguy.Text, dtpDeleviry.Value, dtpexpiration.Value, (int)cmbEtat.SelectedValue); MessageBox.Show("Ajouté avec succès", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Remplir les champs obligatoires", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (_CheckForm == "Update") { CLASS_PRODUCTS.SP_UPDATEPRODUCTS((int)cmbMarque.SelectedValue, (int)cmbCategory.SelectedValue, arr, txtName.Text, txtDescription.Text, double.Parse(txtPrice.Text), txtSerialNumber.Text, txtUser.Text, (int)cmbEmplacement.SelectedValue, _Checked, leasedate, txtdeliveryguy.Text, dtpDeleviry.Value, dtpexpiration.Value, (int)cmbEtat.SelectedValue); MessageBox.Show("Editer avec succès", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnDisplay_Click(object sender, EventArgs e) { DataTable dt = CLASS_PRODUCTS.SP_DISPLAYALLPRODUCTS_LESSDETAILS(); dgvProduit.DataSource = dt; dgvquantity.Rows.Clear(); }
private void btnImage_Click(object sender, EventArgs e) { byte[] Arr = CLASS_PRODUCTS.SP_PRODUCTGETIMAGE(int.Parse(dgvProduit.SelectedRows[0].Cells[0].Value.ToString())); MemoryStream ms = new MemoryStream(Arr); Form_DisplayImage fimage = new Form_DisplayImage(); fimage.PICIMAGE.Image = Image.FromStream(ms); fimage.ShowDialog(); }
private void BTNDISPALYIMG_Click(object sender, EventArgs e) { byte[] arr = CLASS_PRODUCTS.SP_PRODUCTSGETIMG(int.Parse(dgvPRODUCTS.SelectedRows[0].Cells[0].Value.ToString())); MemoryStream ms = new MemoryStream(arr); FRM_PRODUCTIMG frm = new FRM_PRODUCTIMG(); frm.PICIMG.Image = Image.FromStream(ms); frm.ShowDialog(); }
//public static bool ISUPDATE_INSERT = false; اضافة private void BTNDISPLAY_Click(object sender, EventArgs e) { DataTable dt = CLASS_PRODUCTS.SP_PRODUCTSELECT(); dgvPRODUCTS.Rows.Clear(); foreach (DataRow dr in dt.Rows) { dgvPRODUCTS.Rows.Add(dr[0], dr[1], dr[2], dr[3], dr[4], dr[5], dr[6], dr[7], dr[8], dr[9]); } }
private void TXTSEARCH_TextChanged(object sender, EventArgs e) { DataTable dt = CLASS_PRODUCTS.SP_PRODUCTSEARCH(TXTSEARCH.Text); dgvPRODUCTS.Rows.Clear(); foreach (DataRow dr in dt.Rows) { dgvPRODUCTS.Rows.Add(dr[0], dr[1], dr[2], dr[3], dr[4], dr[5], dr[6], dr[7], dr[8], dr[9]); } }
private void btnDelete_Click(object sender, EventArgs e) { I = int.Parse(dgvProduit.SelectedRows[0].Cells[0].Value.ToString()); DialogResult dr = MessageBox.Show("Voules-vous vraiment supprimer", "Notification", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { CLASS_PRODUCTS.SP_DELETEPRODUCTS(I); MessageBox.Show("Supprimer avec succès", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button4_Click(object sender, EventArgs e) { ID = int.Parse(dgvPRODUCTS.SelectedRows[0].Cells[0].Value.ToString()); DialogResult dr = MessageBox.Show("هل تريد حذف المنتج المحدد", "تحذير", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (dr == System.Windows.Forms.DialogResult.Yes) { CLASS_PRODUCTS.SP_PRODUCTSDELETE(ID); MessageBox.Show("تم الحذف بنجاح"); } }
private void dgvProduit_CellClick(object sender, DataGridViewCellEventArgs e) { dgvquantity.Rows.Clear(); I = int.Parse(dgvProduit.SelectedRows[0].Cells[0].Value.ToString()); DataTable dt = CLASS_PRODUCTS.SP_DISPLAYALLPRODUCTSBYID(I); foreach (DataRow dr in dt.Rows) { dgvquantity.Rows.Add(dr["P_ID"], dr["Brand_Name"], dr["Cat_Name"], dr["P_Description"], dr["P_Price"], dr["WareHouse_Location"], dr["Delivered_BY"], dr["Acquisition_Date"], dr["State_Nom"]); } }
private void CMBFilter_SelectedIndexChanged_1(object sender, EventArgs e) { switch (CMBFilter.Text) { case "Quantité": DataTable dt = CLASS_PRODUCTS.SP_DISPLAYALLPRODUCTSBYQUANTITY(); dgvfilter.DataSource = dt; break; default: break; } }
public FRM_ADDNEWPRODUCT(bool ISUPDATE) { InitializeComponent(); this._ISUPDATE = ISUPDATE; DataTable DTCAT = CLASS_PRODUCTS.SP_FILLCATCMB(); CMBCAT.DataSource = DTCAT; CMBCAT.DisplayMember = "Cat_Name"; CMBCAT.ValueMember = "Cat_ID"; DataTable DTAM = CLASS_PRODUCTS.SP_FILLAMCMB(); CMBAM.DataSource = DTAM; CMBAM.DisplayMember = "Am_Name"; CMBAM.ValueMember = "Am_ID"; DataTable DTSN = CLASS_PRODUCTS.SP_FILLSNCMB(); CMBSN.DataSource = DTSN; CMBSN.DisplayMember = "Sn_Name"; CMBSN.ValueMember = "Sn_id"; if (_ISUPDATE == true) { this.Text = "تعديل بيانات المنتج"; BTNADD.Text = "تعديل"; DataTable dt = CLASS_PRODUCTS.SP_GETSELECTEDPRODUCT(FRM_PRODUCTMANAGEMENT.ID); foreach (DataRow dr in dt.Rows) { CMBCAT.Text = dr["Cat_Name"].ToString(); TXTPRODUCTNAME.Text = dr["P_Name"].ToString(); TXTPRODUCTDESC.Text = dr["P_Description"].ToString(); TXTBUYPRICE.Text = dr["buyPrice"].ToString(); TXTSELLPRICE.Text = dr["SellPrice"].ToString(); CMBAM.Text = dr["Am_Name"].ToString(); CMBSN.Text = dr["Sn_Name"].ToString(); TXTBARCODE.Text = dr["Barcode"].ToString(); byte[] arr = (byte[])dr["P_Image"]; MemoryStream ms = new MemoryStream(arr); PICIMAGE.Image = Image.FromStream(ms); } } else { this.Text = "اضافة بيانات المنتج"; BTNADD.Text = "اضافة"; } }
public Form_GridProductsSuppliers(string check) { InitializeComponent(); _check = check; if (_check == "Products") { DataTable dt = CLASS_PRODUCTS.SP_DISPLAYALLPRODUCTS(); dataGridView1.DataSource = dt; } else if (_check == "Suppliers") { DataTable dt = CLASS_SUPPLIERS.SP_SUPPLIERSELECTALL(); dataGridView1.DataSource = dt; } }
private void BTNDISPLAYEXPIREDATE_Click(object sender, EventArgs e) { DataTable DT = CLASS_PRODUCTS.SP_PRODUCTEXPDATES(int.Parse(dgvPRODUCTS.SelectedRows[0].Cells[0].Value.ToString())); if (DT.Rows.Count > 0) { FRM_PRODUCTEXPIERDATES frm = new FRM_PRODUCTEXPIERDATES(); frm.DGVPRODUCTEXP.DataSource = DT; frm.ShowDialog(); } else { MessageBox.Show("لا يوجد تاريخ صلاحية لهذا المنتج"); } }
public FRM_SEARCH(string _ch) { InitializeComponent(); if (_ch == "supplier") { DataTable dt = CLASS_SUPPLIER.SP_SUPPLIERSELECT(); dataGridView1.DataSource = dt; this.Text = "بيانات الموردين "; } else if (_ch == "product") { this.Text = "بيانات المنتجات"; dataGridView1.DataSource = CLASS_PRODUCTS.SP_PRODUCTSELECT(); } else if (_ch == "customer") { this.Text = "بيانات العملاء"; dataGridView1.DataSource = CLASS_CUSTOMER.sp_customer_display(); } }
public Form_AddNewProducts(string CheckForm) { InitializeComponent(); _CheckForm = CheckForm; //----------------------------------------------------------- DataTable Categorydt = CLASS_PRODUCTS.SP_FILLCMBCATEGORY(); cmbCategory.DataSource = Categorydt; cmbCategory.DisplayMember = "Cat_Name"; cmbCategory.ValueMember = "Cat_ID"; //------------------------------------------------------------ DataTable Marquedt = CLASS_PRODUCTS.SP_FILLCMBBRAND(); cmbMarque.DataSource = Marquedt; cmbMarque.DisplayMember = "Brand_Name"; cmbMarque.ValueMember = "Brand_ID"; //------------------------------------------------------------ DataTable Etatdt = CLASS_PRODUCTS.SP_FILLCMBETAT(); cmbEtat.DataSource = Etatdt; cmbEtat.DisplayMember = "State_Nom"; cmbEtat.ValueMember = "State_ID"; //----------------------------------------------------------- DataTable MagazinDT = CLASS_PRODUCTS.SP_FILLCMBWAREHOUSE(); cmbEmplacement.DataSource = MagazinDT; cmbEmplacement.DisplayMember = "WareHouse_Location"; cmbEmplacement.ValueMember = "WareHouse_ID"; //------------------------------------------------------------ //------------------------------------------------------------ if (_CheckForm == "New") { this.Text = "Ajouter un Produit"; btnADD.Text = "Ajouter"; } else if (_CheckForm == "Update") { this.Text = "Editer le Produit"; btnADD.Text = "Editer"; DataTable dt = CLASS_PRODUCTS.SP_DISPLAYALLPRODUCTSBYID(Form_ProductsManagement.I); foreach (DataRow dr in dt.Rows) { txtName.Text = dr["P_ID"].ToString(); cmbCategory.Text = dr["Cat_Name"].ToString(); cmbMarque.Text = dr["Brand_Name"].ToString(); txtSerialNumber.Text = dr["Serial_Number"].ToString(); cmbEtat.Text = dr["State_Nom"].ToString(); txtUser.Text = dr["U_Name"].ToString(); cmbEmplacement.Text = dr["WareHouse_Location"].ToString(); byte[] Arr = (byte[])dr["P_Image"]; MemoryStream ms = new MemoryStream(Arr); PICIMAGE.Image = Image.FromStream(ms); dtpexpiration.Text = dr["EXPIRE_DATE"].ToString(); dtpDeleviry.Text = dr["Acquisition_Date"].ToString(); dtploueexpiration.Text = dr["lease_Expire"].ToString(); if (dr["leased"].ToString() == 0.ToString()) { OuiRadioBTN.Checked = true; } else { NonRadioBTN.Checked = true; } txtPrice.Text = dr["P_Price"].ToString(); txtDescription.Text = dr["P_Description"].ToString(); txtdeliveryguy.Text = dr["Delivered_BY"].ToString(); } } }
private void BTNSEARCH_Click(object sender, EventArgs e) { DataTable dt = CLASS_PRODUCTS.SP_SEARCHPRODUCT(txtSearch.Text); dgvProduit.DataSource = dt; }