Ejemplo n.º 1
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Up)
            {
                if (MainGrid.Rows.Count > 0)
                {
                    int pos = MainGrid.CurrentCell.RowIndex;
                    if (pos == 0)
                    {
                        Txtnombre.Focus();
                        return(true);
                    }
                }
            }

            if (keyData == Keys.Down)
            {
                if (MainGrid.Rows.Count > 0 && focus == true)
                {
                    MainGrid.Focus();


                    return(true);
                }
            }


            return(base.ProcessCmdKey(ref msg, keyData));
        }
Ejemplo n.º 2
0
        private bool Validate()
        {
            if (string.IsNullOrEmpty(Txtnombre.Text))
            {
                DisplayAlert("Error", "Debe ingresar un usuario", "Aceptar");
                Txtnombre.Focus();
                return(false);
            }
            else if (string.IsNullOrEmpty(TxtPass.Text))
            {
                DisplayAlert("Error", "Debe ingresar una Contraseña", "Aceptar");
                TxtPass.Focus();
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        private void Btnagregar_Click(object sender, EventArgs e)
        {
            NOrden Producto = new NOrden();
            string Nombre   = Producto.NombreProducto(Txtcodigo.Text);

            if (string.IsNullOrEmpty(Nombre) && string.IsNullOrEmpty(Txtnombre.Text))
            {
                MessageBox.Show("Debe suministrar un nombre para crear el producto");
            }
            else
            {
                bool Existe  = false;
                int  NumFila = 0;
                if (Cont == 0)
                {
                    if (string.IsNullOrEmpty(Nombre))
                    {
                        Nombre = Txtnombre.Text;
                    }
                    DTVDetalle.Rows.Add(Txtcodigo.Text, Nombre, Txtcantidad.Text, Txtvalor.Text);
                    double Total = Convert.ToDouble(DTVDetalle.Rows[Cont].Cells[2].Value) * Convert.ToDouble(DTVDetalle.Rows[Cont].Cells[3].Value);
                    DTVDetalle.Rows[Cont].Cells[4].Value = Total;
                    Cont++;
                    Txtcodigo.Clear();
                    Txtnombre.Clear();
                    Txtcantidad.Clear();
                    Txtvalor.Clear();
                }
                else
                {
                    foreach (DataGridViewRow Fila in DTVDetalle.Rows)
                    {
                        if (Fila.Cells[0].Value.ToString() == Txtcodigo.Text)
                        {
                            Existe  = true;
                            NumFila = Fila.Index;
                        }
                    }
                    if (Existe == true)
                    {
                        DTVDetalle.Rows[NumFila].Cells[2].Value = (Convert.ToDouble(Txtcantidad.Text) + Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[2].Value)).ToString();
                        DTVDetalle.Rows[NumFila].Cells[3].Value = (Convert.ToDouble(Txtvalor.Text) + Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[3].Value)).ToString();
                        double Total = Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[2].Value) * Convert.ToDouble(DTVDetalle.Rows[NumFila].Cells[3].Value);
                        DTVDetalle.Rows[NumFila].Cells[4].Value = Total;
                        Txtcodigo.Clear();
                        Txtnombre.Clear();
                        Txtcantidad.Clear();
                        Txtvalor.Clear();
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(Nombre))
                        {
                            Nombre = Txtnombre.Text;
                        }
                        DTVDetalle.Rows.Add(Txtcodigo.Text, Nombre, Txtcantidad.Text, Txtvalor.Text);
                        double Total = Convert.ToDouble(DTVDetalle.Rows[Cont].Cells[2].Value) * Convert.ToDouble(DTVDetalle.Rows[Cont].Cells[3].Value);
                        DTVDetalle.Rows[Cont].Cells[4].Value = Total;
                        Cont++;
                        Txtcodigo.Clear();
                        Txtnombre.Clear();
                        Txtcantidad.Clear();
                        Txtvalor.Clear();
                    }
                }
                TotalO = 0;
                foreach (DataGridViewRow Fila in DTVDetalle.Rows)
                {
                    TotalO += Convert.ToDouble(Fila.Cells[4].Value);
                }
                Lbltotal.Text = TotalO.ToString();
                Txtcodigo.Focus();
            }
        }
Ejemplo n.º 4
0
 private void Cmbbuscarpor_SelectedIndexChanged(object sender, EventArgs e)
 {
     Txtnombre.Text = "";
     Txtnombre.Focus();
 }