예제 #1
0
        //--------METODOS DE RECARGA DE DATOS DE LOS ATRIBUTOS----------------

        private void ReloadBrandsDataGridView()
        {
            brandModels = BrandManagement.SelectAllBrands();
            BrandDataGridView.MultiSelect = false;
            BrandDataGridView.DataSource  = brandModels;

            BrandDataGridView.Columns["Id_Brand"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            BrandDataGridView.Columns["Name"].AutoSizeMode     = DataGridViewAutoSizeColumnMode.Fill;
            BrandDataGridView.Columns["Id_Brand"].HeaderText   = "Id";
            BrandDataGridView.Columns["Name"].HeaderText       = "Nombre";

            BrandDataGridView.Columns["Id_Brand"].Visible = false;
        }
예제 #2
0
        private void UcProduct_Load(object sender, EventArgs e)
        {
            categoryModels    = CategoryManagement.SelectAllCategories();
            subCategoryModels = SubCategoryManagement.SelectAllSubCategories();


            dgvProduct.DataSource  = ProductManagement.SelectAllProducts();
            cmbBrand.DataSource    = BrandManagement.SelectAllBrands();
            cmbBrand.DisplayMember = "Name";

            WireUpCategoryComboBox();
            WireUpSubCategoryComboBox();
        }
예제 #3
0
        //Carga datos de inicio

        private void UcProduct_Load(object sender, EventArgs e)
        {
            ReloadProduct();

            brandModels = BrandManagement.SelectAllBrands();
            BrandComboBox.DataSource    = brandModels;
            BrandComboBox.DisplayMember = "Name";

            categoryModels = CategoryManagement.SelectAllCategories();
            CategoryComboBox.DataSource    = categoryModels;
            CategoryComboBox.DisplayMember = "Name";

            gravadoRadioButton.Checked = true;
        }
예제 #4
0
 private void FrmBrand_Load(object sender, EventArgs e)
 {
     try
     {
         if (BrandManagement.SelectAllBrands() != null)
         {
             brandModels = BrandManagement.SelectAllBrands();
             WireUpBrandsGridView();
             toolStripStatusLabel1.Text = "Los registros de la base de datos fueron cargados.";
         }
         else
         {
             toolStripStatusLabel1.Text = "No se encontraron registros en la base de datos.";
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
예제 #5
0
        private void deleteButton_Click(object sender, EventArgs e)
        {
            string id = idBrandTextBox.Text;

            try
            {
                if (BrandManagement.DeleteBrandById(id))
                {
                    Clear();
                    brandModels = BrandManagement.SelectAllBrands();
                    WireUpBrandsGridView();
                    toolStripStatusLabel1.Text = "Se eliminó la marca de manera correcta";
                }
                else
                {
                    toolStripStatusLabel1.Text = "Ha ocurrido un error al eliminar la marca, inténtelo nuevamente.";
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #6
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            string id    = idBrandTextBox.Text; //dgvBrand.CurrentRow.Cells[0].Value.ToString();
            string brand = brandNameTextBox.Text;

            try
            {
                if (BrandManagement.UpdateBrandById(id, brand))
                {
                    Clear();
                    brandModels = BrandManagement.SelectAllBrands();
                    WireUpBrandsGridView();
                    toolStripStatusLabel1.Text = "Se modificó la marca de manera correcta.";
                }
                else
                {
                    toolStripStatusLabel1.Text = "Ha ocurrido un error al modificar la marca, inténtelo nuevamente.";
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #7
0
        //---------CRUD---------//

        private void createButton_Click(object sender, EventArgs e)
        {
            string id    = idBrandTextBox.Text;
            string brand = brandNameTextBox.Text;

            try
            {
                if (BrandManagement.InsertBrand(brand))
                {
                    toolStripStatusLabel1.Text = "Se agregó la marca de manera correcta.";
                    Clear();
                    brandModels = BrandManagement.SelectAllBrands();
                    WireUpBrandsGridView();
                }
                else
                {
                    toolStripStatusLabel1.Text = "Ha ocurrido un error al agregar la marca, inténtelo nuevamente.";
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }