コード例 #1
0
ファイル: Products.cs プロジェクト: jennifermlimon/easystem
        // Método que carga campos

        private void Products_Load(object sender, EventArgs e)
        {
            RefreshDataGridView();
            IEnumerable <DataAccess.Entities.Subcategory> subcategories = BusinessSubcategory.GetAllSubcategories().ToList();

            comboInsertSubcategory.DataSource    = subcategories;
            comboInsertSubcategory.DisplayMember = "SubcategoryName";
            comboInsertSubcategory.ValueMember   = "SubcategoryId";
        }
コード例 #2
0
        //Método para Refrescar la información de la tabla

        private void RefreshDataGridView()
        {
            List <Subcategory> subcategories = BusinessSubcategory.GetAllSubcategories().ToList();

            this.dtgridSubcatgory.DataSource = subcategories;
            for (int i = 0; i < dtgridSubcatgory.Rows.Count; i++)
            {
                dtgridSubcatgory.Rows[i].Cells["Category"].Value = subcategories[i].Category.CategoryName;
            }

            DisabledFields();
        }
コード例 #3
0
        // Método para buscar subcategoría

        private void SearchSucategory(object sender, EventArgs e)
        {
            this.dtgridSubcatgory.DataSource = BusinessSubcategory.SearchSubcategory(this.txtSubcatgorySearch.Text);
            List <Subcategory> subcategories = BusinessSubcategory.GetAllSubcategories().ToList();

            foreach (DataGridViewRow item in dtgridSubcatgory.Rows)
            {
                foreach (var subitem in subcategories)
                {
                    item.Cells["Category"].Value = subitem.Category.CategoryName;
                }
            }
        }
コード例 #4
0
ファイル: Products.cs プロジェクト: jennifermlimon/easystem
        // Método que hace los campos editables

        private void ClickProduct(object sender, DataGridViewCellEventArgs e)
        {
            EnabledFields();
            IEnumerable <DataAccess.Entities.Subcategory> subcategories = BusinessSubcategory.GetAllSubcategories().ToList();

            comboProduct.DataSource    = subcategories;
            comboProduct.DisplayMember = "SubcategoryName";
            comboProduct.ValueMember   = "SubcategoryId";
            var rows = this.dtgridProduct.CurrentRow;

            if (rows != null)
            {
                this.txtProductName.Text        = rows.Cells["ProductName"].Value.ToString();;
                this.txtProductDescripcion.Text = rows.Cells["ProductDescription"].Value.ToString();;
                this.lbId.Text              = rows.Cells["ProductId"].Value.ToString();
                this.txtEarns.Text          = rows.Cells["Earns"].Value.ToString();
                this.txtPrecioProducto.Text = rows.Cells["Price"].Value.ToString();
                this.comboProduct.Text      = rows.Cells["SubcategoryName"].Value.ToString();
            }
            else
            {
                MessageBox.Show("Selecciona una fila");
            }
        }