Exemple #1
0
        public static void SendScriptToStation(STATIONNAME ScriptStationName)
        {
            if (ScriptStationName != STATIONNAME.NULL)
            {
                String         Message = null;
                StationHandler StationCommunication = AstroData.GetStationObject(ScriptStationName);
                StationScript  StationScript        = GetStationScript(ScriptStationName);

                DBScheduleEngine.UpdateFailSchedule(ScriptStationName);

                //DBScheduleEngine.DropSchedule(ScriptStationName);
                Console.WriteLine("Preparing Station Script before sending.");

                foreach (ScriptStructureNew Script in StationScript.ScriptCollection)
                {
                    //if (Script.ScriptState != SCRIPTSTATE.CANCELED.ToString())
                    //{
                    //    Script.ScriptState = SCRIPTSTATE.SENDINGTOSTATION.ToString();
                    //    DBScheduleEngine.UpdateSchedule(Script);
                    //}
                    //else
                    //{
                    //    Console.WriteLine("CANCEL");
                    //}
                    Script.ScriptState = SCRIPTSTATE.SENDINGTOSTATION.ToString();
                    DBScheduleEngine.UpdateSchedule(Script);
                }


                Console.WriteLine("Sending Script to " + ScriptStationName + " ...");
                if (StationCommunication.NewScriptInformation(StationScript.GetScript(), out Message))
                {
                    //DBScheduleEngine.DropSchedule(ScriptStationName);

                    /*
                     * foreach (ScriptStructureNew Script in StationScript.ScriptCollection)
                     * {
                     *  Script.ScriptState = SCRIPTSTATE.WAITINGSTATION.ToString();
                     *  DBScheduleEngine.UpdateSchedule(Script);
                     * }
                     */
                }

                DisplayScriptMessage(Message);
            }
        }