コード例 #1
0
        private void Form_Category_Load(object sender, EventArgs e)
        {
            List <Categories_DATA> category = new List <Categories_DATA>();

            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 category)
            {
                table.Rows.Add(item.Id, number, item.Description);
                number++;
                count_ALL_items++;
            }


            dataGridView1.DataSource = table;
            bmb = BindingContext[table];
            dataGridView1.Columns[0].Visible = false;
        }
コード例 #2
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;
        }
コード例 #3
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;
        }
コード例 #4
0
        private void Form_ADD_Product_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'product_DBDataSet.CATEGORIES' table. You can move, or remove it, as needed.
            //this.cATEGORIESTableAdapter.Fill(this.product_DBDataSet.CATEGORIES);
            List <Categories_DATA> category_list = Categories_BLL.Select_ALL_Categories();

            this.comboBox1.DataSource = category_list;

            this.comboBox1.ValueMember   = "Id";
            this.comboBox1.DisplayMember = "Description";
            //comboBox1.DataBindings;

            //this.comboBox1.ValueMember = "Id";
            //this.comboBox1.DisplayMember = "Description";
        }
コード例 #5
0
        private void form_UPDATE_PRODUCT_Load(object sender, EventArgs e)
        {
            List <Categories_DATA> category_list = Categories_BLL.Select_ALL_Categories();

            this.comboBox1.DataSource    = category_list;
            this.comboBox1.ValueMember   = "Id";
            this.comboBox1.DisplayMember = "Description";
            Id = product.Id;
            comboBox1.SelectedValue = product.Category.Id;
            description.Text        = product.Label_product;
            quantity.Text           = product.Qte_in_product;
            price.Text = product.Price;
            MemoryStream ms = new MemoryStream(product.Image);

            pictureBox1.Image = Image.FromStream(ms);
        }
コード例 #6
0
        private void Form_category_list_Load(object sender, EventArgs e)
        {
            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(number, item.Id, item.Description);
                number++;
            }
            CrystalReport_category s = new CrystalReport_category();

            s.SetDataSource(table);
            crystalReportViewer1.ReportSource = s;
        }