Beispiel #1
0
        private void delete_Click(object sender, EventArgs e)
        {
            Categories_DATA category     = new Categories_DATA();
            DataGridViewRow selected_row = dataGridView1.SelectedRows[0];

            category.Id = Convert.ToInt16(selected_row.Cells[0].Value.ToString());
            Categories_BLL.Delete_Categories(category);



            List <Categories_DATA> list_category = new List <Categories_DATA>();

            list_category = Categories_BLL.Select_ALL_Categories();

            DataTable table = new DataTable();

            table.Columns.Add("Id");
            table.Columns.Add("number");
            table.Columns.Add("description");
            int number = 1;

            foreach (var item in list_category)
            {
                table.Rows.Add(item.Id, number, item.Description);
                number++;
                count_ALL_items++;
            }


            dataGridView1.DataSource = table;
            bmb = BindingContext[table];

            dataGridView1.Columns[0].Visible = false;
        }
Beispiel #2
0
        private void save_Click(object sender, EventArgs e)
        {
            save.Enabled = false;
            Add.Enabled  = true;
            Categories_DATA category = new Categories_DATA();

            category.Description = category_name.Text;
            Categories_BLL.Insert_Categories(category);


            List <Categories_DATA> list_category = new List <Categories_DATA>();

            list_category = Categories_BLL.Select_ALL_Categories();

            DataTable table = new DataTable();

            table.Columns.Add("Id");
            table.Columns.Add("number");
            table.Columns.Add("description");
            int number = 1;

            foreach (var item in list_category)
            {
                table.Rows.Add(item.Id, number, item.Description);
                number++;
                count_ALL_items++;
            }


            dataGridView1.DataSource = table;
            bmb          = BindingContext[table];
            bmb.Position = count_ALL_items;
            dataGridView1.Columns[0].Visible = false;
        }
Beispiel #3
0
        public static void Insert_Categories(Categories_DATA Category)
        {
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("DESCRPTION_CATEGORIES", Category.Description));

            DBL.execute_query("CATEGORIES_insert", parameters);
        }
Beispiel #4
0
        public static void Delete_Categories(Categories_DATA Category)
        {
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("ID_CATEGORIES", Category.Id));

            DBL.execute_query("CATEGORIES_delete", parameters);
        }
Beispiel #5
0
        public static Categories_DATA Select_Item_Categories(int Id)
        {
            Categories_DATA Category = new Categories_DATA();

            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("ID_CATEGORIES", Id));

            Category.Id          = Convert.ToInt16(DBL.get_DATA_row("CATEGORIES_select", parameters)["ID_CATEGORIES"]);
            Category.Description = DBL.get_DATA_row("CATEGORIES_select", parameters)["DESCRPTION_CATEGORIES"].ToString();
            return(Category);
        }
Beispiel #6
0
        private void button10_Click(object sender, EventArgs e)
        {
            Categories_DATA category     = new Categories_DATA();
            DataGridViewRow selected_row = dataGridView1.SelectedRows[0];

            category.Id          = Convert.ToInt16(selected_row.Cells[0].Value.ToString());
            category.Description = selected_row.Cells[2].Value.ToString();
            Form_item_category item = new Form_item_category(category);

            this.Hide();
            item.ShowDialog();
        }
Beispiel #7
0
        public static List <Categories_DATA> Select_ALL_Categories()
        {
            List <Categories_DATA> Categories = new List <Categories_DATA>();
            DataTable table = DBL.get_DATA("CATEGORIES_select_ALL");

            foreach (DataRow item in table.Rows)
            {
                Categories_DATA Category = new Categories_DATA();

                Category.Id          = Convert.ToInt16(item["ID_CATEGORIES"]);
                Category.Description = item["DESCRPTION_CATEGORIES"].ToString();
                Categories.Add(Category);
            }

            return(Categories);
        }
Beispiel #8
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView1.SelectedRows[0];
            Products_DATA   pro = new Products_DATA();

            pro.Id             = Convert.ToInt16(row.Cells[0].Value);
            pro.Label_product  = row.Cells[1].Value.ToString();
            pro.Qte_in_product = row.Cells[3].Value.ToString();
            pro.Price          = row.Cells[2].Value.ToString();
            Categories_DATA ctegory = new Categories_DATA();


            ctegory.Description = row.Cells[4].Value.ToString();
            ctegory.Id          = Convert.ToInt16(row.Cells[5].Value);
            pro.Category        = ctegory;
            orders_form.Product = pro;
            this.Close();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Products_DATA Product = new Products_DATA();

            Product.Label_product  = description.Text;
            Product.Qte_in_product = quantity.Text;
            Product.Price          = price.Text;
            MemoryStream memory = new MemoryStream();

            pictureBox1.Image.Save(memory, pictureBox1.Image.RawFormat);
            byte[] byte_image = memory.ToArray();
            Product.Image = byte_image;
            Product.Id    = Id;
            int             x = Convert.ToInt16(comboBox1.SelectedValue);
            Categories_DATA c = new Categories_DATA();

            c.Id             = x;
            Product.Category = c;
            Products_BLL.Update_Product(Product);



            DataTable            table = new DataTable();
            List <Products_DATA> list  = Products_DAL.Select_ALL_Product();

            table.Columns.Add("Id");
            table.Columns.Add("اسم المنتج");
            table.Columns.Add("سعر المنتج");
            table.Columns.Add("كمية المنتج");
            table.Columns.Add("نوع المنتج");
            table.Columns.Add("Category_ID");
            table.Columns.Add("image", typeof(byte[]));
            foreach (var item in list)
            {
                table.Rows.Add(item.Id, item.Label_product, item.Price, item.Qte_in_product, item.Category.Description, item.Category.Id, item.Image);
            }



            form_product.DataGridView1.DataSource         = table;
            form_product.DataGridView1.Columns[0].Visible = false;
            form_product.DataGridView1.Columns[5].Visible = false;
            form_product.DataGridView1.Columns[6].Visible = false;
        }
Beispiel #10
0
        private void button3_Click(object sender, EventArgs e)
        {
            DataGridViewRow x       = dataGridView1.SelectedRows[0];
            Products_DATA   product = new Products_DATA();

            product.Id             = Convert.ToInt16(x.Cells[0].Value);
            product.Label_product  = x.Cells[1].Value.ToString();
            product.Price          = x.Cells[3].Value.ToString();
            product.Qte_in_product = x.Cells[2].Value.ToString();

            Categories_DATA c = new Categories_DATA();

            c.Id             = Convert.ToInt16(x.Cells[5].Value);
            product.Category = c;
            form_UPDATE_PRODUCT form = new form_UPDATE_PRODUCT(this);

            product.Image = (byte[])x.Cells[6].Value;
            form.Product  = product;
            form.ShowDialog();
        }
        public static List <Products_DATA> Select_ALL_Product()
        {
            List <Products_DATA> Products = new List <Products_DATA>();

            DataTable table = DBL.get_DATA("PRODUCT_select_All");

            foreach (DataRow item in table.Rows)
            {
                Products_DATA Product = new Products_DATA();
                Product.Id             = Convert.ToInt16(item["ID_PRODUCT"]);
                Product.Image          = (byte[])item["IMAGE_PRODUCT"];
                Product.Label_product  = item["LABEL_PRODUCT"].ToString();
                Product.Price          = item["QTE_IN_PRODUCT"].ToString();
                Product.Qte_in_product = item["PRICE"].ToString();
                Categories_DATA c = new Categories_DATA();

                c.Id             = Convert.ToInt16(item["ID_CATEGORIES"]);
                Product.Category = c;
                Products.Add(Product);
            }
            return(Products);
        }
Beispiel #12
0
        private void button5_Click(object sender, EventArgs e)
        {
            DataGridViewRow x       = dataGridView1.SelectedRows[0];
            Products_DATA   product = new Products_DATA();

            product.Id             = Convert.ToInt16(x.Cells[0].Value);
            product.Label_product  = x.Cells[1].Value.ToString();
            product.Price          = x.Cells[3].Value.ToString();
            product.Qte_in_product = x.Cells[2].Value.ToString();

            Categories_DATA c = new Categories_DATA();

            c.Id             = Convert.ToInt16(x.Cells[5].Value);
            product.Category = c;
            Form_item_product report = new Form_item_product();

            product.Image  = (byte[])x.Cells[6].Value;
            report.Product = product;
            this.Hide();
            report.ShowDialog();

            this.Show();
        }
 public static void Upaate_Categories(Categories_DATA Category)
 {
     Categories_DAL.Upaate_Categories(Category);
 }
Beispiel #14
0
        public Form_item_category(Categories_DATA _category)
        {
            Category = _category;

            InitializeComponent();
        }
 public static Categories_DATA Select_Item_Categories(Categories_DATA Category)
 {
     return(DAL.Categories_DAL.Select_Item_Categories(Category.Id));
 }
 public static void Insert_Categories(Categories_DATA Category)
 {
     Categories_DAL.Insert_Categories(Category);
 }
 public static void Delete_Categories(Categories_DATA Category)
 {
     Categories_DAL.Delete_Categories(Category);
 }