private void itemComboBox_SelectedIndexChanged(object sender, EventArgs e) { SaveButton.Text = "Save"; item.Name = itemComboBox.Text; stockIN.ItemID = _stockInManager.GetItemId(item); item.ReorderLevel = _stockInManager.ReorderLevel(item); reorderLevelTextBox.Text = item.ReorderLevel.ToString(); item.AvailableQuantity = _stockInManager.availableQuantity(item); availableQuantityTextBox.Text = item.AvailableQuantity.ToString(); stockInDataGridView.DataSource = _stockInManager.ShowItems(item); CreateUnboundButtonColumn(); }
//*****************************************************************// private void SaveButton_Click(object sender, EventArgs e) { StockInClass stockIn = new StockInClass(); if (itemComboBox.SelectedItem == null) { MessageBox.Show("Plaease select an Item"); return; } if (categoryComboBox.SelectedItem == null) { MessageBox.Show("Plaease select an Category"); return; } if (companyComboBox.SelectedItem == null) { MessageBox.Show("Plaease select an Company"); return; } stockIn.ItemName = itemComboBox.Text; stockIn.ItemId = stockInManager.GetItemId(stockIn); stockIn.AvailableQuantity = Convert.ToInt32(availableQuantityLabel.Text); bool isTrue = stockInManager.Validation(quantityTextBox.Text); if (!isTrue) { MessageBox.Show("Please Enter a Valid Number!"); return; } stockIn.StockInQuantity = Convert.ToInt32(quantityTextBox.Text); stockIn.AvailableQuantity += stockIn.StockInQuantity; bool isAdded = stockInManager.Update(stockIn); if (isAdded) { MessageBox.Show("Stock In Succesful!"); quantityTextBox.Text = String.Empty; } else { MessageBox.Show("Stock In Failed!"); } categoryComboBox.Text = "------Select--------"; companyComboBox.Text = "------Select--------"; itemComboBox.Text = "------Select--------"; reorderLevelLabel.Text = String.Empty; availableQuantityLabel.Text = String.Empty; }