예제 #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 List <Signalod> RefreshCurrentButState()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <Signalod> >(MethodBase.GetCurrentMethod()));
            }
            string command = "SELECT * FROM signalod "
                             + "WHERE SigType=0 "  //buttons only
                             + "AND AckTime<" + POut.Date(new DateTime(1880, 1, 1), true) + " "
                             + "ORDER BY SigDateTime";
            List <Signalod> sigList = new List <Signalod>();

            try {
                sigList = Crud.SignalodCrud.SelectMany(command);
                sigList.Sort();
            }
            catch {
                //we don't want an error message to show, because that can cause a cascade of a large number of error messages.
            }
            SigElement[] sigElementsAll = SigElements.GetElements(sigList);
            for (int i = 0; i < sigList.Count; i++)
            {
                sigList[i].ElementList = SigElements.GetForSig(sigElementsAll, sigList[i].SignalNum);
            }
            return(sigList);
        }
예제 #2
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 List <Signalod> RefreshFullText(DateTime sinceDateT)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <Signalod> >(MethodBase.GetCurrentMethod(), sinceDateT));
            }
            string command = "SELECT * FROM signalod "
                             + "WHERE (SigDateTime>" + POut.DateT(sinceDateT) + " "
                             + "OR AckTime>" + POut.DateT(sinceDateT) + " "
                             + "OR AckTime<" + POut.Date(new DateTime(1880, 1, 1), true) + ") "//always include all unacked.
                             + "AND SigType=" + POut.Long((int)SignalType.Button)
                             + " ORDER BY SigDateTime";
            //note: this might return an occasional row that has both times newer.
            List <Signalod> sigList = new List <Signalod>();

            try {
                sigList = Crud.SignalodCrud.SelectMany(command);
                sigList.Sort();
            }
            catch {
                //we don't want an error message to show, because that can cause a cascade of a large number of error messages.
            }
            SigElement[] sigElementsAll = SigElements.GetElements(sigList);
            for (int i = 0; i < sigList.Count; i++)
            {
                sigList[i].ElementList = SigElements.GetForSig(sigElementsAll, sigList[i].SignalNum);
            }
            return(sigList);           //retVal;
        }