private void btnCategoryAdd_Click(object sender, EventArgs e)
 {
     if (txtName.Text != "")
     {
         double num;
         bool   b = double.TryParse(txtNumber.Text, out num);
         if (b)
         {
             bool c = WarehouseRepo.checkIfWarehouseExists(txtName.Text);
             if (c)
             {
                 MessageBox.Show("Warehouse already exists.");
             }
             else
             {
                 WarehouseRepo.create(Guid.NewGuid(), txtName.Text, txtAddress.Text, num, txtSubLocation.Text);
                 MessageBox.Show("Warehouse has been inserted.");
                 List <SMLIB.Entity.Warehouse> warehouse = WarehouseRepo.retrieve();
                 fillListView(warehouse);
                 clearAll();
             }
         }
         else
         {
             MessageBox.Show("Invalid contact number.");
         }
     }
     else
     {
         MessageBox.Show("Please input the warehouse name.");
     }
 }
        private void button2_Click(object sender, EventArgs e)
        {
            List <SMLIB.Entity.Warehouse> warehouse = WarehouseRepo.retrieve();

            fillListView(warehouse);
            clearAll();
        }
Esempio n. 3
0
        public void SetUp()
        {
            _repo             = new WarehouseRepo();
            _systemUnderTests = new WarehouseRepoFiller(_repo);

            InitializeFixtures();
            PopulateWarehouseDtoCollection();
        }
        public void SetUp()
        {
            _systemUnderTests = new WarehouseRepo();

            _warehouseWithNoItems1 = new Warehouse()
            {
                Name = _fixture.Create <string>()
            };

            _warehouseWithNoItems2 = new Warehouse()
            {
                Name = _fixture.Create <string>()
            };
        }
Esempio n. 5
0
 private void AddProduct_Load(object sender, EventArgs e)
 {
     try
     {
         Guid categoryId = CategoryRepo.getCategoryId(cmbCategory.Text);
         if (categoryId != null)
         {
             this.CategoryId = categoryId;
         }
         Guid SubcategoryId = SubCategoryRepo.getSubCategoryId(cmbSubCategory.Text);
         if (SubcategoryId != null)
         {
             this.subcategory = SubcategoryId;
         }
         Guid SupplierId = SupplierRepo.getSupplierId(cmbSupplier.Text);
         if (SupplierId != null)
         {
             this.supplier = SupplierId;
         }
         Guid WarehouseId = WarehouseRepo.getWarehouseId(cmbWarehouse.Text);
         if (WarehouseId != null)
         {
             this.warehouse = WarehouseId;
         }
         Guid statusId = StatusRepo.getStatusId(cmbStatus.Text);
         if (statusId != null)
         {
             this.status = statusId;
         }
         Guid StoreId = StoreRepo.getStoreId(cmbStore.Text);
         if (StoreId != null)
         {
             this.store = StoreId;
         }
         Guid id = UnitOfMeasurementRepo.retrieveId(cmbUnitOfMeasurement.Text);
         if (id != null)
         {
             this.unitOfMeasurementId = id;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void btnCategoryUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         bool b = WarehouseRepo.checkIfWarehouseExists(txtName.Text);
         if (b)
         {
             MessageBox.Show("Warehouse name already exists, please try again.");
         }
         else
         {
             double number;
             bool   c = double.TryParse(txtNumber.Text, out number);
             if (c)
             {
                 if (txtName.Text != "")
                 {
                     WarehouseRepo.update(this.id, txtName.Text, txtAddress.Text, number, txtSubLocation.Text);
                     MessageBox.Show("Warehouse has been updated.");
                     List <SMLIB.Entity.Warehouse> warehouse = WarehouseRepo.retrieve();
                     fillListView(warehouse);
                     clearAll();
                     btnCategoryUpdate.Enabled = false;
                     btnCategoryDelete.Enabled = false;
                     btnCategoryAdd.Enabled    = true;
                 }
                 else
                 {
                     MessageBox.Show("Warehouse name can not be empty.");
                 }
             }
             else
             {
                 MessageBox.Show("Invalid contact number.");
             }
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Please select an item to update.");
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtCategorySearch.Text != "")
     {
         List <SMLIB.Entity.Warehouse> warehouse = WarehouseRepo.retrieveByName(txtCategorySearch.Text);
         if (warehouse.Count > 0)
         {
             fillListView(warehouse);
             clearAll();
         }
         else
         {
             MessageBox.Show("Item not found.");
         }
     }
     else
     {
         MessageBox.Show("Search item can not be empty, please try again.");
     }
 }
        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.Warehouse> warehouse = WarehouseRepo.retrieve();
                if (warehouse.Count > 0)
                {
                    if (this.cmbWarehouse != null)
                    {
                        this.cmbWarehouse.Items.Clear();
                        foreach (var item in warehouse)
                        {
                            this.cmbWarehouse.Items.Add(item.WarehouseName);
                        }
                    }
                }
                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)
         {
             WarehouseRepo.delete(this.id);
             MessageBox.Show("Warehouse has been deleted.");
             List <SMLIB.Entity.Warehouse> warehouse = WarehouseRepo.retrieve();
             fillListView(warehouse);
             clearAll();
             btnCategoryDelete.Enabled = false;
             btnCategoryUpdate.Enabled = false;
             btnCategoryAdd.Enabled    = true;
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Please select an item to delete.");
     }
 }
        private void Warehouse_Load(object sender, EventArgs e)
        {
            List <SMLIB.Entity.Warehouse> warehouse = WarehouseRepo.retrieve();

            fillListView(warehouse);
        }
Esempio n. 11
0
 private void cmbWarehouse_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.warehouse = WarehouseRepo.getWarehouseId(cmbWarehouse.Text);
 }
Esempio n. 12
0
        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);
                }
            }
        }
Esempio n. 13
0
 public WarehouseManager()
 {
     _warehouseRepo = new WarehouseRepo();
 }