// If productGroupKey is non-empty, only those items that have their ProductGroupKey property equal
 // to this value will be returned.
 public ActiveItemTypeQuery(Datastore store, string productGroupKey, List <ItemTypeID> typeList, ShouldRefresh shouldRefresh, RefreshType refreshType = PlannerNameSpace.RefreshType.QueryForChangedItems)
     : base(store)
 {
     TypeList          = typeList;
     m_productGroupKey = productGroupKey;
     ShouldRefresh     = shouldRefresh;
     RefreshType       = refreshType;
 }
Beispiel #2
0
 public HostItemQuery(Datastore store, List <ItemTypeID> typeList, List <string> groupMemberAliases, List <int> treeIDs,
                      AsyncObservableCollection <TrainItem> trains, ShouldRefresh isRefresh, RefreshType refreshType = RefreshType.QueryForChangedItems)
     : base(store)
 {
     TypeList      = typeList;
     GroupMembers  = groupMemberAliases;
     TreeIDs       = treeIDs;
     Trains        = trains;
     ShouldRefresh = isRefresh;
     RefreshType   = refreshType;
 }
Beispiel #3
0
        protected bool AddRefreshDateFilterClause(ShouldRefresh shouldRefresh, RefreshType refreshType)
        {
            if (shouldRefresh == PlannerNameSpace.ShouldRefresh.Yes)
            {
                if (refreshType == PlannerNameSpace.RefreshType.QueryForChangedItems)
                {
                    DateTime lastRefreshTime = TypeUtils.GetValueAsLocalTime(Planner.Instance.LastRefreshTime);
                    string   lastRefreshDate = lastRefreshTime.ToShortDateString();
                    AddClause(Datastore.PropNameChangedDate, "equalsGreater", lastRefreshDate);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        //------------------------------------------------------------------------------------
        /// <summary>
        ///  Kicks off a background query to retrieve the entire planner schedule for the
        ///  specified product group.
        /// </summary>
        //------------------------------------------------------------------------------------
        public void BeginPlannerQuery(ShouldRefresh shouldRefresh, string productGroupKey, BackgroundTask continuingTask = null, RefreshType refreshType = RefreshType.QueryForChangedItems)
        {
            IsQueryInProgress   = true;
            IsRefreshInProgress = shouldRefresh == PlannerNameSpace.ShouldRefresh.Yes;

            ShouldRefresh = shouldRefresh;
            RefreshType   = refreshType;

            if (continuingTask != null)
            {
                QueryTask = new BackgroundTask(continuingTask);
            }
            else
            {
                QueryTask = new BackgroundTask(ShouldRefresh == ShouldRefresh.No);
            }

            QueryTask.DoWork        += PlannerQueryTask_DoWork;
            QueryTask.TaskCompleted += PlannerQueryTask_Completed;
            QueryTask.IsProgressDialogIndeterminate = true;
            QueryTask.RunTaskAsync();
        }
Beispiel #5
0
        void IRepository.ReceiveDSItems(Datastore store, DatastoreItems items, ShouldRefresh isRefresh, bool isDefer)
        {
            if (isRefresh == ShouldRefresh.Yes)
            {
                ReceiveRefreshStoreItemsToDefer(store, items);
            }
            else if (isDefer)
            {
                ReceiveStoreItemsToDefer(store, items);
            }
            else
            {
                foreach (DatastoreItem dsItem in items)
                {
                    StoreItem storeItem = store.CreateAndInitializeItemFromDS(dsItem);

                    // Every item loaded from the back-end store is placed into
                    // the global item cache for immediate access.
                    AddItemFromStore(storeItem);
                }
            }
        }
Beispiel #6
0
 public OPlannerBugsQuery(Datastore store, ShouldRefresh isRefresh)
     : base(store)
 {
     ShouldRefresh = isRefresh;
 }
Beispiel #7
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Executes the given query against this data store.  Returns false if a cancellation
        /// request is detected via the given taskWorker.
        /// </summary>
        //------------------------------------------------------------------------------------
        public BackgroundTaskResult ExecuteQuery(IRepository repository, BaseQuery query, ShouldRefresh shouldRefresh, BackgroundTask taskWorker, bool deferItemCreation)
        {
            DatastoreItemList storeItemList = GetStoreItemList();
            FieldDefinitions  fieldDefs     = storeItemList.Datastore.FieldDefinitions;

            // Set up a query, using QueryDefinition to define the query XML
            ProductStudio.Query psQuery = new ProductStudio.Query();
            psQuery.CountOnly         = false;
            psQuery.DatastoreItemType = PsDatastoreItemTypeEnum.psDatastoreItemTypeBugs;
            psQuery.SelectionCriteria = query.QueryXml;

            psQuery.QueryFields.Clear();
            psQuery.QuerySortFields.Clear();
            psQuery.QuerySortFields.Add(fieldDefs["ID"], PsSortTypeEnum.psSortTypeDescending);

            // Execute the query
            try
            {
                storeItemList.Query = psQuery;
                storeItemList.Execute();
            }

            catch (Exception e)
            {
                return(new BackgroundTaskResult {
                    ResultType = ResultType.Failed, ResultMessage = e.Message
                });
            }

            Planner.Instance.WriteToEventLog(StoreName + ": Query results count: " + storeItemList.DatastoreItems.Count.ToString());

            repository.ReceiveDSItems(this, storeItemList.DatastoreItems, shouldRefresh, deferItemCreation);

            return(new BackgroundTaskResult {
                ResultType = ResultType.Completed
            });
        }
 public PlannerQueryCompletedEventArgs(BackgroundTaskResult result, ShouldRefresh shouldRefresh)
 {
     Result        = result;
     ShouldRefresh = shouldRefresh;
 }