private void button2_Click(object sender, EventArgs e)
        {
            List <SMLIB.Entity.Warehouse> warehouse = WarehouseRepo.retrieve();

            fillListView(warehouse);
            clearAll();
        }
 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 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 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);
        }
示例#7
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);
                }
            }
        }