예제 #1
0
        ///<summary>Only used when starting up to get the current button state.  Only gets unacked messages.  There may well be extra and useless messages included.  But only the lights will be used anyway, so it doesn't matter.</summary>
        public static Signal[] RefreshCurrentButState()
        {
            string command = "SELECT * FROM signal "
                             + "WHERE SigType=0 "  //buttons only
                             + "AND AckTime<'1880-01-01' "
                             + "ORDER BY SigDateTime";

            Signal[]     sigList        = RefreshAndFill(command);
            SigElement[] sigElementsAll = SigElements.GetElements(sigList);
            for (int i = 0; i < sigList.Length; i++)
            {
                sigList[i].ElementList = SigElements.GetForSig(sigElementsAll, sigList[i].SignalNum);
            }
            return(sigList);
        }
예제 #2
0
        ///<summary>Gets all Signals and Acks Since a given DateTime.  If it can't connect to the database, then it no longer throws an error, but instead returns a list of length 0.  Remeber that the supplied dateTime is server time.  This has to be accounted for.</summary>
        public static Signal[] RefreshTimed(DateTime sinceDateT)
        {
            string command = "SELECT * FROM signal "
                             + "WHERE SigDateTime>" + POut.PDateT(sinceDateT) + " "
                             + "OR AckTime>" + POut.PDateT(sinceDateT) + " "
                             + "ORDER BY SigDateTime";

            //note: this might return an occasional row that has both times newer.
            Signal[]     sigList        = RefreshAndFill(command);
            SigElement[] sigElementsAll = SigElements.GetElements(sigList);
            for (int i = 0; i < sigList.Length; i++)
            {
                sigList[i].ElementList = SigElements.GetForSig(sigElementsAll, sigList[i].SignalNum);
            }
            return(sigList);
        }
예제 #3
0
        ///<summary>This excludes all Invalids.  It is only concerned with text and button messages.  It includes all messages, whether acked or not.  It's up to the UI to filter out acked if necessary.  Also includes all unacked messages regardless of date.</summary>
        public static ArrayList RefreshFullText(DateTime sinceDateT)
        {
            string command = "SELECT * FROM signal "
                             + "WHERE (SigDateTime>" + POut.PDateT(sinceDateT) + " "
                             + "OR AckTime>" + POut.PDateT(sinceDateT) + " "
                             + "OR AckTime<'1880-01-01') "  //always include all unacked.
                             + "AND SigType=" + POut.PInt((int)SignalType.Button)
                             + " ORDER BY SigDateTime";

            //note: this might return an occasional row that has both times newer.
            Signal[]     sigList        = RefreshAndFill(command);
            SigElement[] sigElementsAll = SigElements.GetElements(sigList);
            for (int i = 0; i < sigList.Length; i++)
            {
                sigList[i].ElementList = SigElements.GetForSig(sigElementsAll, sigList[i].SignalNum);
            }
            ArrayList retVal = new ArrayList(sigList);

            return(retVal);
        }