Beispiel #1
0
 protected void GuardarButton_Click(object sender, EventArgs e)
 {
     if (IdTextBox.Text == "")
     {
         if (string.IsNullOrWhiteSpace(RazonTextBox.Text) || string.IsNullOrWhiteSpace(PrecioTextBox0.Text) || string.IsNullOrWhiteSpace(FechaTextBox.Text))
         {
             Response.Write("<script>alert('Llene Todos Los Campos')</script>");
         }
         else
         {
             ObtenerValores();
             if (sol.Insertar())
             {
                 Response.Write("<script>alert('Se ha Guardado')</script>");
             }
         }
     }
     else if (string.IsNullOrWhiteSpace(RazonTextBox.Text) || string.IsNullOrWhiteSpace(PrecioTextBox0.Text) || string.IsNullOrWhiteSpace(FechaTextBox.Text))
     {
         Response.Write("<script>alert('Llene Todos Los Campos')</script>");
     }
     else
     {
         ObtenerValores();
         if (sol.Editar())
         {
             Response.Write("<script>alert('Se ha Modificado')</script>");
         }
     }
 }
Beispiel #2
0
 protected void GuardarButton_Click(object sender, EventArgs e)
 {
     if (IdTextBox.Text.Length == 0)
     {
         ObtenerDatos();
         if (sol.Insertar())
         {
             Limpiar();
             Response.Write("<script>alert('Inserto')</script>");
         }
         else
         {
             Response.Write("<script>alert('error')</script>");
         }
     }
     if (IdTextBox.Text.Length > 0)
     {
         ObtenerDatos();
         if (sol.Editar())
         {
             Response.Write("<script>alert('Modifico')</script>");
         }
         else
         {
             Response.Write("<script>alert('error')</script>");
         }
     }
 }
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            Solicitudes SolicitudDetalle;

            if (Session["SolicitudSession"] == null)
            {
                Session["SolicitudSession"] = new Solicitudes();
            }

            SolicitudDetalle = (Solicitudes)Session["SolicitudSession"];

            if (SolicitudIdTextBox.Text.Length > 0)
            {
                if (LLenarDatos())
                {
                    Solicitud.SolicitudId = Seguridad.ValidarEntero(SolicitudIdTextBox.Text);

                    if (Solicitud.Editar())
                    {
                        Mensajes.ShowToastr(this.Page, "Se Modifico", "Informacion", "Success");
                        Limpiar();
                    }
                    else
                    {
                        Mensajes.ShowToastr(this.Page, "No Se Modifico", "Error", "Error");
                    }
                }
                else
                {
                    Mensajes.ShowToastr(this.Page, "Faltan Datos", "Error", "Error");
                }
            }
            else
            {
                if (LLenarDatos())
                {
                    if (Solicitud.Insertar())
                    {
                        Mensajes.ShowToastr(this.Page, "Se Registro", "Felicidades", "Success");
                        Limpiar();
                    }
                    else
                    {
                        Mensajes.ShowToastr(this.Page, "No se pudo Registrar", "Error", "Error");
                    }
                }
                else
                {
                    Mensajes.ShowToastr(this.Page, "Faltan Datos", "Error", "Error");
                }
            }
        }
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            if (RazonTextBox.Text.Length == 0 || MaterialDropDownList.Text.Length == 0 || CantidadTextBox.Text.Length == 0 || PrecioDropDownList.Text.Length == 0 || MaterialesGridView.Rows.Count == 0 || TotalTextBox.Text.Length == 0)
            {
                Response.Write("<script>alert('Hay campos sin completar');<script>");
            }
            else

            if (Id(IdTextBox.Text) == 0)
            {
                LlenarDatos();
                if (solicitud.Insertar())
                {
                    Response.Write("<script>alert('Solicitud Guardada');<script>");
                }
                else
                {
                    Response.Write("<script>alert('Error al Guardar');</script>");
                }
                //Limpiar();
            }
            else
            if (Id(IdTextBox.Text) > 0)
            {
                if (solicitud.Buscar(Id(IdTextBox.Text)))
                {
                    LlenarDatos();
                    if (solicitud.Editar())
                    {
                        Response.Write("<script>alert('Solicitud Editada');<script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('Error al Editar');</script>");
                    }
                }
                //Limpiar();
            }
        }
Beispiel #5
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            int id = ConvertirId();

            if (string.IsNullOrWhiteSpace(IdTextBox.Text))
            {
                if (string.IsNullOrWhiteSpace(FechaTextBox0.Text) || string.IsNullOrWhiteSpace(TotalTextBox.Text) || string.IsNullOrWhiteSpace(RazonTextBox.Text))
                {
                    Response.Write("<script>alert('LLene todos los Campos')</script>");
                }
                else
                {
                    AgregarValores();
                    sol.Insertar();
                    Response.Write("<script>alert('Se ha Guardado')</script>");
                }
            }
            else if (IdTextBox.Text != "")
            {
                if (string.IsNullOrWhiteSpace(FechaTextBox0.Text) && string.IsNullOrWhiteSpace(TotalTextBox.Text) && string.IsNullOrWhiteSpace(RazonTextBox.Text))
                {
                    Response.Write("<script>alert('Error')</script>");
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(FechaTextBox0.Text) || string.IsNullOrWhiteSpace(TotalTextBox.Text) || string.IsNullOrWhiteSpace(RazonTextBox.Text))
                    {
                        Response.Write("<script>alert('LLene todos los Campos')</script>");
                    }
                    else
                    {
                        AgregarValores();
                        sol.IdSolicitud = ConvertirId();
                        sol.Editar();
                        Response.Write("<script>alert('Se ha Editado')</script>");
                    }
                }
            }
        }