Example #1
0
        private void btnEnviar_Click(object sender, RoutedEventArgs e)
        {
            Reportar pReporte = new Reportar();

            pReporte.serial = txSerial.Text.Trim();
            pReporte.makat  = txMakat.Text.Trim();
            pReporte.Paka   = txPaka.Text.Trim();

            //  pReporte.Fecha_Nac = dtpFechaNacimiento.Value.Year + “/” +dtpFechaNacimiento.Value.Month + “/” +dtpFechaNacimiento.Value.Day;

            int resultado = ReportesABM.Agregar(pReporte);

            if (resultado > 0)
            {
                MessageBox.Show("Se ha enviado con Exito!!", "Guardado", MessageBoxButton.OK, MessageBoxImage.Information);

                obtenerLista();
            }

            else

            {
                MessageBox.Show("No se pudo guardar el Reporte", "Fallo!!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
Example #2
0
        public static int Agregar(Reportar pReporte)
        {
            int retorno = 0;

            string pFecha = DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString();
            string pUser  = "******";
            string pHora  = DateTime.Now.TimeOfDay.Hours.ToString() + ":" + DateTime.Now.TimeOfDay.Minutes.ToString();

            MySqlCommand comando = new MySqlCommand(string.Format("Insert into reportes(userid,fecha,hora,serial,makat,paka) values('{0}','{1}','{2}','{3}','{4}','{5}')", pUser, pFecha, pHora, pReporte.serial, pReporte.makat, pReporte.Paka), MyCon.ObtenerConexion());

            try
            {
                retorno = comando.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }


            return(retorno);
        }