Beispiel #1
0
        public T Spawn(T source, ViewId sourceId)
        {
            T   instance = default;
            var found    = false;
            //var key = (ViewId)(int.MaxValue + source.gameObject.GetInstanceID());
            var       key = sourceId;
            Stack <T> list;

            if (this.prefabToInstances.TryGetValue(key, out list) == true)
            {
                if (list.Count > 0)
                {
                    instance = (T)list.Pop();
                    found    = true;
                }
            }
            else
            {
                list = new Stack <T>();
                this.prefabToInstances.Add(key, list);
            }

            if (found == false)
            {
                var go = GameObject.Instantiate(source);
                instance = go.GetComponent <T>();
            }

            var instanceInternal = (IViewBaseInternal)instance;

            instanceInternal.Setup(instance.world, new ViewInfo(instance.entity, key, instance.creationTick));
            instance.gameObject.SetActive(true);
            return(instance);
        }
Beispiel #2
0
        private questStatus read(MasterPricingEntities dbContext, ViewId viewId, out Quest.Services.Dbio.MasterPricing.Views view)
        {
            // Initialize
            questStatus status = null;

            view = null;


            try
            {
                view = dbContext.Views.Where(r => r.Id == viewId.Id).SingleOrDefault();
                if (view == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("Id {0} not found", viewId.Id))));
                }
            }
            catch (System.Exception ex)
            {
                status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                       this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                       ex.InnerException != null ? ex.InnerException.Message : ex.Message));
                LogException(ex, status);
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #3
0
        public questStatus GetViewInfo(DatabaseId databaseId, TablesetView tablesetView, out View view)
        {
            // Initialize
            questStatus status = null;

            view = null;


            // Get view
            DbViewsMgr dbViewsMgr = new DbViewsMgr(this._userSession);

            status = dbViewsMgr.Read(databaseId, tablesetView.Schema, tablesetView.Name, out view);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            tablesetView.View = view;


            // Get view columns
            ViewId        viewId       = new ViewId(view.Id);
            List <Column> columnList   = null;
            DbColumnsMgr  dbColumnsMgr = new DbColumnsMgr(this._userSession);

            status = dbColumnsMgr.Read(viewId, out columnList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            view.ColumnList = columnList;

            return(new questStatus(Severity.Success));
        }
Beispiel #4
0
        /// <summary> If we are leaving, we have to wait for the view change (last msg in the current view) that
        /// excludes us before we can leave.
        /// </summary>
        /// <param name="new_view">The view to be installed
        /// </param>
        /// <param name="digest">  If view is a MergeView, digest contains the seqno digest of all members and has to
        /// be set by GMS
        /// </param>
        public override void  handleViewChange(View new_view, Digest digest)
        {
            if (gms.Stack.NCacheLog.IsInfoEnabled)
            {
                gms.Stack.NCacheLog.Info("ParticipentGMSImpl.handleViewChange", "received view");
            }
            System.Collections.ArrayList mbrs = new_view.Members;
            gms.Stack.NCacheLog.Debug("view=");// + new_view);
            suspected_mbrs.Clear();
            if (leaving && !mbrs.Contains(gms.local_addr))
            {
                // received a view in which I'm not member: ignore
                return;
            }

            ViewId vid = gms.view_id != null?gms.view_id.Copy() : null;

            if (vid != null)
            {
                int rc = vid.CompareTo(new_view.Vid);
                if (rc < 0)
                {
                    isNewMember = false;
                    if (gms.Stack.NCacheLog.IsInfoEnabled)
                    {
                        gms.Stack.NCacheLog.Info("ParticipantGmsImp", "isNewMember : " + isNewMember);
                    }
                }
            }
            gms.installView(new_view, digest);
        }
Beispiel #5
0
        internal virtual void  becomeSingletonMember(Address mbr)
        {
            Digest    initial_digest;
            ViewId    view_id = null;
            ArrayList mbrs    = ArrayList.Synchronized(new ArrayList(1));

            // set the initial digest (since I'm the first member)
            initial_digest = new Digest(1);             // 1 member (it's only me)
            initial_digest.add(gms.local_addr, 0, 0);   // initial seqno mcast by me will be 1 (highest seen +1)
            gms.Digest = initial_digest;

            view_id = new ViewId(mbr);             // create singleton view with mbr as only member
            mbrs.Add(mbr);

            View v = new View(view_id, mbrs);

            v.CoordinatorGmsId = gms.unique_id;
            ArrayList subgroupMbrs = new ArrayList();

            subgroupMbrs.Add(mbr);
            gms._subGroupMbrsMap[gms.subGroup_addr] = subgroupMbrs;
            gms._mbrSubGroupMap[mbr] = gms.subGroup_addr;
            v.SequencerTbl           = gms._subGroupMbrsMap.Clone() as Hashtable;
            v.MbrsSubgroupMap        = gms._mbrSubGroupMap.Clone() as Hashtable;
            v.AddGmsId(mbr, gms.unique_id);

            gms.installView(v);
            gms.becomeCoordinator();             // not really necessary - installView() should do it

            gms.Stack.IsOperational = true;
            gms.Stack.NCacheLog.Debug("pb.ClientGmsImpl.becomeSingletonMember()", "created group (first member). My view is " + gms.view_id + ", impl is " + gms.Impl.GetType().FullName);
        }
Beispiel #6
0
        /// <remarks>
        /// Called by <c>Join()</c> when no initial members can be detected
        /// </remarks>
        /// <summary>
        /// Changes the GMS to a Coord implementation
        /// </summary>
        /// <param name="mbr">Local Address representing this Channel</param>
        private void becomeSingletonMember(Address mbr)
        {
            Digest    initial_digest;
            ViewId    view_id = null;
            ArrayList mbrs    = new ArrayList();

            // set the initial digest (since I'm the first member)
            initial_digest = new Digest(1);                       // 1 member (it's only me)
            initial_digest.add(gms.local_addr, 0, 0);             // initial seqno mcast by me will be 1 (highest seen +1)
            gms.setDigest(initial_digest);

            view_id = new ViewId(mbr);                 // create singleton view with mbr as only member
            mbrs.Add(mbr);
            gms.installView(new View(view_id, mbrs));
            gms.becomeCoordinator();

            gms.passUp(new Event(Event.BECOME_SERVER));
            gms.passDown(new Event(Event.BECOME_SERVER));
            if (Trace.trace)
            {
                Trace.info("ClientGmsImpl.becomeSingletonMember()",
                           "created group (first member). My view is " + gms.view_id +
                           ", impl is " + gms.getImpl().getName());
            }
        }
        protected override async Task <AuthenticateResult> HandleAuthenticateAsync()
        {
            // Is this relevant to us?
            if (!Request.Headers.TryGetValue(Options.HTTPHeader, out var authValue))
            {
                return(AuthenticateResult.NoResult());
            }

            // Is it a good pair?
            var actualAuthValue = authValue.FirstOrDefault();
            var apiValues       = actualAuthValue.Split(':', 2);

            if (apiValues.Length != 2 || String.IsNullOrEmpty(apiValues[0]) || String.IsNullOrEmpty(apiValues[1]))
            {
                return(AuthenticateResult.Fail($"Invalid authentication format, expected 'viewId:accessKey'"));
            }

            var viewId    = ViewId.FromString(apiValues[0]);
            var accessKey = apiValues[1];
            var principal = await _membership.GetAuditViewAsync(viewId, accessKey);

            if (principal == null)
            {
                return(AuthenticateResult.Fail("Invalid authentication provided, access denied."));
            }

            var ticket = new AuthenticationTicket(principal, Options.AuthenticationScheme);

            return(AuthenticateResult.Success(ticket));
        }
Beispiel #8
0
 public String ApplyViewParams(String raw)
 {
     if (!String.IsNullOrEmpty(ViewId))
     {
         var ps = ViewId.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
         foreach (var line in ps)
         {
             var values = line.Split(new[] { "=" }, StringSplitOptions.RemoveEmptyEntries);
             if (values.Length == 2)
             {
                 // Remove cool hack from this line, when we found another way to bind xml attributes of view.
                 if (values[1] == "${name}")
                 {
                     raw = raw.Replace("${" + values[0] + "}", ViewName);
                 }
                 else
                 {
                     raw = raw.Replace("${" + values[0] + "}", values[1]);
                 }
             }
         }
     }
     foreach (KeyValuePair <string, string> pair in DefinedVariables.Variables)
     {
         raw = raw.Replace(pair.Key, pair.Value);
     }
     return(raw);
 }
Beispiel #9
0
        public async Task <string> ResetKeyAsync(ViewId id, CustomerId customerId, string accessKey)
        {
            var sqlParams = new
            {
                Id         = id.RawValue,
                CustomerId = customerId.RawValue,
                AccessKey  = accessKey
            };
            string sql = @";
                UPDATE dbo.Views
                SET AccessKey = @AccessKey
                WHERE Id = @Id
                    AND CustomerId = @CustomerId;

                SELECT AccessKey
                FROM dbo.Views V
                WHERE V.Id = @Id
                    AND V.CustomerId = @CustomerId;
            ";

            return(await _db.QuerySingleOrDefault(async (db) =>
            {
                return await db.FetchAsync <string>(sql, sqlParams);
            }));
        }
Beispiel #10
0
        private void CreateUnit_RPC(Color color, int count, ViewId viewSourceId, ViewId viewSourceId2)
        {
            var   p1Position = Vector3.zero;
            Point data;

            if (this.world.GetEntityData(this.p1, out data) == true)
            {
                p1Position = data.position;
            }

            for (int i = 0; i < count; ++i)
            {
                var unit = this.world.AddEntity(new Unit()
                {
                    position  = this.world.GetRandomInSphere(p1Position, 1f),
                    scale     = Vector3.one * 0.3f,
                    lifes     = 1,
                    speed     = this.world.GetRandomRange(1f, 2f),
                    pointFrom = this.p1,
                    pointTo   = this.p2
                }, updateStorages: false);
                var followComponent = this.world.AddComponent <Unit, UnitFollowFromTo>(unit);
                followComponent.@from = this.p1;
                followComponent.to    = this.p2;

                this.world.AddComponent <Unit, UnitGravity>(unit);
                var setColor = this.world.AddComponent <Unit, UnitSetColor>(unit);
                setColor.color = color;

                this.world.InstantiateView <Unit>(viewSourceId, unit);
                //this.world.InstantiateView<Unit>(viewSourceId2, unit);
            }

            this.world.UpdateStorages <Unit>();
        }
Beispiel #11
0
        private questStatus delete(MasterPricingEntities dbContext, ViewId viewId)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read all columns for this view.
                List <Quest.Services.Dbio.MasterPricing.Columns> _columnsList = null;
                status = read(dbContext, viewId, out _columnsList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Delete the records.
                dbContext.Columns.RemoveRange(_columnsList);
                dbContext.SaveChanges();
            }
            catch (System.Exception ex)
            {
                return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                     this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                     ex.InnerException != null ? ex.InnerException.Message : ex.Message)));
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #12
0
        private questStatus read(MasterPricingEntities dbContext, ViewId viewId, out List <Quest.Services.Dbio.MasterPricing.Columns> columnList)
        {
            // Initialize
            questStatus status = null;

            columnList = null;


            try
            {
                columnList = dbContext.Columns.Where(r => r.EntityTypeId == 2 && r.EntityId == viewId.Id).ToList();
                if (columnList == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("ViewId {0} not found", viewId.Id))));
                }
            }
            catch (System.Exception ex)
            {
                status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                       this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                       ex.InnerException != null ? ex.InnerException.Message : ex.Message));
                LogException(ex, status);
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #13
0
        public questStatus Read(DbMgrTransaction trans, ViewId viewId, out List <Quest.Functional.MasterPricing.Column> columnList)
        {
            // Initialize
            questStatus status = null;

            columnList = null;


            // Perform read
            List <Quest.Services.Dbio.MasterPricing.Columns> _columnsList = null;

            status = read((MasterPricingEntities)trans.DbContext, viewId, out _columnsList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            columnList = new List <Column>();
            foreach (Quest.Services.Dbio.MasterPricing.Columns _column in _columnsList)
            {
                Quest.Functional.MasterPricing.Column column = new Quest.Functional.MasterPricing.Column();
                BufferMgr.TransferBuffer(_column, column);
                columnList.Add(column);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #14
0
        public T Spawn(T source, ViewId sourceId)
        {
            T   instance = default;
            var found    = false;
            //var key = (ViewId)(int.MaxValue + source.gameObject.GetInstanceID());
            var       key = sourceId;
            Stack <T> list;

            if (this.prefabToInstances.TryGetValue(key, out list) == true)
            {
                if (list.Count > 0)
                {
                    instance = (T)list.Pop();
                    found    = true;
                }
            }
            else
            {
                list = new Stack <T>();
                this.prefabToInstances.Add(key, list);
            }

            if (found == false)
            {
                var go = GameObject.Instantiate(source);
                instance = go.GetComponent <T>();
            }

            instance.prefabSourceId = key;
            instance.gameObject.SetActive(true);
            return(instance);
        }
Beispiel #15
0
        public void InstantiateView(ViewId sourceId, Entity entity)
        {
            if (this.world.settings.turnOffViews == true)
            {
                return;
            }

            // Called by tick system
            if (this.world.HasStep(WorldStep.LogicTick) == false && this.world.HasResetState() == true)
            {
                throw new OutOfStateException();
            }

            if (this.registryIdToPrefab.ContainsKey(sourceId) == false)
            {
                throw new ViewRegistryNotFoundException(sourceId);
            }

            var viewInfo = new ViewInfo(entity, sourceId, this.world.GetStateTick());

            var component = this.world.AddComponent <ViewComponent>(entity);

            component.viewInfo = viewInfo;
            component.seed     = (uint)this.world.GetSeedValue();

            /*var request = this.world.AddComponent<CreateViewComponentRequest<TState>, IViewComponentRequest<TState>>(entity);
             * request.viewInfo = viewInfo;
             * request.seed = component.seed;*/

            this.isRequestsDirty = true;
        }
Beispiel #16
0
        protected override void OnConstruct()
        {
            this.bulletViewId       = this.world.RegisterViewSource(this.bulletView);
            this.bulletEffectViewId = this.world.RegisterViewSource(this.bulletEffectView);

            this.AddSystem <FireSystem>();
            this.AddSystem <BulletFlySystem>();
        }
        public CandidatePostsIndexView(CandidatePostsController controller)
        {
            InitializeComponent();

            _viewId = ViewId.CandidatePostsIndex;
            _controller = controller;
            this.DataContext = controller;
        }
Beispiel #18
0
 public ViewDTO(ViewId id, CustomerId customerid, string accesskey, ViewCustomizationDTO customization, List <ViewColumnDTO> columns)
 {
     Id            = id;
     CustomerId    = customerid;
     AccessKey     = accesskey;
     Customization = customization;
     Columns       = columns;
 }
Beispiel #19
0
        public IView GetViewSource(ViewId viewSourceId)
        {
            if (this.registryIdToPrefab.TryGetValue(viewSourceId, out var prefab) == true)
            {
                return(prefab);
            }

            return(null);
        }
Beispiel #20
0
        public async Task <IActionResult> GetViewPageAsync(Guid viewId, string clientUUId, string page)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ApiError(400, ModelState)));
            }

            var loginViewId = _membership.GetViewId(User);
            var urlViewId   = new ViewId(viewId);

            if (loginViewId != urlViewId)
            {
                return(BadRequest(new ApiError(400, "View Id mismatch")));
            }

            var customerId = _membership.GetCustomerId(User);
            // don't need to get view - we currently only query by client id paged by month, they are not configurable in View yet
            int year  = DateTime.UtcNow.Year,
                month = DateTime.UtcNow.Month;

            if (!String.IsNullOrEmpty(page))
            {
                if (page.Length != 6)
                {
                    return(BadRequest(new ApiError(400, "Unrecognizeable page requested (1)")));
                }

                if (!int.TryParse(page.Substring(0, 4), out year) ||
                    !int.TryParse(page.Substring(4, 2), out month))
                {
                    return(BadRequest(new ApiError(400, "Unrecognizeable page requested (2)")));
                }
            }
            var pageStart = new DateTime(year, month, 1, 0, 0, 0, DateTimeKind.Utc);
            var pageEnd   = pageStart.AddMonths(1);
            var entries   = await _persistence.EventEntries.SearchAsync(customerId, clientUUId, pageStart, pageEnd);

            var prevPage = pageStart.AddMonths(-1);
            var nextPage = pageStart.AddMonths(1);

            var result = new PagedViewResult(new EventSearchId(DateTime.UtcNow, "GET", $"/api/v1/views/{viewId}/{clientUUId}?page={pageStart.ToString("yyyyMM")}", pageStart.ToString("MMMM yyyy")));

            if (prevPage > DateTime.UtcNow.AddMonths(-12) && entries.Count > 0)
            {
                result.Links.Add("previous", new PagedViewLink(prevPage.ToString("MMMM yyyy"), "GET", $"/api/v1/views/{viewId}/{clientUUId}?page={prevPage.ToString("yyyyMM")}"));
            }
            if (nextPage < DateTime.UtcNow)
            {
                result.Links.Add("next", new PagedViewLink(nextPage.ToString("MMMM yyyy"), "GET", $"/api/v1/views/{viewId}/{clientUUId}?page={nextPage.ToString("yyyyMM")}"));
            }
            result.Entries = entries.Select(e => new RecordedEvent(e, "/api/v1/events/"))
                             .ToList();

            return(Ok(result));
        }
 public override void EnteringView(ViewId viewId)
 {
     Feedback = "";
     switch (viewId)
     {
         case ViewId.CandidateShow:
             GetOne(); break;
         case ViewId.CandidatePostsIndex:
             GetAll(); break;
     }
 }
 public override void EnteringView(ViewId viewId)
 {
     Feedback = "";
     switch (viewId)
     {
         case ViewId.UserShow:
             GetOne(); break;
         default:
             Feedback += "ViewId = " + viewId.ToString() + " not implemented yet!!\n"; break;
     }
 }
        public override IView Spawn(IView prefab, ViewId prefabSourceId)
        {
            var view = this.pool.Spawn((MonoBehaviourView)prefab, prefabSourceId);

            if (this.world.debugSettings.showViewsOnScene == false || this.world.debugSettings.viewsSettings.unityGameObjectProviderShowOnScene == false)
            {
                view.gameObject.hideFlags = UnityEngine.HideFlags.HideInHierarchy;
            }

            return(view);
        }
Beispiel #24
0
        IViewsProviderBase IViewModuleBase.GetViewSourceProvider(ViewId viewSourceId)
        {
            IViewsProvider provider;

            if (this.registryPrefabToProvider.TryGetValue(viewSourceId, out provider) == true)
            {
                return(provider);
            }

            return(null);
        }
Beispiel #25
0
        protected override void OnConstruct()
        {
            this.playerViewId = this.world.RegisterViewSource(this.playerView);

            var net = this.world.GetModule <NetworkModule>();

            net.RegisterObject(this, 1);
            this.createPlayerRpcId = net.RegisterRPC(new System.Action <int>(this.CreatePlayer_RPC).Method);

            this.AddSystem <NetworkMessagesSystem>();
        }
Beispiel #26
0
        }//ToXml()

        public JObject ToJson()
        {
            //JObject Ret = new JObject();

            JObject RootPropObj = new JObject();

            //Ret[CswEnumNbtViewXmlNodeName.TreeView.ToString()] = RootPropObj;

            RootPropObj["nodename"]           = CswEnumNbtViewXmlNodeName.TreeView.ToString().ToLower();
            RootPropObj["viewname"]           = ViewName;
            RootPropObj["version"]            = "1.0";
            RootPropObj["iconfilename"]       = IconFileName;
            RootPropObj["selectable"]         = Selectable.ToString().ToLower();
            RootPropObj["mode"]               = ViewMode.ToString();
            RootPropObj["width"]              = (Width > 0) ? Width.ToString() : "";
            RootPropObj["viewid"]             = (ViewId.isSet()) ? ViewId.get().ToString() : "";
            RootPropObj["category"]           = Category;
            RootPropObj["visibility"]         = Visibility.ToString();
            RootPropObj["visibilityroleid"]   = (VisibilityRoleId != null) ? VisibilityRoleId.PrimaryKey.ToString() : "";
            RootPropObj["visibilityrolename"] = (VisibilityRoleId != null) ? _CswNbtResources.Nodes[VisibilityRoleId].NodeName : "";
            RootPropObj["visibilityuserid"]   = (VisibilityUserId != null) ? VisibilityUserId.PrimaryKey.ToString() : "";
            RootPropObj["visibilityusername"] = (VisibilityUserId != null) ? _CswNbtResources.Nodes[VisibilityUserId].NodeName : "";
            RootPropObj["groupbysiblings"]    = GroupBySiblings;
            RootPropObj["included"]           = Included.ToString().ToLower();
            RootPropObj["isdemo"]             = IsDemo.ToString().ToLower();
            RootPropObj["issystem"]           = IsSystem.ToString().ToLower();
            RootPropObj["includetempnodes"]   = IncludeTempNodes.ToString().ToLower();
            RootPropObj["gridgroupbycol"]     = GridGroupByCol.ToString().ToLower();
            RootPropObj["showdelete"]         = false; //for ViewContentTree - don't show the "X" on view root

            JObject ChildObject = new JObject();

            if (null == RootPropObj[_ChildRelationshipsName] ||
                RootPropObj[_ChildRelationshipsName].Type != JTokenType.Object)
            {
                RootPropObj[_ChildRelationshipsName] = ChildObject;

                // Recurse on child ViewNodes
                foreach (CswNbtViewRelationship ChildRelationship in ChildRelationships)
                {
                    JProperty ChildRelationshipProp = ChildRelationship.ToJson();
                    if (null == ChildObject[ChildRelationshipProp.Name])
                    {
                        ChildObject.Add(ChildRelationshipProp);
                    }
                }
            }
            //return Ret;
            return(RootPropObj);
        }//ToXml()
Beispiel #27
0
 /// <summary>
 /// Refreshes the cached view name
 /// </summary>
 public void RefreshViewName()
 {
     //bz # 8758
     CachedViewName = string.Empty;
     if (ViewId.isSet())
     {
         CswNbtView View = _CswNbtResources.ViewSelect.restoreView(ViewId);
         if (View != null)
         {
             CachedViewName = View.ViewName;
         }
     }
     this.PendingUpdate = false;
 }
Beispiel #28
0
        public questStatus Delete(DbMgrTransaction trans, ViewId viewId)
        {
            // Initialize
            questStatus status = null;


            // Delete view
            status = _dbViewsMgr.Delete(trans, viewId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #29
0
        public questStatus Delete(ViewId viewId)
        {
            // Initialize
            questStatus status = null;


            // Delete all columns in this view.
            status = _dbColumnsMgr.Delete(viewId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #30
0
        public questStatus Delete(DbMgrTransaction trans, ViewId viewId)
        {
            // Initialize
            questStatus status = null;


            // Perform delete in this transaction.
            status = delete((MasterPricingEntities)trans.DbContext, viewId);
            if (!questStatusDef.IsSuccess(status))
            {
                RollbackTransaction(trans);
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #31
0
        /*==================================================================================================================================
        * Properties
        *=================================================================================================================================*/
        #endregion


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/

        #region CRUD Operations
        //----------------------------------------------------------------------------------------------------------------------------------
        // CRUD Operations
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus Create(View view, out ViewId viewId)
        {
            // Initialize
            viewId = null;
            questStatus status = null;


            // Create view
            status = _dbViewsMgr.Create(view, out viewId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #32
0
        public questStatus Read(DbMgrTransaction trans, ViewId viewId, out List <Quest.Functional.MasterPricing.Column> columnList)
        {
            // Initialize
            questStatus status = null;

            columnList = null;


            // Read column
            status = _dbColumnsMgr.Read(trans, viewId, out columnList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
        public void NavigateTo(ViewId id, Dictionary<string, string> parameters)
        {
            if (_viewsMap.ContainsKey(id))
            {
                if (parameters != null)
                {
                    MainController.Instance.global_parameters.Clear();
                    foreach (var p in parameters)
                        MainController.Instance.global_parameters.Add(p.Key, p.Value);
                }

                var view = _viewsMap[id];
                MainController.Instance.CurrentView = view;
            }
            else throw new Exception("View " + id.ToString() + " was not found in the dictionary");
        }
Beispiel #34
0
        public questStatus Read(DbMgrTransaction trans, ViewId viewId, out View view)
        {
            // Initialize
            questStatus status = null;

            view = null;


            // Read view
            status = _dbViewsMgr.Read(trans, viewId, out view);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
 public override void LeavingView(ViewId id)
 {
 }
 public override void LeavingView(ViewId id)
 {
     throw new NotImplementedException();
 }
 public void AddView(ViewId id, UserControl view)
 {
     _viewsMap.Add(id, view);
 }
Beispiel #38
0
        /// <remarks>
        /// Called by <c>Join()</c> when no initial members can be detected
        /// </remarks>
        /// <summary>
        /// Changes the GMS to a Coord implementation
        /// </summary>
        /// <param name="mbr">Local Address representing this Channel</param>
        private void becomeSingletonMember(Address mbr)
        {
            Digest		initial_digest;
            ViewId		view_id=null;
            ArrayList   mbrs=new ArrayList();

            // set the initial digest (since I'm the first member)
            initial_digest = new Digest(1);             // 1 member (it's only me)
            initial_digest.add(gms.local_addr, 0, 0); // initial seqno mcast by me will be 1 (highest seen +1)
            gms.setDigest(initial_digest);

            view_id=new ViewId(mbr);       // create singleton view with mbr as only member
            mbrs.Add(mbr);
            gms.installView(new View(view_id, mbrs));
            gms.becomeCoordinator();

            gms.passUp(new Event(Event.BECOME_SERVER));
            gms.passDown(new Event(Event.BECOME_SERVER));
            if(Trace.trace) Trace.info("ClientGmsImpl.becomeSingletonMember()",
                                "created group (first member). My view is " + gms.view_id +
                                ", impl is " + gms.getImpl().getName());
        }
 public abstract void EnteringView(ViewId id);
 public abstract void LeavingView(ViewId id);
Beispiel #41
0
        /// <summary>
        /// Sets the new view and sends a VIEW_CHANGE event up and down the stack.
        /// </summary>
        /// <param name="new_view">New View to install</param>
        public void installView(View new_view)
        {
            Address coord;
            int     rc;
            ViewId  vid=new_view.getVid();
            ArrayList  mbrs=new_view.getMembers();

            lock(members)
            {                  // serialize access to views
                ltime=Math.Max(vid.getId(), ltime);  // compute Lamport logical time

                /* Check for self-inclusion: if I'm not part of the new membership, I just discard it.
                       This ensures that messages sent in view V1 are only received by members of V1 */
                if(Trace.trace)
                    Trace.info("GMS.installView()","View to install contains: " + new_view.ToString());
                if(checkSelfInclusion(mbrs) == false)
                {
                    if(Trace.trace)
                        Trace.warn("GMS.installView()",
                            "checkSelfInclusion() failed, not a member of view " + mbrs + "; discarding view");
                    if(shun)
                    {
                        if(Trace.trace)
                            Trace.warn("GMS.installView()", "I'm being shunned, will leave and rejoin group");
                        passUp(new Event(Event.EXIT));
                    }
                    return;
                }

                // Discards view with id lower than our own. Will be installed without check if first view
                if(view_id != null)
                {
                    rc = vid.CompareTo(view_id);
                    if(rc <= 0)
                    {
                        if(Trace.trace)
                            Trace.error("GMS.installView()", "received view <= current view;" +
                                " discarding it ! (current vid: " + view_id + ", new vid: " + vid +")");
                        return;
                    }
                }

                if(Trace.trace) Trace.info("GMS.installView()", "view is " + new_view);

                // assign new_view to view_id
                view_id=vid.Copy();

                // Set the membership. Take into account joining members
                if(mbrs != null && mbrs.Count > 0)
                {
                    members.set(mbrs);
                    tmp_members.set(members);
                    foreach(Object obj in mbrs)
                    {
                        joining.Remove(obj); // remove all members in mbrs from joining
                    }
                    tmp_members.add(joining); // adjust temporary membership
                }

                // Send VIEW_CHANGE event up and down the stack:
                Event view_event=new Event(Event.VIEW_CHANGE, (View)new_view.copy());
                passDown(view_event); // needed e.g. by failure detector or UDP
                passUp(view_event);

                coord=determineCoordinator();
                if(coord != null && coord.Equals(local_addr) && !(coord.Equals(vid.getCoordAddress())))
                {
                    becomeCoordinator();
                }
                else
                {
                    if(haveCoordinatorRole() && !local_addr.Equals(coord))
                        becomeParticipant();
                }
            }
        }
Beispiel #42
0
 /* ------------------------------- Private Methods --------------------------------- */
 /// <summary>
 /// Sets the current GMS implementation to Client and resets the viewID
 /// </summary>
 private void initState()
 {
     becomeClient();
     view_id=null;
 }