private void Guardar()
        {
            try
            {
                if (evento == null)
                {
                    evento = new Eeventos();
                }

                evento.a           = "Insertar";
                evento.descripcion = txtDescri.Text;
                evento.referencia  = txtRefe.Text;
                evento.precio      = int.Parse(txtPre.Text);
                evento.fecha       = txtFecha.Text;

                acceso_eventos.InsertarEventos(evento);

                if (acceso_eventos.stringBuilder.Length != 0)
                {
                    MessageBox.Show(acceso_eventos.stringBuilder.ToString(), "Para continuar:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    MessageBox.Show("EVENTO REGISTRADO CORRECTAMENTE", "CLIENTE REGISTRADO", MessageBoxButtons.OK, MessageBoxIcon.None);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("Error: {0}", ex.Message), "Error inesperado", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
 public void InsertarEventos(Eeventos evento)
 {
     if (ValidarEvento(evento))
     {
         acceso_datos.InsertarEventos(evento);
     }
 }
 public DataTable BuscarTodosEventos(Eeventos evento)
 {
     con.ConnectionString = Conexion.cadenaConexion;
     comando             = new SqlCommand("Sp_eventos", con);
     comando.CommandType = CommandType.StoredProcedure;
     comando.Parameters.AddWithValue("@a", evento.a);
     comando.Parameters.AddWithValue("@descripcion", "");
     comando.Parameters.AddWithValue("@referencia", "");
     comando.Parameters.AddWithValue("@precio", "");
     comando.Parameters.AddWithValue("@fecha", "");
     return(MetodosDatos.ejecutarComandoSelect(comando));
 }
Beispiel #4
0
 public static bool BuscarEventos(Eeventos evento)
 {
     datos = acceso_datos.BuscarEventos(evento);
     if (datos.Rows.Count > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #5
0
        private bool ValidarEvento(Eeventos evento)
        {
            stringBuilder.Clear();

            if (string.IsNullOrEmpty(evento.descripcion))
            {
                stringBuilder.Append("El campo DESCRIPCION es obligatorio");
            }
            if (string.IsNullOrEmpty(evento.referencia))
            {
                stringBuilder.Append(Environment.NewLine + "El campo REFERENCIA es obligatorio");
            }
            return(stringBuilder.Length == 0);
        }
 //______________________EVENTOS_______________________________
 public void InsertarEventos(Eeventos evento)
 {
     try
     {
         con.ConnectionString = Conexion.cadenaConexion;
         comando             = new SqlCommand("Sp_eventos", con);
         comando.CommandType = CommandType.StoredProcedure;
         comando.Parameters.AddWithValue("@a", evento.a);
         comando.Parameters.AddWithValue("@descripcion", evento.descripcion);
         comando.Parameters.AddWithValue("@referencia", evento.referencia);
         comando.Parameters.AddWithValue("@precio", evento.precio);
         comando.Parameters.AddWithValue("@fecha", evento.fecha);
         con.Open();
         comando.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         con.Close();
     }
 }