private void btnok_Click(object sender, EventArgs e) { if (passtxt.Text.Trim() == "") { MessageBox.Show("Please fill up the password field.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); passtxt.Focus(); passtxt.Text = ""; } else if (passtxt.Text.Trim() != password) { MessageBox.Show("Invalid System Password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); passtxt.Text = ""; passtxt.Focus(); } else { if (catans != 1) { BalloonKingdomDataSetTableAdapters.CategoryTableAdapter addNewCat = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.CategoryTableAdapter(); addNewCat.AddNewCategory(ItemCatCombo, SubCatCombo, SpecCatCombo); } BalloonKingdomDataSetTableAdapters.InventoryTableAdapter updateInv = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter(); updateInv.UpdateInventoryRecord(ItemCatCombo, SubCatCombo, SpecCatCombo, AdItemNametxt, AdType, AdSizeStand, InvUnitcombo, AdColorExist, Convert.ToDecimal(AdCusWidtxt), Convert.ToDecimal(AdInvHeighttxt), AdSuppExist, Convert.ToInt32(InvItemIDtxt), Convert.ToInt32(InvItemIDtxt)); BalloonKingdomDataSetTableAdapters.ItemTableAdapter updateItem = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.ItemTableAdapter(); updateItem.UpdateCartItems(ItemCatCombo, SubCatCombo, SpecCatCombo, AdItemNametxt, AdSuppExist, Convert.ToDecimal(AdCusWidtxt), Convert.ToDecimal(AdInvHeighttxt), AdSizeStand, AdColorExist, AdType, InvUnitcombo, Convert.ToInt32(InvItemIDtxt)); MessageBox.Show("Record has been successfully updated.", "Update Information", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
private void okbtn_Click(object sender, EventArgs e) { if (donebytxt.Text.Trim() == "" || reasontxt.Text.Trim() == "") { MessageBox.Show("Cannot process this transaction. Please write fill up the given field.", "Transaction Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); SyspassTxt.Text = ""; } else if (SyspassTxt.Text != password) { MessageBox.Show("Cannot process this transaction. Make sure that your password is correct!.", "Transaction Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); SyspassTxt.Text = ""; SyspassTxt.Focus(); } else { BalloonKingdomDataSetTableAdapters.Inventory_TransactionsTableAdapter addDupItem = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Inventory_TransactionsTableAdapter(); addDupItem.AddnewInventoryTrans(Convert.ToInt32(IDtxt.Text), ItemNmetxt.Text, "Adding", Convert.ToInt32(qtytxt.Text), DateTime.Now, donebytxt.Text.Trim(), reasontxt.Text.Trim()); BalloonKingdomDataSetTableAdapters.InventoryTableAdapter addnewitem = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter(); addnewitem.AddNewInventoryRec(iid, icat, isub, ispec, iname, itype, isize, iqty, iunit, Convert.ToDecimal(iunitprice), Convert.ToDecimal(isellingprice), Convert.ToDecimal(istock), istatus, icolor, Convert.ToDecimal(iwidth), Convert.ToDecimal(iheight), isup); MessageBox.Show("New Item has been added!", "Inventory Information", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }
private void okbtn_Click(object sender, EventArgs e) { if (donebytxt.Text.Trim() == "") { MessageBox.Show("Cannot process this transaction. Please write your name in the given field.", "Transaction Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (SyspassTxt.Text != syspass) { MessageBox.Show("Cannot process this transaction. Make sure that your password is correct!.", "Transaction Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); SyspassTxt.Text = ""; } else { int InvQty = 0; double stockQty = 0, total = 0, totalstock = 0; double UP = 0; string status; SqlCommand cmd25 = new SqlCommand("Select * from Inventory where [Item ID]=" + "'" + Convert.ToString(IDtxt.Text) + "'", conn); SqlDataReader dr25 = cmd25.ExecuteReader(); while (dr25.Read()) { InvQty = Convert.ToInt32(dr25["Quantity"].ToString()); stockQty = Convert.ToDouble(dr25["Quantity in Stock"].ToString()); UP = Convert.ToDouble(dr25["Unit Price"].ToString()); } dr25.Close(); total = Convert.ToDouble(InvQty) + Convert.ToDouble(qtytxt.Text.Trim()); totalstock = stockQty + Convert.ToDouble(qtytxt.Text.Trim()); if (total != 0) { status = "available"; } else { status = "unavailable"; } BalloonKingdomDataSetTableAdapters.InventoryTableAdapter updateDuplicateItem = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter(); updateDuplicateItem.UpdateDuplicateItem(Convert.ToInt32(total), Convert.ToInt32(totalstock), status, Convert.ToInt32(IDtxt.Text), Convert.ToInt32(IDtxt.Text)); MessageBox.Show("Duplicate Item has been updated!", "Inventory Information", MessageBoxButtons.OK, MessageBoxIcon.Information); BalloonKingdomDataSetTableAdapters.Inventory_TransactionsTableAdapter addDupItem = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Inventory_TransactionsTableAdapter(); addDupItem.AddnewInventoryTrans(Convert.ToInt32(IDtxt.Text), ItemNmetxt.Text, "Adding", Convert.ToInt32(qtytxt.Text), DateTime.UtcNow, donebytxt.Text.Trim(), "Add Quantity to Duplicate Item"); updateDuplicateItem.UpdateDuplicateItem(Convert.ToInt32(total), Convert.ToInt32(totalstock), status, Convert.ToInt32(IDtxt.Text), Convert.ToInt32(IDtxt.Text)); this.Close(); } }
private void LostViewbtn_Click(object sender, EventArgs e) { if (LostViewrbtn.Checked == true) { LostQtytxt.Clear(); LostItemtxt.Clear(); LostQtytxt.Enabled = false; LostItemtxt.Enabled = false; BalloonKingdomDataSetTableAdapters.InventoryTableAdapter lost = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter(); DataTable datatable = lost.ViewLostQty(); Lost_Item rpt = new Lost_Item(); Lost lostit = new Lost(); lostit.SetDataSource(datatable); rpt.AssignLost(lostit); rpt.Show(); } else if (LostQtyrbtn.Checked == true) { if (LostQtytxt.Text != "") { int a = Convert.ToInt32(LostQtytxt.Text); BalloonKingdomDataSetTableAdapters.Rented_ItemsTableAdapter los = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Rented_ItemsTableAdapter(); DataTable datatable = los.LostCOF(a); Lost_Item rpt = new Lost_Item(); LostCOFNo loss = new LostCOFNo(); loss.SetDataSource(datatable); rpt.AssignCOF(loss); rpt.Show(); } else { MessageBox.Show("Please enter COF Number", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { if (LostItemtxt.Text != "") { int a = Convert.ToInt32(LostItemtxt.Text); BalloonKingdomDataSetTableAdapters.InventoryTableAdapter lostitem = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter(); DataTable datatable = lostitem.Itemid(a); Lost_Item rpt = new Lost_Item(); Lost losts = new Lost(); losts.SetDataSource(datatable); rpt.AssignLost(losts); rpt.Show(); } else { MessageBox.Show("Please enter Item ID", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void InvViewbtn_Click(object sender, EventArgs e) { if (ItemIDbtn.Checked == true) { if (InvFrmtxt.Text != "" && InvUptxt.Text == "") { MessageBox.Show("Enter up to item id first", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (InvFrmtxt.Text == "" && InvUptxt.Text != "") { MessageBox.Show("Enter from item id first", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (InvFrmtxt.Text == "" && InvUptxt.Text == "") { MessageBox.Show("Enter from and up to item id first", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { int a = Convert.ToInt32(InvFrmtxt.Text); int b = Convert.ToInt32(InvUptxt.Text); BalloonKingdomDataSetTableAdapters.InventoryTableAdapter begin = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter(); DataTable datatable = begin.InvBeginEnd(a, b); Inventory_Masterlist rpt = new Inventory_Masterlist(); InventoryID invrpt = new InventoryID(); invrpt.SetDataSource(datatable); rpt.AssignInvReport(invrpt); rpt.Show(); } } else if (Itemnmebtn.Checked == true) { BalloonKingdomDataSetTableAdapters.InventoryTableAdapter inv2 = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter(); DataTable datatable = inv2.GetAllInventoryRec(); Inventory_Masterlist rpt = new Inventory_Masterlist(); ItemName invname = new ItemName(); invname.SetDataSource(datatable); rpt.AssignInvname(invname); rpt.Show(); } else { BalloonKingdomDataSetTableAdapters.InventoryTableAdapter inv2 = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter(); DataTable datatable = inv2.GetAllInventoryRec(); Inventory_Masterlist rpt = new Inventory_Masterlist(); ItemStatus invstat = new ItemStatus(); invstat.SetDataSource(datatable); rpt.AssignInvStat(invstat); rpt.Show(); } }
private void okbtn_Click(object sender, EventArgs e) { if (donebytxt.Text.Trim() == "" || reasontxt.Text.Trim() == "" || qtytxt.Text.Trim() == "") { MessageBox.Show("Cannot process this transaction. Please write fill up the given field.", "Transaction Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Syspasstxt.Text = ""; } else if (Syspasstxt.Text != password) { MessageBox.Show("Cannot process this transaction. Make sure that your password is correct!.", "Transaction Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); Syspasstxt.Text = ""; Syspasstxt.Focus(); } else { string trans; if (addbtn.Checked == true) { trans = "Adding"; } else { trans = "Subtracting"; } int quantity = Convert.ToInt32(qtytxt.Text.Trim()); double qty = 0, stock = 0, bo = 0; SqlCommand getinv = new SqlCommand("Select * from Inventory where [Item ID]=" + "'" + idlbl.Text.Trim() + "'", conn); SqlDataReader drget = getinv.ExecuteReader(); while (drget.Read()) { qty = Convert.ToDouble(drget["Quantity"].ToString()); stock = Convert.ToDouble(drget["Quantity in Stock"].ToString()); bo = Convert.ToDouble(drget["Back Order"].ToString()); } drget.Close(); if (addbtn.Checked == true) { qty += quantity; stock += Convert.ToDouble(quantity); bo -= Convert.ToDouble(quantity); if (bo < 0) { bo = 0; } } else { qty -= quantity; stock -= Convert.ToDouble(quantity); if (stock == 0) { stock = 0; bo += Convert.ToDouble(quantity); } } BalloonKingdomDataSetTableAdapters.Inventory_TransactionsTableAdapter addInvItem = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.Inventory_TransactionsTableAdapter(); addInvItem.AddnewInventoryTrans(Convert.ToInt32(idlbl.Text), txtname.Text, trans, Convert.ToInt32(qtytxt.Text), DateTime.Now, donebytxt.Text.Trim(), reasontxt.Text.Trim()); BalloonKingdomDataSetTableAdapters.InventoryTableAdapter update = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.InventoryTableAdapter(); update.UpdateInvQuantity(Convert.ToInt32(qty), Convert.ToDecimal(stock), Convert.ToInt32(bo), Convert.ToInt32(idlbl.Text.Trim()), Convert.ToInt32(idlbl.Text.Trim())); MessageBox.Show("Successfully updated Inventory Item Quantity", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }