Example #1
0
        public static void AgregarVuelo <T>(this Aeropuerto <T> a) where T : IAvion
        {
            StreamWriter writer = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Aeropuerto.txt");

            writer.WriteLine(DateTime.Now + " " + ((Avion)(IAvion)a.Vuelos.LastOrDefault()).HorasDeVuelo);
            writer.Close();
        }
Example #2
0
        public static void Guardar(this Aeropuerto <IAvion> emisor)
        {
            string        dbName           = "final-20190711";
            string        connectionString = "Data Source=.\\SQLEXPRESS; Initial Catalog=" + dbName + "; Integrated Security=True;";
            SqlCommand    comando;
            SqlConnection conexion;

            conexion            = new SqlConnection(connectionString);
            comando             = new SqlCommand();
            comando.CommandType = System.Data.CommandType.Text;
            comando.Connection  = conexion;

            try
            {
                string insert = "INSERT INTO Bitacora (entrada,alumno) VALUES('" + DateTime.Now + "','Federico Alaniz')";
                comando.CommandText = insert;
                comando.Connection.Open();
                comando.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                comando.Connection.Close();
            }
        }
Example #3
0
        public static void Planchar(this Aeropuerto <IAvion> emisor)
        {
            SqlConnection conexion = new SqlConnection(Properties.Settings.Default.CadenaConeccion);
            SqlCommand    comando  = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.Connection  = conexion;
            try
            {
                comando.CommandText = "INSERT INTO Bitacora (entrada,alumno) VALUES('" + DateTime.Now + "','Jakubek Gabriel')";
                comando.Connection.Open();
                comando.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (comando.Connection.State == ConnectionState.Open)
                {
                    comando.Connection.Close();
                }
            }
        }
Example #4
0
 public static void Guardar(Aeropuerto <T> aeropuerto)
 {
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof(Aeropuerto <IAvion>));
         using (XmlTextReader reader = new XmlTextReader(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Vuelos.xml"))
         {
             aeropuerto = (Aeropuerto <T>)serializer.Deserialize(reader);
             //carga.Planchar((Aeropuerto<T>)aeropuerto);
         }
     }
     catch (Exception ex)
     {
         throw new ErrorArchivoException(ex);
     }
 }
Example #5
0
        public static bool agregaInfo(this Aeropuerto <IAvion> a)
        {
            string        connectionStr = "Data Source=. SQLEXPRESS; Initial Catalog=final-20190711; Integrated Security=true";
            SqlConnection conexion      = new SqlConnection(connectionStr);
            SqlCommand    comando       = new SqlCommand();

            comando.CommandType = System.Data.CommandType.Text;
            comando.Connection  = conexion;
            string currentquery = "INSERT INTO dbo.Bitacora (entrada, alumno) VALUES ('" + System.DateTime.Now + "', '" + (string)a + "')";

            comando.CommandText = currentquery;
            conexion.Open();
            try
            {
                comando.ExecuteNonQuery();
            }
            catch (SqlException sqle)
            {
                throw sqle;
            }

            return(true);
        }