private void addButton_Click(object sender, EventArgs e) { try { Item item = new Item(); item.CompanyId = Convert.ToInt32(companyCombo.SelectedValue); item.CompanyName = companyCombo.Text; item.Id = Convert.ToInt32(itemCombo.SelectedValue); item.Name = itemCombo.Text; item.Quantity = Convert.ToInt32(quantityBox.Value); _stockOutManager.AddItem(item); addItemDataGrid.Show(); sellButton.Show(); damageButton.Show(); lostButton.Show(); addItemDataGrid.DataSource = _stockOutManager.GetItemTable(); model.AddAutoIncrementColumn(addItemDataGrid); _stock.ItemId = Convert.ToInt32(itemCombo.SelectedValue); _stock.Quantity = Convert.ToInt32(quantityBox.Value); _stockOutManager.AddToList(_stock); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void saveCompanyButton_Click(object sender, EventArgs e) { Company company = new Company(); company.Name = companyNameTextBox.Text; try { if (saveCompanyButton.Text == "Save") { bool save = _companyManager.SaveData(company); if (save) { companyNameTextBox.Clear(); MessageBox.Show("Save successfully!"); companyBindingSource.DataSource = _companyManager.GetAllCompany(); _model.AddAutoIncrementColumn(companyGridView); } else { MessageBox.Show("Failed to save!"); } } if (saveCompanyButton.Text == "Update") { bool update = _companyManager.UpdateData(company, companyId, companyName); if (update) { companyNameTextBox.Clear(); MessageBox.Show("Update succesfully!"); saveCompanyButton.Text = "Save"; saveCompanyButton.BackColor = Color.ForestGreen; companyBindingSource.DataSource = _companyManager.GetAllCompany(); _model.AddAutoIncrementColumn(companyGridView); } else { MessageBox.Show("Failed to Update!"); } } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void saveCategoryButton_Click(object sender, EventArgs e) { Category category = new Category(); category.Name = catNameTextBox.Text; try { if (saveCategoryButton.Text == "Save") { bool save = _manager.SaveData(category); if (save) { catNameTextBox.Clear(); MessageBox.Show("Category save successfully!"); categoryGridView.DataSource = _manager.GetAllCategory(); _model.AddAutoIncrementColumn(categoryGridView); } else { MessageBox.Show("Failed to save!"); } } if (saveCategoryButton.Text == "Update") { bool update = _manager.UpdateData(category, catId, catName); if (update) { catNameTextBox.Clear(); MessageBox.Show("Update succesfully!"); saveCategoryButton.Text = "Save"; saveCategoryButton.BackColor = Color.ForestGreen; categoryGridView.DataSource = _manager.GetAllCategory(); _model.AddAutoIncrementColumn(categoryGridView); } } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void searchButton_Click(object sender, EventArgs e) { try { SellsDate date = new SellsDate(); date.From = fromDatePicker.Value; date.To = toDatePicker.Value; sellsItemDataGrid.DataSource = _search.GetSellsItem(date); model.AddAutoIncrementColumn(sellsItemDataGrid); sellsItemDataGrid.Show(); exportButton.Show(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void searchButton_Click(object sender, EventArgs e) { try { Item item = new Item(); item.CategoryId = Convert.ToInt32(categoryCombo.SelectedValue); item.CompanyId = Convert.ToInt32(companyCombo.SelectedValue); searchItemDataGrid.DataSource = _search.GetAllItem(item); model.AddAutoIncrementColumn(searchItemDataGrid); searchItemDataGrid.Show(); exportButton.Show(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }