示例#1
0
        public static void InitDataBase()
        {
            SqlDAO DL  = new SqlDAO(FlightCenterConfig.strConn);
            string SQL = "DELETE FROM Tickets";

            DL.ExecuteSqlNonQuery(SQL);
            SQL = "DELETE FROM Customers";
            DL.ExecuteSqlNonQuery(SQL);
            SQL = "DELETE FROM Flights";
            DL.ExecuteSqlNonQuery(SQL);
            SQL = "DELETE FROM AirlineCompanies";
            DL.ExecuteSqlNonQuery(SQL);
            SQL = "DELETE FROM Countries";
            DL.ExecuteSqlNonQuery(SQL);
            SQL = "DBCC CHECKIDENT ('Customers', RESEED, 0)";
            DL.ExecuteSqlNonQuery(SQL);
            SQL = "DBCC CHECKIDENT ('Countries', RESEED, 0)";
            DL.ExecuteSqlNonQuery(SQL);
            SQL = "DBCC CHECKIDENT ('AirlineCompanies', RESEED, 0)";
            DL.ExecuteSqlNonQuery(SQL);
            SQL = "DBCC CHECKIDENT ('Flights', RESEED, 0)";
            DL.ExecuteSqlNonQuery(SQL);
            SQL = "DBCC CHECKIDENT ('Tickets', RESEED, 0)";
            DL.ExecuteSqlNonQuery(SQL);
        }
        int time = 20; // Constant time for transference 20:00
        protected FlyingCenterSystem()
        {
            DL = new SqlDAO(FlightCenterConfig.strConn);

            new Task(() =>
            {
                bool flag = true;
                while (true)
                {
                    if (DateTime.Now.Hour < time) // Checks every 10 minutes if the time for transference has passed or not
                    {
                        flag = true;
                    }
                    else
                    {
                        if (flag)
                        {
                            DL.MoveTicketsExpired3HoursAgo();
                            DL.MoveFlightsExpired3HoursAgo();
                        }
                        flag = false;
                    }
                    Thread.Sleep(600000); //10 minutes interval
                }
            });
        }
示例#3
0
 private SqlDAO DL;  // A central class of database connections
 public FlightDAOMSSQL()
 {
     DL = new SqlDAO(FlightCenterConfig.strConn);
 }
 SqlDAO DL; // A central class of database connections
 public AdministratorDAOMSSQL()
 {
     DL = new SqlDAO(FlightCenterConfig.strConn);
 }
示例#5
0
 private SqlDAO DL;  // A central class of database connections
 public CustomerDAOMSSQL()
 {
     DL = new SqlDAO(FlightCenterConfig.strConn);
 }