private void btnCategoryUpdate_Click(object sender, EventArgs e) { try { if (txtStatus.Text != "") { bool d = StatusRepo.checkIfStatusExists(txtStatus.Text); if (d) { MessageBox.Show("This status already exists"); } else { StatusRepo.update(this.id, txtStatus.Text); MessageBox.Show("Status has been updated."); List <SMLIB.Entity.Status> statuses = StatusRepo.retrieve(); fillListView(statuses); btnCategoryDelete.Enabled = false; btnCategoryUpdate.Enabled = false; btnCategoryAdd.Enabled = true; clearAll(); } } else { MessageBox.Show("Status has been updated."); } } catch (Exception) { MessageBox.Show("Please select an item to update."); } }
private void Status_Load(object sender, EventArgs e) { List <SMLIB.Entity.Status> statuses = StatusRepo.retrieve(); fillListView(statuses); clearAll(); }
private void pictureBox1_Click(object sender, EventArgs e) { DialogResult d = MessageBox.Show("Are you sure you want to exit?", "Exit", MessageBoxButtons.YesNo); if (d == DialogResult.Yes) { List <SMLIB.Entity.Status> statuses = StatusRepo.retrieve(); if (statuses.Count > 0) { if (this.cmbStatus != null) { this.cmbStatus.Items.Clear(); foreach (var item in statuses) { this.cmbStatus.Items.Add(item.StatusValue); } } } this.Hide(); } }
private void btnCategoryDelete_Click(object sender, EventArgs e) { try { DialogResult d = MessageBox.Show("Are you sure you want to delete?", "Delete", MessageBoxButtons.YesNo); if (d == DialogResult.Yes) { StatusRepo.delete(this.id); MessageBox.Show("Status has been deleted."); List <SMLIB.Entity.Status> statuses = StatusRepo.retrieve(); fillListView(statuses); btnCategoryDelete.Enabled = false; btnCategoryUpdate.Enabled = false; btnCategoryAdd.Enabled = true; clearAll(); } } catch (Exception) { MessageBox.Show("Please select an item to delete."); } }
private void btnCategoryAdd_Click(object sender, EventArgs e) { if (txtStatus.Text != "") { bool b = StatusRepo.checkIfStatusExists(txtStatus.Text); if (b) { MessageBox.Show("This status value already exists, please try again."); } else { StatusRepo.insert(Guid.NewGuid(), txtStatus.Text); MessageBox.Show("Status inserted."); List <SMLIB.Entity.Status> statuses = StatusRepo.retrieve(); fillListView(statuses); clearAll(); } } else { MessageBox.Show("Status can not be empty."); } }
public void initCombo() { var unitOfMeasurement = UnitOfMeasurementRepo.retrieve(); if (unitOfMeasurement.Count > 0) { foreach (var item in unitOfMeasurement) { cmbUnitOfMeasurement.Items.Add(item.UnitOfMeasurementName.ToString()); } } var categories = CategoryRepo.retrieve(); if (categories.Count > 0) { foreach (var item in categories) { cmbCategory.Items.Add(item.CategoryValue); } } var subcategory = SubCategoryRepo.retrieve(); if (subcategory.Count > 0) { foreach (var item in subcategory) { cmbSubCategory.Items.Add(item.SubCategoryValue); } } var supplier = SupplierRepo.suppliers(); if (supplier.Count > 0) { foreach (var item in supplier) { cmbSupplier.Items.Add(item.SupplierName); } } var warehouse = WarehouseRepo.retrieve(); if (warehouse.Count > 0) { foreach (var item in warehouse) { cmbWarehouse.Items.Add(item.WarehouseName); } } var status = StatusRepo.retrieve(); if (status.Count > 0) { foreach (var item in status) { cmbStatus.Items.Add(item.StatusValue); } } List <SMLIB.Entity.ProductAttribute> attributes = ProductAttributeRepo.retrieve(); if (attributes.Count > 0) { foreach (var item in attributes) { cmbAttributes.Items.Add(item.AttributeName); } } var store = StoreRepo.retrieve(); if (store.Count > 0) { foreach (var item in store) { cmbStore.Items.Add(item.StoreName); } } }