Exemplo n.º 1
0
 public DeferredStoreItem(Datastore itemStore, DatastoreItem dsItem, IsRefresh isRefreshedItem)
 {
     m_id            = -1;
     m_storeKey      = null;
     ItemStore       = itemStore;
     DSItem          = dsItem;
     IsRefreshedItem = isRefreshedItem;
 }
Exemplo n.º 2
0
 // 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;
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Displays an appropriate error message based on the given error result.
        /// </summary>
        //------------------------------------------------------------------------------------
        public void HandleFailedTask(BackgroundTaskResult result)
        {
            StoreErrors error = Datastore.GetStoreErrorFromExceptionMessage(result.ResultMessage);

            if (error == StoreErrors.ProductStudioNotInstalled || error == StoreErrors.ProductStudioNewerVersionRequired)
            {
                //ProductStudioNotInstalledDialog dialog = new ProductStudioNotInstalledDialog(error);
                //dialog.ShowDialog();
            }
            else
            {
                UserMessage.Show(result.ResultMessage);
            }
        }
Exemplo n.º 5
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Pulls the StoreItem with the given store key from the backing store represented
        /// by that key.
        /// </summary>
        //------------------------------------------------------------------------------------
        public static StoreItem GetStoreItem(string storeKey)
        {
            if (string.IsNullOrWhiteSpace(storeKey))
            {
                return(null);
            }

            string store = StoreItem.GetStoreNameFromKey(storeKey);
            int    id    = StoreItem.GetIDFromKey(storeKey);

            Datastore datastore = null;

            if (!string.IsNullOrWhiteSpace(store) && id > 0)
            {
                if (StringUtils.StringsMatch(store, ScheduleStore.Instance.StoreName))
                {
                    datastore = ScheduleStore.Instance;
                }
                else if (StringUtils.StringsMatch(store, HostItemStore.Instance.StoreName))
                {
                    datastore = HostItemStore.Instance;
                }
            }

            if (datastore != null)
            {
                DatastoreItem dsItem = datastore.DSItemByID(id);
                if (dsItem != null)
                {
                    StoreItem item = datastore.CreateAndInitializeItemFromDS(dsItem);
                    item.ID = id;
                    return(item);
                }
            }

            return(null);
        }
Exemplo n.º 6
0
        BackgroundTaskResult CommitItemWorker(StoreItem item, List <StoreItem> newCommittedItems)
        {
            //try
            {
                Datastore store = item.Store;
                switch (item.ChangeAction)
                {
                case StoreChangeAction.Default:
                    if (item.IsNew)
                    {
                        item.DSItem = store.CreateDSItem();

                        ItemTypeKey typeKey = store.GetItemTypeKey(item.StoreItemType);
                        item.DSItem.Fields[store.PropNameType].Value = typeKey.TypeName;

                        if (store.PropSubTypeName != null && typeKey.SubTypeName != Constants.c_Any)
                        {
                            item.DSItem.Fields[store.PropSubTypeName].Value = typeKey.SubTypeName;
                        }

                        store.SaveItemWorker(item);
                        store.FinalizeAfterSave(item);
                        item.PersistState = PersistStates.PersistedToStore;
                        newCommittedItems.Add(item);
                    }
                    else
                    {
                        store.SaveItemWorker(item);
                        store.FinalizeAfterSave(item);
                    }
                    break;

                case StoreChangeAction.ResolveItem:
                    item.Status = StatusValues.Active;
                    store.ResolveStoreItemWorker(item);
                    store.FinalizeAfterSave(item);
                    break;

                case StoreChangeAction.ResolveAndCloseItem:
                    store.ResolveStoreItemWorker(item);
                    store.CloseStoreItemWorker(item);
                    store.FinalizeAfterSave(item);
                    break;

                case StoreChangeAction.CloseItem:
                    store.CloseStoreItemWorker(item);
                    store.FinalizeAfterSave(item);
                    break;

                case StoreChangeAction.ActivateItem:
                    store.ActivateStoreItemWorker(item);
                    store.FinalizeAfterSave(item);
                    break;
                }

                return(new BackgroundTaskResult {
                    ResultType = ResultType.Completed
                });
            }

            //catch (Exception exception)
            //{
            //    Planner.ApplicationManager.HandleException(exception);
            //    return new BackgroundTaskResult { ResultType = ResultType.Failed, ResultMessage = exception.Message };
            //}
        }
Exemplo n.º 7
0
 public CompositeValueRegistry(Datastore store)
 {
     Store      = store;
     m_registry = new Dictionary <string, Dictionary <string, CompositeIdentifier> >();
 }
Exemplo n.º 8
0
 public BaseQuery(Datastore store)
 {
     Store = store;
 }
Exemplo n.º 9
0
 public OPlannerBugsQuery(Datastore store, ShouldRefresh isRefresh)
     : base(store)
 {
     ShouldRefresh = isRefresh;
 }