private void toolStripButton10_ButtonClick(object sender, EventArgs e) { panelMain.Controls.Clear(); Find_item finditm = new Find_item(); finditm.TopLevel = false; finditm.Visible = true; panelMain.Controls.Add(finditm); }
private void findItemsToolStripMenuItem_Click(object sender, EventArgs e) { panelMain.Controls.Clear(); Find_item finditm = new Find_item(); finditm.TopLevel = false; finditm.Visible = true; panelMain.Controls.Add(finditm); Find_item.tx_bcde.Focus(); }
private void btnFindItemDeleteItem_Click(object sender, EventArgs e) { try { iino = dgvFindItem.CurrentRow.Cells["Item_No"].Value.ToString(); iiserial = dgvFindItem.CurrentRow.Cells["Serial_No"].Value.ToString(); iinme = dgvFindItem.CurrentRow.Cells["Item_Name"].Value.ToString(); iiselpiz = dgvFindItem.CurrentRow.Cells["Sales_Price"].Value.ToString(); iipurpiz = dgvFindItem.CurrentRow.Cells["Purchase_Price"].Value.ToString(); iitax = dgvFindItem.CurrentRow.Cells["Tax_Rate"].Value.ToString(); iibcode = dgvFindItem.CurrentRow.Cells["Barcode"].Value.ToString(); iictgry = dgvFindItem.CurrentRow.Cells["Catogory"].Value.ToString(); iisubctgry = dgvFindItem.CurrentRow.Cells["Sub_Catogory"].Value.ToString(); iibrnd = dgvFindItem.CurrentRow.Cells["Brande"].Value.ToString(); iitpe = dgvFindItem.CurrentRow.Cells["Item_Type"].Value.ToString(); iisuppl = dgvFindItem.CurrentRow.Cells["Supplier"].Value.ToString(); iiwrrty = dgvFindItem.CurrentRow.Cells["Warranty"].Value.ToString(); iidescri = dgvFindItem.CurrentRow.Cells["Discription"].Value.ToString(); if (MessageBox.Show("Do you Want to Remove Item " + dgvFindItem.CurrentRow.Cells["Brande"].Value.ToString() + " " + dgvFindItem.CurrentRow.Cells["Sub_Catogory"].Value.ToString() + " " + dgvFindItem.CurrentRow.Cells["Catogory"].Value.ToString() + " to Return list", "Sharp Creation", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { SqlDataReader drm = itemdb.select_to_Qntity(dgvFindItem.CurrentRow.Cells["Catogory"].Value.ToString(), dgvFindItem.CurrentRow.Cells["Sub_Catogory"].Value.ToString(), dgvFindItem.CurrentRow.Cells["Brande"].Value.ToString()); if (drm.Read()) { string qqt = drm["Quntity"].ToString(); int qq1 = int.Parse(qqt); int qq2 = qq1 - 1; string qty = qq2.ToString(); try { itemdb.update_Quntity(qty, dgvFindItem.CurrentRow.Cells["Catogory"].Value.ToString(), dgvFindItem.CurrentRow.Cells["Sub_Catogory"].Value.ToString(), dgvFindItem.CurrentRow.Cells["Brande"].Value.ToString()); // MessageBox.Show("Quntity Updated"); wrty.insert_retn_itm(iino, iiserial, iinme, Convert.ToDecimal(iiselpiz), Convert.ToDecimal(iipurpiz), Convert.ToDecimal(iitax), iibcode, iictgry, iisubctgry, iibrnd, iitpe, iisuppl, iiwrrty, iidescri); // MessageBox.Show("add to return list"); itemdb.delete_item(dgvFindItem.CurrentRow.Cells["Item_No"].Value.ToString()); // MessageBox.Show("Item Deleted"); } catch (Exception) { } } } Main.p1.Controls.Clear(); Find_item finit = new Find_item(); finit.TopLevel = false; finit.Visible = true; Main.p1.Controls.Add(finit); } catch (Exception) { } }
private void btnAddItemAddItem_Click(object sender, EventArgs e) { ep_iname.SetError(txtAddItemItemName, ""); ep_isalePrz.SetError(txtAddItemSalesPrice, ""); ep_ipuchsPriz.SetError(txtAddItemPurchasePrice, ""); ep_isupp.SetError(cbxAddItemSupplier, ""); ep_ictogry.SetError(cbxAddItemCatogory, ""); ep_isubCotory.SetError(cbxAddItemSubCatogory, ""); ep_ibrnd.SetError(cbxAddItemBrande, ""); string warrty; if (cb_warnty.Checked == true) { string wtyNo = cbx_wrty_number.Text; string wtydu = cbx_wrty_duretion.Text; warrty = wtyNo + " " + wtydu; } else { warrty = "No Warranty"; } try { if (txtAddItemBarcode.Text != "" || txtAddItemSerial.Text != "") { if (txtAddItemItemName.Text != "" && txtAddItemSalesPrice.Text != "" && txtAddItemPurchasePrice.Text != "" && cbxAddItemCatogory.Text != "" && cbxAddItemSubCatogory.Text != "" && cbxAddItemBrande.Text != "" && cbxAddItemSupplier.Text != "") { if (cb_warnty.Checked == true) { if (cbx_wrty_number.Text != "" && cbx_wrty_duretion.Text != "") { string sql = "UPDATE tbl_Add_Items SET Serial_No='" + txtAddItemSerial.Text + "',Item_Name='" + txtAddItemItemName.Text + "',Sales_Price='" + Convert.ToDecimal(txtAddItemSalesPrice.Text) + "',Purchase_Price='" + Convert.ToDecimal(txtAddItemPurchasePrice.Text) + "',Tax_Rate='" + Convert.ToDecimal(txtAddItemTaxRate.Text) + "',Barcode='" + txtAddItemBarcode.Text + "',Catogory='" + cbxAddItemCatogory.Text + "',Sub_Catogory='" + cbxAddItemSubCatogory.Text + "',Brande='" + cbxAddItemBrande.Text + "',Item_Type='" + cbxAddItemItemType.Text + "',Supplier='" + cbxAddItemSupplier.Text + "',Warranty='" + warrty + "',Discription='" + txtAddItemDiscription.Text + "' WHERE Item_No='" + lbl_itemNo.Text + "'"; SqlCommand com = new SqlCommand(sql, ConnectionDB.Connection()); com.ExecuteNonQuery(); // MessageBox.Show("Item Added"); //SqlDataReader dr = itemdb.select_to_Qntity(cbxAddItemCatogory.Text, cbxAddItemSubCatogory.Text, cbxAddItemBrande.Text); //if (dr.Read()) //{ // string qt = dr["Quntity"].ToString(); // int q1 = int.Parse(qt); // int q2 = q1 + 1; // string qty = q2.ToString(); // itemdb.update_Quntity(qty, cbxAddItemCatogory.Text, cbxAddItemSubCatogory.Text, cbxAddItemBrande.Text); // // MessageBox.Show("Quntity Updated"); //} //else //{ // itemdb.Quntity(txtAddItemItemName.Text,cbxAddItemCatogory.Text, cbxAddItemSubCatogory.Text, cbxAddItemBrande.Text, "1",txtAddItemPurchasePrice.Text,txtAddItemSalesPrice.Text); // // MessageBox.Show("quntity Added"); //} //SqlDataReader drm = itemdb.select_to_Qntity(itup.catogy, itup.subCatogy, itup.Brande); //if (drm.Read()) //{ // string qqt = drm["Quntity"].ToString(); // int qq1 = int.Parse(qqt); // int qq2 = qq1 - 1; // string qty = qq2.ToString(); // itemdb.update_Quntity(qty, itup.catogy, itup.subCatogy, itup.Brande); // // MessageBox.Show("Quntity Updated"); //} if (MessageBox.Show("Item Updated Successfuly.", "Update Item", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { this.Close(); Main.p1.Controls.Clear(); Find_item d1 = new Find_item(); d1.TopLevel = false; d1.Visible = true; Main.p1.Controls.Add(d1); } } else { ep_warrnty.SetError(cbx_wrty_duretion, "Complete warranty"); } } else { string sql = "UPDATE tbl_Add_Items SET Serial_No='" + txtAddItemSerial.Text + "',Item_Name='" + txtAddItemItemName.Text + "',Sales_Price='" + txtAddItemSalesPrice.Text + "',Purchase_Price='" + txtAddItemPurchasePrice.Text + "',Tax_Rate='" + txtAddItemTaxRate.Text + "',Barcode='" + txtAddItemBarcode.Text + "',Catogory='" + cbxAddItemCatogory.Text + "',Sub_Catogory='" + cbxAddItemSubCatogory.Text + "',Brande='" + cbxAddItemBrande.Text + "',Item_Type='" + cbxAddItemItemType.Text + "',Supplier='" + cbxAddItemSupplier.Text + "',Warranty='" + warrty + "',Discription='" + txtAddItemDiscription.Text + "' WHERE Item_No='" + lbl_itemNo.Text + "'"; SqlCommand com = new SqlCommand(sql, ConnectionDB.Connection()); com.ExecuteNonQuery(); // MessageBox.Show("Item Added"); SqlDataReader dr = itemdb.select_to_Qntity(cbxAddItemCatogory.Text, cbxAddItemSubCatogory.Text, cbxAddItemBrande.Text); if (dr.Read()) { string qt = dr["Quntity"].ToString(); int q1 = int.Parse(qt); int q2 = q1 + 1; string qty = q2.ToString(); itemdb.update_Quntity(qty, cbxAddItemCatogory.Text, cbxAddItemSubCatogory.Text, cbxAddItemBrande.Text); // MessageBox.Show("Quntity Updated"); } else { itemdb.Quntity(txtAddItemItemName.Text, cbxAddItemCatogory.Text, cbxAddItemSubCatogory.Text, cbxAddItemBrande.Text, "1", txtAddItemPurchasePrice.Text, txtAddItemSalesPrice.Text); // MessageBox.Show("quntity Added"); } SqlDataReader drm = itemdb.select_to_Qntity(itup.catogy, itup.subCatogy, itup.Brande); if (drm.Read()) { string qqt = drm["Quntity"].ToString(); int qq1 = int.Parse(qqt); int qq2 = qq1 - 1; string qty = qq2.ToString(); itemdb.update_Quntity(qty, itup.catogy, itup.subCatogy, itup.Brande); // MessageBox.Show("Quntity Updated"); } if (MessageBox.Show("Item Updated Successfuly.", "Update Item", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK) { this.Close(); Main.p1.Controls.Clear(); Find_item d1 = new Find_item(); d1.TopLevel = false; d1.Visible = true; Main.p1.Controls.Add(d1); } } } else { if (txtAddItemItemName.Text == "") { ep_iname.SetError(txtAddItemItemName, "Enter Item name"); } if (txtAddItemSalesPrice.Text == "") { ep_isalePrz.SetError(txtAddItemSalesPrice, "Enter Item Sales Price"); } if (txtAddItemPurchasePrice.Text == "") { ep_ipuchsPriz.SetError(txtAddItemPurchasePrice, "Enter Item Purchas Price"); } if (cbxAddItemSupplier.Text == "") { ep_isupp.SetError(cbxAddItemSupplier, "Choose Supplier name"); } if (cbxAddItemCatogory.Text == "") { ep_ictogry.SetError(cbxAddItemCatogory, "Choose Item Catogary"); } if (cbxAddItemSubCatogory.Text == "") { ep_isubCotory.SetError(cbxAddItemSubCatogory, "Choose Item sub Catogary"); } if (cbxAddItemBrande.Text == "") { ep_ibrnd.SetError(cbxAddItemBrande, "Choose Item Brande"); } tp_required.Show("Fill Require fileds", btnAddItemAddItem, 5000); } } else { tp_seril_barcobe.Show("Must Enter Serial or Barcode For Iditify Items", lbl_tp, 4000); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }