Beispiel #1
0
        private void FRM_Producto_Load(object sender, EventArgs e)
        {
            limpiar();
            desactivar(true);

            if (Servicios == 1)
            {
                pbx_Productos.Visible   = false;
                pbx_Servicios.Visible   = true;
                lab_Costo_ProdServ.Text = "Costo/Serv";
                Nuevo.Size       = new Size(153, 40);
                Nuevo.Location   = new Point(153, 316);
                Guardar.Size     = new Size(153, 40);
                Guardar.Location = new Point(153, 316);

                Editar.Size       = new Size(153, 40);
                Editar.Location   = new Point(316, 316);
                Cancelar.Size     = new Size(153, 40);
                Cancelar.Location = new Point(316, 316);


                ProdServ(false);
            }
            else
            {
                pbx_Servicios.Visible   = false;
                pbx_Productos.Visible   = true;
                lab_Costo_ProdServ.Text = "Costo/Prod";
                ProdServ(true);
            }

            CMB_Buscar.Text = "Nombre";
            cbx_ITBIS.Text  = "18";

            try
            {
                DataSet ds = Fproducto.GetAll(Servicios == 0 ? "Productos" : "Servicios");
                dt = ds.Tables[0];
                dgvProductos.DataSource = dt;

                if (dt.Rows.Count > 0)
                {
                    dgvProductos.Columns["CategoriaId"].Visible = false;
                    try
                    {
                        dgvProductos.Columns["Imagen"].Visible = false;
                    }
                    catch (Exception)
                    {
                    }
                    noencontrado.Visible = false;
                    dgvProductos_CellClick(null, null);
                }
                else
                {
                    noencontrado.Visible = true;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Algo está mal, Favor intentar denuevo", "Error");
                //MessageBox.Show(ex.Message + ex.StackTrace);
            }
            MostrarGuardarCancelar(false);
        }