public static void ReturnSubscribe(STATIONNAME _StationName, DEVICECATEGORY _DeviceName, String _CommandName, Object _Value, DateTime _UpdateTime) { SubscribeStructure ThisSubscribe = SubscribeList.FirstOrDefault(Item => Item.StationName == _StationName && Item.DeviceName == _DeviceName && Item.CommandName == _CommandName); for (int i = 0; i < SubscribeList.Count; i++) { //if(SubscribeList[i].StationName == _StationName && SubscribeList[i].DeviceName == DeviceName.NULL && SubscribeList[i].CommandName == null) } }
public static ReturnKnowType SubscribeByCommmanName(ServerCallBack ClientCallBack, String ClientSessionID, STATIONNAME StationName, DEVICECATEGORY DeviceName, String CommandName) { try { SubscribeStructure.SubscribeType SubscribeType = GetSubscribeType(StationName, DeviceName, CommandName); DuplicationSubscribeChecking(SubscribeType, ClientSessionID, StationName, DeviceName, CommandName); SubscribeStructure ThisSubscribe = SubscribeList.FirstOrDefault(Item => Item.StationName == StationName && Item.DeviceName == DeviceName && Item.CommandName == CommandName); if (ThisSubscribe == null) { ClientSubscription ThisClient = new ClientSubscription(); ThisClient.ClientCallBack = ClientCallBack; ThisClient.ClientSessionID = ClientSessionID; ThisSubscribe = new SubscribeStructure(); ThisSubscribe.StationName = StationName; ThisSubscribe.DeviceName = DeviceName; ThisSubscribe.CommandName = CommandName; ThisSubscribe.Type = SubscribeType; ThisSubscribe.ClientList = new List <ClientSubscription>(); ThisSubscribe.ClientList.Add(ThisClient); } else { ClientSubscription ThisClient = ThisSubscribe.ClientList.FirstOrDefault(Item => Item.ClientSessionID == ClientSessionID); if (ThisClient == null) { ThisClient = new ClientSubscription(); ThisClient.ClientCallBack = ClientCallBack; ThisClient.ClientSessionID = ClientSessionID; ThisSubscribe.ClientList.Add(ThisClient); } else { return(ReturnKnowType.DefineReturn(ReturnStatus.SUCESSFUL, "Your request is already exist in subscribe list. Please check.")); } } return(ReturnKnowType.DefineReturn(ReturnStatus.SUCESSFUL, null)); } catch (Exception e) { return(ReturnKnowType.DefineReturn(ReturnStatus.FAILED, "Failed to subscribe information see. (" + e.Message + ")")); } }