Example #1
0
        public void display_category()
        {
            flpCategory.Controls.Clear();

            inventory_category = new classes.Inventory_Category();
            inventory_category.inventory_type = inventory_type;
            DataTable dt = (txtSearch.Text == "Search" || string.IsNullOrEmpty(txtSearch.Text)) ? inventory_category.select_category() :
                           inventory_category.select_category(txtSearch.Text);

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    button                  = new Guna.UI2.WinForms.Guna2TileButton();
                    button.Name             = row["id"].ToString();
                    button.Text             = row["category_name"].ToString();
                    button.Image            = (row["icon"] == null) ? null : Image.FromStream(new MemoryStream((Byte[])row["icon"]));
                    button.HoverState.Image = (row["icon"] == null) ? null : Image.FromStream(new MemoryStream((Byte[])row["icon"]));
                    button.ImageSize        = new Size(30, 30);
                    button.BorderColor      = Color.FromArgb(47, 97, 72);
                    button.BorderRadius     = 5;
                    button.BorderStyle      = System.Drawing.Drawing2D.DashStyle.Solid;
                    button.BorderThickness  = 1;
                    button.Font             = new Font("Century Gothic", 9, FontStyle.Regular);
                    button.ForeColor        = Color.Black;
                    button.BackColor        = Color.White;
                    button.FillColor        = Color.White;
                    button.Size             = new Size(100, 113);
                    button.Click           += new EventHandler(this.button_Click);

                    flpCategory.Controls.Add(button);
                }
            }
        }
Example #2
0
        public void display_selected_category()
        {
            category = new classes.Inventory_Category();

            cbCategory.DataSource    = category.select_category_except_this(inventory_type, category_id);
            cbCategory.DisplayMember = "category_name";
            cbCategory.ValueMember   = "id";

            txtCurrentCategory.Text  = category_name;
            cbCategory.SelectedIndex = cbCategory.FindStringExact(category_name);
        }
Example #3
0
 private void update_category(int new_category_id)
 {
     category = new classes.Inventory_Category();
     if (category.update_inventory_category(inventory_id, new_category_id))
     {
         MessageBox.Show("Category has been updated!", "Update Category", MessageBoxButtons.OK, MessageBoxIcon.Question);
         frmViewItem.instance.display_selected_inventory(inventory_id);
         this.Close();
     }
     else
     {
         return;
     }
 }
Example #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            hasError = false;
            if (request_from == "Inventory")
            {
                if (cbInventoryType.SelectedIndex == 0 || cbInventoryType.SelectedIndex == -1)
                {
                    hasError = true;
                    MessageBox.Show("Please select the inventory type.", "Add Category", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    cbInventoryType.Focus();
                    return;
                }
                else
                {
                    inventory_type = cbInventoryType.Text;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(txtCategoryName.Text) || txtCategoryName.Text == "Category Name")
                {
                    hasError = true;
                    MessageBox.Show("Please indicate the category name.", "Add Category", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtCategoryName.Text = "";
                    txtCategoryName.Focus();
                    return;
                }
            }

            if (hasError == true)
            {
                return;
            }
            else
            {
                if (new classes.Configuration().CheckIfExist("category_name", "Inventory_Category", txtCategoryName.Text))
                {
                    MessageBox.Show(txtCategoryName.Text + " is already exist", "Add Category", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtCategoryName.Text = "";
                    txtCategoryName.Focus();
                    return;
                }
                else
                {
                    inventory_category = new classes.Inventory_Category();
                    inventory_category.inventory_type = txtInventoryType.Text;
                    inventory_category.category_name  = txtCategoryName.Text;
                    inventory_category.icon           = classes.Configuration.ConvertScreenCaptureToByte(pbPreview.Image);
                    if (inventory_category.create_category())
                    {
                        if (request_from == "Add Item")
                        {
                            MessageBox.Show(txtCategoryName.Text + " has been added", "Add Category", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            includes.uc.frmDashboard.admin.inv.add_item.ucSelectCategory.instance.display_category();
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show(txtCategoryName.Text + " has been added", "Add Category", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            includes.uc.frmDashboard.admin.inv.ucCategories.instance.display_category();
                            this.Close();
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }