private void btnEditar_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         FrmRegistrarProductos RP = new FrmRegistrarProductos();
         RP.txtIdP.Text      = dataGridView1.CurrentRow.Cells[0].Value.ToString();
         RP.IdC.Text         = dataGridView1.CurrentRow.Cells[1].Value.ToString();
         RP.txtProducto.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString();
         RP.txtPCompra.Text  = dataGridView1.CurrentRow.Cells[3].Value.ToString();
         RP.txtStock.Text    = dataGridView1.CurrentRow.Cells[4].Value.ToString();
         if (dataGridView1.SelectedRows.Count > 0)
         {
             Program.Evento = 1;
         }
         else
         {
             Program.Evento = 0;
         }
         dataGridView1.ClearSelection();
         RP.Visible = true;
         Visible    = false;
     }
     else
     {
         //FrmRegistroProductos P = new FrmRegistroProductos();
         MessageBox.Show("Debe Seleccionar la Fila a Editar.", "Sistema de Ventas.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         //P.Visible = true;
         //Visible = false;
     }
 }
Beispiel #2
0
        private void btn_comp_Click(object sender, EventArgs e)
        {
            FrmRegistrarProductos RP = new FrmRegistrarProductos();

            RP.Visible = true;
            Visible    = false;
        }
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            //if (dataGridView1.SelectedRows.Count > 0){
            //    //DevComponents.DotNetBar.MessageBoxEx.Show("La Fila no debe Estar Seleccionada.");
            //    //FrmRegistroProductos P = new FrmRegistroProductos();
            //    //dataGridView1.ClearSelection();
            //    //P.Show();
            //}else{
            FrmRegistrarProductos RP = new FrmRegistrarProductos();

            if (dataGridView1.SelectedRows.Count > 0)
            {
                Program.Evento = 1;
            }
            else
            {
                Program.Evento = 0;
            }
            dataGridView1.ClearSelection();

            RP.Visible = true;
            Visible    = false;

            // }
        }
Beispiel #4
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            clsCategoria          C  = new clsCategoria();
            FrmRegistrarProductos RP = new FrmRegistrarProductos();
            String Mensaje           = "";

            try
            {
                if (txtCategoria.Text.Trim() != "")
                {
                    if (Program.Evento == 0)
                    {
                        C.Descripcion = txtCategoria.Text;
                        Mensaje       = C.RegistrarCategoria();
                        if (Mensaje == "Categoria ya se encuentra Registrada.")
                        {
                            MessageBox.Show(Mensaje, "Sistema de Ventas.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            RP.Visible = true;
                            Visible    = false;
                        }
                        else
                        {
                            MessageBox.Show(Mensaje, "Sistema de Ventas.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Limpiar();
                            RP.Visible = true;
                            Visible    = false;
                        }
                    }
                    else
                    {
                        C.IdC         = Convert.ToInt32(IdC.Text);
                        C.Descripcion = txtCategoria.Text;
                        MessageBox.Show(C.ActualizarCategoria(), "Sistema de Ventas.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Limpiar();
                    }
                }
                else
                {
                    MessageBox.Show("Por Favor Digíte Datos.", "Sistema de Ventas.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtCategoria.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }