/// <summary> /// Apply the specified type of list logic /// </summary> /// <param name="l2"></param> /// <param name="type"></param> /// <returns></returns> public bool ApplyListLogic( CidList l2, ListLogicType type) { if (type == ListLogicType.Union) { return(Union(l2)); } else if (type == ListLogicType.Intersect) { return(Intersect(l2)); } else if (type == ListLogicType.Difference) { return(Difference(l2)); } else { throw new Exception("Invalid ListLogicType: " + type); } }
/// <summary> /// Execute list logic on a pair of persisted list objects & store results in current list for user /// </summary> /// <param name="list1InternalName"></param> /// <param name="list2InternalName"></param> /// <param name="op"></param> /// <returns>Number of results from logic operation</returns> public static int ExecuteListLogic( string list1InternalName, string list2InternalName, ListLogicType op) { if (ServiceFacade.UseRemoteServices) { Mobius.Services.Native.INativeSession nativeClient = ServiceFacade.CreateNativeSessionProxy(); Services.Native.NativeMethodTransportObject resultObject = ServiceFacade.InvokeNativeMethod(nativeClient, (int)Services.Native.ServiceCodes.MobiusCidListService, (int)Services.Native.ServiceOpCodes.MobiusCidListService.ExecuteListLogic, new Services.Native.NativeMethodTransportObject(new object[] { list1InternalName, list2InternalName, (int)op })); ((System.ServiceModel.IClientChannel)nativeClient).Close(); int result = (int)resultObject.Value; return(result); } else { return(UAL.CidListDao.ExecuteListLogic(list1InternalName, list2InternalName, op)); } }
/// <summary> /// Execute list logic on a pair of persisted list objects & store results in current list for user /// </summary> /// <param name="list1InternalName"></param> /// <param name="list2InternalName"></param> /// <param name="op"></param> /// <returns>Number of results from logic operation</returns> public static int ExecuteListLogic( string list1InternalName, string list2InternalName, ListLogicType op) { CidList list1 = Read(list1InternalName); if (list1 == null) { throw new Exception("List not found: " + list1InternalName); } CidList list2 = Read(list2InternalName); if (list2 == null) { throw new Exception("List not found: " + list2InternalName); } list1.ApplyListLogic(list2, op); CidListDao.Write(list1, "Current"); // write new current list return(list1.Count); }