private void button2_Click(object sender, EventArgs e) { List <SMLIB.Entity.Store> s = StoreRepo.retrieve(); initStore(s); clearAll(); }
private void btnCategoryAdd_Click(object sender, EventArgs e) { try { if (txtStoreName.Text != "") { double num; bool b = double.TryParse(txtContactNumber.Text, out num); if (b) { StoreRepo.insert(Guid.NewGuid(), txtStoreName.Text, txtAddress.Text, num); List <SMLIB.Entity.Store> s = StoreRepo.retrieve(); initStore(s); MessageBox.Show("Store inserted."); clearAll(); } else { MessageBox.Show("Invalid contact number."); } } else { MessageBox.Show("Store name can not be empty."); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + "Please contact your software provider."); } }
public Store(ComboBox cmbStore) { InitializeComponent(); this.cmbStore = cmbStore; List <SMLIB.Entity.Store> s = StoreRepo.retrieve(); initStore(s); }
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) { if (this.cmbStore != null) { this.cmbStore.Items.Clear(); List <SMLIB.Entity.Store> store = StoreRepo.retrieve(); for (int i = 0; i < store.Count; i++) { if (store.Count > 0) { this.cmbStore.Items.Add(store[i].StoreName); } } } 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) { StoreRepo.delete(this.id); List <SMLIB.Entity.Store> s = StoreRepo.retrieve(); initStore(s); btnCategoryDelete.Enabled = false; btnCategoryUpdate.Enabled = false; btnCategoryAdd.Enabled = true; MessageBox.Show("Store has been deleted."); clearAll(); } } catch (Exception) { MessageBox.Show("Please select an item to delete."); } }
private void btnCategoryUpdate_Click(object sender, EventArgs e) { int index = 0; try { index = lvStore.SelectedIndices[0]; if (txtStoreName.Text != "") { bool b = StoreRepo.checkIfStoreExists(txtStoreName.Text); if (b) { MessageBox.Show("This store name already exists, \n do you wish to proceed?."); double num = 0; bool c = double.TryParse(txtContactNumber.Text, out num); if (c) { StoreRepo.update(this.id, txtStoreName.Text, txtAddress.Text, num); btnCategoryAdd.Enabled = true; btnCategoryDelete.Enabled = false; btnCategoryUpdate.Enabled = false; List <SMLIB.Entity.Store> s = StoreRepo.retrieve(); initStore(s); MessageBox.Show("Update successful."); clearAll(); } else { MessageBox.Show("Invalid contact number."); } } else { double num = 0; bool c = double.TryParse(txtContactNumber.Text, out num); if (c) { StoreRepo.update(this.id, txtStoreName.Text, txtAddress.Text, num); btnCategoryAdd.Enabled = true; btnCategoryDelete.Enabled = false; btnCategoryUpdate.Enabled = false; List <SMLIB.Entity.Store> s = StoreRepo.retrieve(); initStore(s); MessageBox.Show("Update successful."); clearAll(); } else { MessageBox.Show("Invalid contact number."); } } } else { MessageBox.Show("Update value can not be empty."); } } catch (Exception) { MessageBox.Show("Please select an item to update"); } }
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); } } }