Exemplo n.º 1
0
        public void display_inventory_data()
        {
            inventory = new classes.Inventory();

            string search = cbSearchBy.Text;

            switch (search)
            {
            case "Item":
                inventory_table = inventory.select_inventory_table("b.item_name", txtSearch.Text);
                break;

            case "Brand":
                inventory_table = inventory.select_inventory_table("b.brand", txtSearch.Text);
                break;

            case "Model":
                inventory_table = inventory.select_inventory_table("b.model", txtSearch.Text);
                break;

            case "Department":
                inventory_table = inventory.select_inventory_table("d.department_name", txtSearch.Text);
                break;

            case "Propery Number":
                inventory_table = inventory.select_inventory_table("a.property_number", txtSearch.Text);
                break;

            case "--Search by--":
                inventory_table = inventory.select_inventory_table();
                break;

            default:
                inventory_table = inventory.select_inventory_table();
                break;
            }

            dgvInventory.DataSource          = inventory_table;
            dgvInventory.AutoGenerateColumns = false;

            if (dgvInventory.Columns.Contains("action") && dgvInventory.Columns["action"].Visible)
            {
            }
            else
            {
                DataGridViewButtonColumn button = new DataGridViewButtonColumn();
                {
                    button.Name       = "action";
                    button.HeaderText = "ACTION";
                    button.Text       = "VIEW ITEM";
                    button.UseColumnTextForButtonValue = true;
                    this.dgvInventory.Columns.Add(button);
                }
            }
        }
Exemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Are you sure you want to delete this item?", "Inventory", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (res == System.Windows.Forms.DialogResult.Yes)
            {
                inventory = new classes.Inventory();
                if (inventory.delete_inventory(this.inventory_id))
                {
                    MessageBox.Show("Item has been deleted!", "Inventory", MessageBoxButtons.OK, MessageBoxIcon.Question);
                    this.Close();
                }
            }
        }
Exemplo n.º 3
0
        public void display_selected_inventory(int inventory_id)
        {
            this.inventory_id        = inventory_id;
            inventory                = new classes.Inventory();
            selected_inventory_table = inventory.select_selected_inventory(inventory_id);

            foreach (DataRow row in selected_inventory_table.Rows)
            {
                category_id           = Convert.ToInt32(row["category_id"]);
                supplier_id           = Convert.ToInt32(row["supplier_id"]);
                department_id         = Convert.ToInt32(row["department_id"]);
                productinformation_id = Convert.ToInt32(row["productinformation_id"]);
                acquired_at           = Convert.ToDateTime(row["acquired_at"]);
                status          = row["status"].ToString();
                property_number = row["property_number"].ToString();

                inventory_type = row["type_name"].ToString();
                category_name  = row["category_name"].ToString();

                business_type_id = Convert.ToInt32(row["business_type_id"]);
                supplier_name    = row["supplier_name"].ToString();

                department_name = row["department_name"].ToString();

                item_name     = row["item_name"].ToString();
                description   = row["description"].ToString();
                brand         = row["brand"].ToString();
                model         = row["model"].ToString();
                serial_number = row["serial_number"].ToString();
                capacity_id   = (row["capacity_id"] == DBNull.Value) ? 0 : Convert.ToInt32(row["capacity_id"]);
                stocks_id     = Convert.ToInt32(row["stocks_id"]);
                expire_at     = (row["expire_at"] == DBNull.Value) ? DateTime.MinValue : Convert.ToDateTime(row["expire_at"]);

                business_type = row["business_type"].ToString();

                quantity            = Convert.ToInt32(row["quantity"]);
                unit_of_measurement = row["unit"].ToString();
                capacity            = (row["capacity"] == DBNull.Value) ? 0 : Convert.ToInt32(row["capacity"]);
                capacity_size       = (row["size"] == DBNull.Value) ? "" : row["size"].ToString();
            }

            set_preview();
        }
Exemplo n.º 4
0
        public void display_inventory_information()
        {
            inventory = new classes.Inventory();
            var result = inventory.select_inventory_count();

            total     = result.Item1;
            working   = result.Item2;
            defective = result.Item3;
            condemned = result.Item4;

            inventory_department_table   = inventory.select_inventory_per_department();
            inventory_report_count_table = inventory.select_inventory_report_count();

            display_inventory_count();
            display_inventory_per_department();
            display_inventory_report_count();
            display_ipd_chart();
            display_irc_chart();
        }
Exemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(quantity.ToString() + " " + unit_of_measurement);

            classes.Inventory_Stocks stocks = new classes.Inventory_Stocks();
            stocks.quantity            = quantity;
            stocks.unit_of_measurement = unit_of_measurement;

            if (stocks.create_stocks())
            {
                if (hasCapacity == true)
                {
                    classes.Inventory_Capacity cp = new classes.Inventory_Capacity();
                    cp.capacity      = capacity;
                    cp.capacity_size = capacity_size;
                    cp.create_capacity();
                }

                classes.Inventory_ProductInformation pi = new classes.Inventory_ProductInformation();
                pi.inventory_type = inventory_type;
                pi.item_name      = item_name;
                pi.description    = description;
                pi.brand          = brand;
                pi.model          = model;
                pi.serial_number  = serial_number;
                pi.hasCapacity    = hasCapacity;
                pi.expire_at      = date_expired;

                if (pi.create_product_information())
                {
                    classes.Inventory inv = new classes.Inventory();
                    inv.category_id     = category_id;
                    inv.category_name   = category_name;
                    inv.supplier_id     = supplier_id;
                    inv.supplier_name   = supplier_name;
                    inv.property_number = property_number;
                    inv.department_id   = department_id;
                    inv.department_name = department_name;
                    inv.status          = status;
                    inv.date_acquired   = date_acquired;

                    if (inv.create_inventory())
                    {
                        MessageBox.Show(item_name + " has been added", "Inventory", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        admin.inv.ucInventory.instance.display_inventory_data();
                        ((Form)this.TopLevelControl).Close();
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }
        }