Example #1
0
        int ISmartWarn.SendSmartWarn(string SmartWarn, int FlagCode)
        {
            int    NewCallCount = Interlocked.Increment(ref CallCount);
            string SendReceiveString;

            SendReceiveString = string.Format("SendSmartWarn:[次数:{0}][{1}][FlagCode:{2}]", CallCount, SmartWarn, FlagCode);
            OutPut(SendReceiveString);

            SmartAlarmTest NewSmartAlarmTest = new SmartAlarmTest();

            NewSmartAlarmTest.Timestamp = SmartWarn.Substring(0, 19);
            NewSmartAlarmTest.DefineID  = SmartWarn.Substring(20, 2);
            NewSmartAlarmTest.DefineSum = GetDefineSum(int.Parse(NewSmartAlarmTest.DefineID));
            NewSmartAlarmTest.FlagID    = "00";
            NewSmartAlarmTest.AccountID = SmartWarn.Substring(23, 12);

            MyListSmartAlarmTest.Add(NewSmartAlarmTest);


            //更新列表
            if (UIContext != null && UpdateCallSendAlarm != null)
            {
                string str = SmartWarn;
                UIContext.Post(UpdateCallSendAlarm, str);
            }

            return(100);
        }
Example #2
0
        int ISmartWarn.PostListSmartWarn(string SmartWarnSet, ref int FlagCode)
        {
            int    NewCallCount = Interlocked.Increment(ref CallCount);
            string SendReceiveString;

            SendReceiveString = string.Format("PostListSmartWarn:[次数:{0}][{1}][FlagCode:{2}]", CallCount, SmartWarnSet, FlagCode);
            OutPut(SendReceiveString);


            //更新列表
            if (UIContext != null && UpdateCallPostAlarm != null)
            {
                int    t          = 100 + FlagCode;
                string mListCount = t.ToString() + ":";
                string str        = mListCount + SmartWarnSet;
                UIContext.Post(UpdateCallPostAlarm, str);
            }

            int TempCode = FlagCode;

            if (SmartWarnSet != null)
            {
                if (SmartWarnSet.Length > 20)
                {
                    string SmartWarn, TempSmartWarn;
                    int    SmartWarnIndex;
                    TempSmartWarn  = SmartWarnSet;
                    SmartWarnIndex = TempSmartWarn.IndexOf("#");
                    while (SmartWarnIndex != -1)
                    {
                        SmartWarn = TempSmartWarn.Substring(0, SmartWarnIndex + 1);
                        SmartAlarmTest NewSmartAlarmTest = new SmartAlarmTest();
                        NewSmartAlarmTest.Timestamp = SmartWarn.Substring(0, 19);
                        NewSmartAlarmTest.DefineID  = SmartWarn.Substring(20, 2);
                        NewSmartAlarmTest.DefineSum = GetDefineSum(int.Parse(NewSmartAlarmTest.DefineID));
                        NewSmartAlarmTest.FlagID    = "00";
                        NewSmartAlarmTest.AccountID = SmartWarn.Substring(23, 12);
                        MyListSmartAlarmTest.Add(NewSmartAlarmTest);
                        TempSmartWarn  = TempSmartWarn.Substring(SmartWarnIndex + 1);
                        SmartWarnIndex = TempSmartWarn.IndexOf("#");
                    }

                    FlagCode = TempCode;
                    return(100);
                }
                else
                {
                    return(300);
                }
            }
            else
            {
                return(200);
            }
        }