예제 #1
0
        private void GrabarCabecera()
        {
            if (Session.Count == 0)
            {
                LblMensaje.Text = "Debe Acceder Cuenta con su Usuario y Contraseña";
                return;
            }
            if (TxtFechaReg.Text.Trim() == "")
            {
                LblMensaje.Text = "Ingrese Fecha de Pedido";
                TxtFechaReg.Focus();
                return;
            }
            if (TxtFormaPago.Text.Trim() == "")
            {
                LblMensaje.Text = "Ingrese Forma de Pago";
                TxtFormaPago.Focus();
                return;
            }
            if (TxtFormaEnvio.Text.Trim() == "")
            {
                LblMensaje.Text = "Ingrese Forma de Envio";
                TxtFormaEnvio.Focus();
                return;
            }
            if (TxtDireccion.Text.Trim() == "")
            {
                LblMensaje.Text = "Ingrese Dirección";
                TxtDireccion.Focus();
                return;
            }
            if (TxtTelefono.Text.Trim() == "")
            {
                LblMensaje.Text = "Ingrese Teléfono";
                TxtTelefono.Focus();
                return;
            }
            try
            {
                Ent.Idpedido   = int.Parse(0 + TxtIdPedido.Text);
                Ent.Idusuario  = int.Parse(0 + Session["IdUsuario"].ToString());
                Ent.FechaReg   = Convert.ToDateTime(TxtFechaReg.Text);
                Ent.Formapago  = TxtFormaPago.Text.Trim();
                Ent.Formaenvio = TxtFormaEnvio.Text.Trim();
                Ent.Direccion  = TxtDireccion.Text.Trim();
                Ent.Telefono   = TxtTelefono.Text.Trim();

                int filas;
                filas = NegPedidos.GrabarPedido(Ent);
                if (filas > 0)
                {
                    TxtIdPedido.Text = Convert.ToString(filas);
                    LblMensaje.Text  = "Pedido Registrado";
                }
            }
            catch (Exception ex)
            {
                LblMensaje.Text = ex.Message;
            }
        }
예제 #2
0
 private void TxtNombres_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         TxtDireccion.Focus();
     }
 }
예제 #3
0
 public bool ValidarGuardar()
 {
     if (TxtNumeroIdentificacion.Text == "")
     {
         TxtNumeroIdentificacion.Focus();
         return(false);
     }
     else
     {
         if (TxtNombreCorto.Text == "")
         {
             TxtNombreCorto.Focus();
             return(false);
         }
         else
         {
             if (TxtDireccion.Text == "")
             {
                 TxtDireccion.Focus();
                 return(false);
             }
             else
             {
                 if (CboIdentificacion.SelectedIndex < 0)
                 {
                     CboIdentificacion.Focus();
                     return(false);
                 }
                 else
                 {
                     if (CboIdentificacion.SelectedIndex < 0)
                     {
                         CboIdentificacion.Focus();
                         return(false);
                     }
                     else
                     {
                         if (TxtTelefono.Text == "")
                         {
                             TxtTelefono.Focus();
                             return(false);
                         }
                         else
                         {
                             return(true);
                         }
                     }
                 }
             }
         }
     }
 }
예제 #4
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TxtRuc.Text))
            {
                MessageBox.Show("Digite Ruc", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                TxtRuc.Focus();
            }
            else if (string.IsNullOrEmpty(TxtRazonSocial.Text))
            {
                MessageBox.Show("Digite Razon Social", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                TxtRazonSocial.Focus();
            }
            else if (string.IsNullOrEmpty(TxtCiudad.Text))
            {
                MessageBox.Show("Digite Ciudad", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                TxtCiudad.Focus();
            }
            else if (string.IsNullOrEmpty(TxtDireccion.Text))
            {
                MessageBox.Show("Digite Dirección", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                TxtDireccion.Focus();
            }

            /*else if (string.IsNullOrEmpty(TxtEmail.Text))
             * {
             *  MessageBox.Show("Digite Correo Electrónico", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             *  TxtEmail.Focus();
             * }*/
            else if (string.IsNullOrEmpty(TxtTelefono.Text))
            {
                MessageBox.Show("Digite Teléfono", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                TxtTelefono.Focus();
            }
            else
            {
                Guardar();
            }
        }
예제 #5
0
 protected void BtnRegistrar_Click(object sender, EventArgs e)
 {
     if (Session.Count == 0)
     {
         if (Existe() > 0)
         {
             LblMensaje.Text = "Login ya Existe, elija otro";
             LblMensaje.Focus();
             return;
         }
     }
     if (TxtNombre.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Nombres";
         TxtNombre.Focus();
         return;
     }
     if (TxtApePat.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Apellido Paterno";
         TxtApePat.Focus();
         return;
     }
     if (TxtApeMat.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Apellido Materno";
         TxtApeMat.Focus();
         return;
     }
     if (TxtDireccion.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Direccion";
         TxtDireccion.Focus();
         return;
     }
     if (TxtEmail.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Email";
         TxtEmail.Focus();
         return;
     }
     if (TxtLogin.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Login";
         TxtLogin.Focus();
         return;
     }
     if (TxtPassword.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Password";
         TxtPassword.Focus();
         return;
     }
     if (Session.Count > 0)
     {
         if (TxtLogin.Text.Trim() != Session["Login"].ToString())
         {
             LblMensaje.Text = "Ingrese Login Igual al que Inicio Sesión";
             TxtLogin.Focus();
             return;
         }
     }
     EntUsuario.Nombre    = TxtNombre.Text.Trim();
     EntUsuario.Apepat    = TxtApePat.Text.Trim();
     EntUsuario.Apemmat   = TxtApeMat.Text.Trim();
     EntUsuario.Direccion = TxtDireccion.Text.Trim();
     EntUsuario.Telefono  = TxtTelefono.Text.Trim();
     EntUsuario.Celular   = TxtCelular.Text.Trim();
     EntUsuario.Email     = TxtEmail.Text.Trim();
     EntUsuario.Password  = TxtPassword.Text.Trim();
     EntUsuario.Login     = TxtLogin.Text.Trim();
     EntUsuario.Idperfil  = 2;
     try
     {
         int filas;
         filas = NegUsuario.Grabar(EntUsuario);
         if (filas > 0)
         {
             if (Session.Count > 0)
             {
                 EntUsuario.Idusuario = int.Parse(Session["IdUsuario"].ToString());
                 Session["Password"]  = TxtPassword.Text.Trim();
                 NegPrefxUsu.EliminaXIdUsuario(EntUsuario);
             }
             List <Entidad> EntPrefxUsuLista = new List <Entidad>();
             for (filas = 0; filas < ChkPreferencias.Items.Count; filas++)
             {
                 if (ChkPreferencias.Items[filas].Selected)
                 {
                     Entidad ENT = new Entidad();
                     ENT.Tipopreferencia = ChkPreferencias.Items[filas].Text;
                     ENT.Login           = TxtLogin.Text.Trim();
                     EntPrefxUsuLista.Add(ENT);
                 }
             }
             NegPrefxUsu.Grabar(EntPrefxUsuLista);
             if (Session.Count > 0)
             {
                 LblMensaje.Text = "Usuario Actualizado";
             }
             else
             {
                 LblMensaje.Text = "Usuario Registrado";
                 Limpiar();
             }
         }
     }
     catch (Exception ex)
     {
         LblMensaje.Text = ex.Message;
     }
 }