コード例 #1
0
ファイル: Informes.cs プロジェクト: harol18/Form_Cheques
 private void Btnguardar_Click(object sender, EventArgs e)
 {
     cmds.control_horarios(Txtidentificacion, TxtNombre, TxtArea, cmbactividad, Txtobservaciones);
     Txtidentificacion.Clear();
     TxtNombre.Clear();
     TxtArea.Clear();
     cmbactividad.Text = "";
     Txtobservaciones.Clear();
 }
コード例 #2
0
ファイル: LP.cs プロジェクト: Otzoy97/LFP_PRACTICA1
 /// <summary>
 /// Incializa todo el formulario
 /// </summary>
 public Main()
 {
     InitializeComponent();
     TxtArea.Text = "  PRIMERA PRACTICA DE LABORATORIO" + Environment.NewLine + "© LP-CLOUD [Lenguajes Formales y de Programación] 1S 2018" + Environment.NewLine;
     pdf          = new ListaSimple("PDF");
     fila         = new ListaSimple("Fila");
     token        = new ListaSimple("Token");
     texto        = new Cola("Texto");
     imagen       = new Cola("Imagen");
     tabla        = new Cola("Tabla");
     err          = new ListaSimple("Error");
     ///Agrega SFOG<< y coloca el puntero al final
     TxtArea.Text += Environment.NewLine + iniciales;
     TxtArea.Select(TxtArea.Text.Length, 0);
 }
コード例 #3
0
ファイル: LP.cs プロジェクト: Otzoy97/LFP_PRACTICA1
        /// <summary>
        /// Controla la acción de las teclas Enter, Backspace y Tab
        /// Enter -> Añade un SFOG>>> y elimina el último > , esto ayuda a colocar el cursor al final de la cadena y que se muestre de la forma SFOG>>
        /// Backspace -> Verifica que la última línea se mayor a 6 caracteres (de la cadena SFOG>>) quita 1 caracter y coloca al final de la cadena el cursor
        /// Tab -> Evita la acción de Tabular
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TxtArea_KeyPress(object sender, KeyPressEventArgs e)
        {
            String[] lineaCodigo = TxtArea.Lines;
            int      rowsCodigo  = lineaCodigo.Length;
            int      lenCodigo   = lineaCodigo[rowsCodigo - 1].Length;

            //Enter
            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                e.Handled = true;
                if (lenCodigo > 6)
                {
                    //Obtiene la cadena a Escanear
                    String cadenaEscanear = lineaCodigo[rowsCodigo - 1].Substring(iniciales.Length);
                    //Manda al analizador toda esta onda
                    ListaSimple analizador = new Lenguaje().AnalizarCadena(cadenaEscanear);
                    //Guarda la cadena
                    Cola AEjecutar = GuardarTokens(analizador);
                    //Determina si la cadena se ejecuta o no
                    if (Escanear(analizador))
                    {
                        //Ejecuta la cadena
                        EjecutarToken(AEjecutar);
                    }
                }
                NuevaLinea();
            }
            //Backspace
            else if (e.KeyChar == Convert.ToChar(Keys.Back))
            {
                e.Handled = true;
                //Coloca el cursor al final del txtbox
                if (lenCodigo > iniciales.Length)
                {
                    //Elimina un caracter del final de la última linea
                    TxtArea.Text = TxtArea.Text.Substring(0, TxtArea.Text.Length - 1);
                }
            }
            //Tabular
            else if (e.KeyChar == Convert.ToChar(Keys.Tab))
            {
                e.Handled = true;
            }
            //Coloca el cursor al final del txtbox
            TxtArea.Focus();
            TxtArea.Select(TxtArea.Text.Length, 0);
            TxtArea.ScrollToCaret();
        }
コード例 #4
0
        private bool validarCampos()
        {
            bool b = false;

            if (String.IsNullOrEmpty(TxtArea.Text))
            {
                TxtArea.Focus();
                throw new Exception("Ingrese área");
            }

            if (String.IsNullOrEmpty(txtEdificio.Text))
            {
                txtEdificio.Focus();
                throw new Exception("Ingrese edificio");
            }

            if (String.IsNullOrEmpty(txtAula.Text))
            {
                txtAula.Focus();
                throw new Exception("Ingrese aula");
            }

            if (String.IsNullOrEmpty(TxtPiso.Text))
            {
                TxtPiso.Focus();
                throw new Exception("Ingrese piso");
            }

            //if (DDLCategoria.SelectedIndex == 0)
            //    throw new Exception("Seleccione una categoría");

            if (DDLSede.SelectedIndex == 0)
            {
                throw new Exception("Seleccione una sede");
            }

            if (String.IsNullOrEmpty(txtUsu.Text))
            {
                txtUsu.Focus();
                throw new Exception("Ingrese usuario asignado");
            }


            if (DateTime.Parse(txtFechaCompra.Text) > DateTime.Parse("2018-12-31"))
            {
                if (String.IsNullOrEmpty(txtRuc.Text))
                {
                    txtRuc.Focus();
                    throw new Exception("Ingrese RUC");
                }

                if (String.IsNullOrEmpty(txtProveedor.Text.Trim()))
                {
                    txtRuc.Focus();
                    throw new Exception("Ingrese Proveedor");
                }

                if (String.IsNullOrEmpty(txtNroFactura.Text))
                {
                    txtNroFactura.Focus();
                    throw new Exception("Ingrese Nro Comprobante");
                }

                if (String.IsNullOrEmpty(txtFechaCompra.Text))
                {
                    txtFechaCompra.Focus();
                    throw new Exception("Ingrese Fecha de Compra");
                }

                if (String.IsNullOrEmpty(txtTiempo.Text))
                {
                    txtTiempo.Text = "0";
                    txtTiempo_TextChanged(null, null);
                }
            }

            b = true;
            return(b);
        }
コード例 #5
0
        private bool validarCampos(string tipo)
        {
            bool b = false;

            try
            {
                LogisticaN objBuscar = new LogisticaN();
                string     xcodigo   = TxtCod.Text.Trim();

                if (tipo == "insert")
                {
                    DataTable DTILogistica = objBuscar.BuscarLogistica(xcodigo);

                    if (DTILogistica.Rows.Count > 0)
                    {
                        TxtCod.Focus();
                        throw new Exception("El Codigo ya Existe");
                    }
                }
                else
                {
                    if (TxtCod.Text.Trim() != TxtCodigo.Text.Trim())
                    {
                        if (objBuscar.fun_validar_noRepetir_cod(xcodigo) > 0)
                        {
                            TxtCod.Focus();
                            throw new Exception("El Codigo ya Existe");
                        }
                    }
                }

                if (String.IsNullOrEmpty(TxtCod.Text))
                {
                    TxtCod.Focus();
                    throw new Exception("Ingrese el código");
                }

                if (String.IsNullOrEmpty(TxtDescripcion.Text))
                {
                    TxtDescripcion.Focus();
                    throw new Exception("Ingrese Descripción");
                }
                if (DDLSede.SelectedIndex == 0)
                {
                    DDLSede.Focus();
                    throw new Exception("Seleccione Sede");
                }

                if (String.IsNullOrEmpty(TxtArea.Text))
                {
                    TxtArea.Focus();
                    throw new Exception("Ingrese Area");
                }

                if (String.IsNullOrEmpty(TxtPiso.Text))
                {
                    TxtPiso.Focus();
                    throw new Exception("Ingrese Piso");
                }

                if (String.IsNullOrEmpty(txtEdificio.Text))
                {
                    txtEdificio.Focus();
                    throw new Exception("Ingrese Edificio");
                }

                if (String.IsNullOrEmpty(txtUsu.Text))
                {
                    txtUsu.Focus();
                    throw new Exception("Asigne un Usuario");
                }

                if (DDLCategoria.SelectedIndex == 0)
                {
                    DDLCategoria.Focus();
                    throw new Exception("Seleccione Categoria");
                }


                if (tipo == "insert")
                {
                    validar_campos_ruc();
                }
                else
                {
                    if (DateTime.Parse(hdFecha.Value) > DateTime.Parse("2018-12-31"))
                    {
                        validar_campos_ruc();
                    }
                }

                b = true;
                return(b);
            }
            catch (Exception ex)
            {
                this.Page.Response.Write("<script language ='JavaScript'>window.alert('" + ex.Message + "');</script>");
                return(false);
            }
        }