Ejemplo n.º 1
0
 private void SaveBrandButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(BrandNameTextBox.Text))
         {
             if (BrandManagement.SelectBrandByName(BrandNameTextBox.Text) == null)
             {
                 if (BrandManagement.InsertBrand(BrandNameTextBox.Text))
                 {
                     FrmMain.Instance.ToolStripLabel.Text = "Se agrego el Empleado correctamente.";
                     BrandNameTextBox.Text = "";
                     ReloadBrandsDataGridView();
                 }
                 else
                 {
                     MetroMessageBox.Show(this, $"Ha ocurrido un error al agregar la marca: { BrandNameTextBox.Text}.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MetroMessageBox.Show(this, "Ya existe una marca con ese nombre.", "Marca repetida", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MetroMessageBox.Show(this, "El campo del nombre de la marca no puede estar vacío.", "Campo vacío", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
     }
 }
Ejemplo n.º 2
0
        private void brandTextBox_KeyUp(object sender, KeyEventArgs e)
        {
            string brand = brandTextBox.Text;

            if (e.KeyCode == Keys.Enter)
            {
                if (brand != " ")
                {
                    foreach (BrandModel brandModel in BrandManagement.SelectBrandByName(brand))
                    {
                        dgvSearchProduct.DataSource = ProductManagement.SelectProductByIdBrand(brandModel.IdBrand.ToString());
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void brandNameSearchTextBox_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(brandNameSearchTextBox.Text))
         {
             brandsGridView.DataSource = BrandManagement.SelectBrandByName(brandNameSearchTextBox.Text);
         }
         else
         {
             WireUpBrandsGridView();
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }