public ZoneName AddZoneName(int vZoneNameID, string vTitle, DateTime vAddedDate, string vAddedBy, DateTime vUpdatedDate, string vUpdatedBy, bool vActive)
        {
            ZoneName lZoneName = new ZoneName();

            using (FRShoppingEntities frctx = new FRShoppingEntities())
            {
                if (vZoneNameID > 0)
                {
                    lZoneName       = frctx.ZoneNames.FirstOrDefault(u => u.ZoneNameId == vZoneNameID);
                    lZoneName.Title = vTitle;

                    lZoneName.UpdatedDate = vUpdatedDate;
                    lZoneName.UpdatedBy   = vUpdatedBy;
                    lZoneName.Active      = vActive;
                    return(frctx.SaveChanges() > 0 ? lZoneName : null);
                }
                else
                {
                    lZoneName.Title = vTitle;

                    lZoneName.AddedDate   = vAddedDate;
                    lZoneName.AddedBy     = vAddedBy;
                    lZoneName.UpdatedDate = vUpdatedDate;
                    lZoneName.UpdatedBy   = vUpdatedBy;
                    lZoneName.Active      = vActive;
                    return(AddZoneName(lZoneName));
                }
            }
        }
        public override void Render(TextWriter writer)
        {
            if (state == ControlPanelState.DragDrop)
            {
                if (ZoneName.IndexOfAny(new[] { '.', ',', ' ', '\'', '"', '\t', '\r', '\n' }) >= 0)
                {
                    throw new N2Exception("Zone '" + ZoneName + "' contains illegal characters.");
                }

                writer.Write("<div class='" + ZoneName + " dropZone'");
                writer.WriteAttribute(PartUtilities.PathAttribute, CurrentItem.Path)
                .WriteAttribute(PartUtilities.ZoneAttribute, ZoneName)
                .WriteAttribute(PartUtilities.AllowedAttribute, PartUtilities.GetAllowedNames(ZoneName, PartsAdapter.GetAllowedDefinitions(CurrentItem, ZoneName, Html.ViewContext.HttpContext.User)))
                .WriteAttribute("title", ZoneTitle ?? DroppableZone.GetToolTip(Html.ResolveService <IDefinitionManager>().GetDefinition(CurrentItem), ZoneName))
                .Write(">");

                RenderPreview(writer);

                writer.Write("</div>");
            }
            else if (state == ControlPanelState.Previewing)
            {
                RenderPreview(writer);
            }
            else
            {
                base.Render(writer);
            }
        }
Esempio n. 3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ZoneId != 0)
            {
                hash ^= ZoneId.GetHashCode();
            }
            if (ZoneName.Length != 0)
            {
                hash ^= ZoneName.GetHashCode();
            }
            if (ServerId != 0)
            {
                hash ^= ServerId.GetHashCode();
            }
            if (ServerName.Length != 0)
            {
                hash ^= ServerName.GetHashCode();
            }
            if (Status != 0)
            {
                hash ^= Status.GetHashCode();
            }
            if (UserCount != 0)
            {
                hash ^= UserCount.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 4
0
        protected override void CreateItems(Control container)
        {
            if (State.IsFlagSet(ControlPanelState.DragDrop) && (AllowExternalManipulation || CurrentItem == CurrentPage || Find.ClosestPage(CurrentItem) == CurrentPage))
            {
                if (ZoneName.IndexOfAny(new[] { '.', ',', ' ', '\'', '"', '\t', '\r', '\n' }) >= 0)
                {
                    throw new N2Exception("Zone '" + ZoneName + "' contains illegal characters.");
                }

                Panel zoneContainer = AddPanel(this, ZoneName + " dropZone");
                if (CurrentItem.ID != 0 && !CurrentItem.VersionOf.HasValue)
                {
                    zoneContainer.Attributes[PartUtilities.PathAttribute] = CurrentItem.Path;
                }
                else
                {
                    zoneContainer.Attributes[PartUtilities.PathAttribute] = Find.ClosestPage(CurrentItem).Path;
                    zoneContainer.Attributes["data-versionKey"]           = CurrentItem.GetVersionKey();
                    zoneContainer.Attributes["data-versionIndex"]         = CurrentItem.VersionIndex.ToString();
                }
                zoneContainer.Attributes[PartUtilities.ZoneAttribute]    = ZoneName;
                zoneContainer.Attributes[PartUtilities.AllowedAttribute] = PartUtilities.GetAllowedNames(ZoneName, PartsAdapter.GetAllowedDefinitions(CurrentItem, ZoneName, Page.User));

                zoneContainer.ToolTip = GetToolTip(GetDefinition(CurrentItem), ZoneName);
                base.CreateItems(zoneContainer);
            }
            else
            {
                base.CreateItems(this);
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ZoneName != null)
            {
                ZoneName.Dispose();
                ZoneName = null;
            }

            if (ZoneTypeOptions != null)
            {
                ZoneTypeOptions.Dispose();
                ZoneTypeOptions = null;
            }

            if (ApplyButton != null)
            {
                ApplyButton.Dispose();
                ApplyButton = null;
            }

            if (CancelButton != null)
            {
                CancelButton.Dispose();
                CancelButton = null;
            }
        }
Esempio n. 6
0
        public override void Render(TextWriter writer)
        {
            if (writer == null)
            {
                throw new NullReferenceException("writer cannot be null");
            }

            if (state.IsFlagSet(ControlPanelState.DragDrop))
            {
                if (String.IsNullOrWhiteSpace(ZoneName))
                {
                    throw new N2Exception("Zone name cannot be null, empty, or consist only of whitespace.");
                }
                if (ZoneName.IndexOfAny(new[] { '.', ',', ' ', '\'', '"', '\t', '\r', '\n' }) >= 0)
                {
                    throw new N2Exception("Zone '" + ZoneName + "' contains illegal characters.");
                }
                if (CurrentItem == null)
                {
                    throw new N2Exception("CurrentItem cannot be null");
                }
                var dm = Html.ResolveService <IDefinitionManager>();
                if (dm == null)
                {
                    throw new N2Exception("Failed to resolve the definition manager.");
                }



                writer.Write("<div class=\"" + ZoneName + " dropZone\"");
                if (CurrentItem.ID != 0 && !CurrentItem.VersionOf.HasValue)
                {
                    writer.WriteAttribute("data-id", CurrentItem.ID.ToString());
                    writer.WriteAttribute(PartUtilities.PathAttribute, CurrentItem.Path);
                }
                else
                {
                    writer.WriteAttribute(PartUtilities.PathAttribute, (Find.ClosestPage(CurrentItem) ?? CurrentItem).Path);
                    writer.WriteAttribute("data-versionKey", CurrentItem.GetVersionKey());
                    writer.WriteAttribute("data-versionIndex", CurrentItem.VersionIndex.ToString());
                }
                writer.WriteAttribute(PartUtilities.ZoneAttribute, ZoneName)
                .WriteAttribute(PartUtilities.AllowedAttribute, PartUtilities.GetAllowedNames(ZoneName, PartsAdapter.GetAllowedDefinitions(CurrentItem, ZoneName, Html.ViewContext.HttpContext.User)))
                .WriteAttribute("title", ZoneTitle ?? DroppableZone.GetToolTip(dm.GetDefinition(CurrentItem), ZoneName));
                writer.Write(">");

                RenderPreview(writer);

                writer.Write("</div>");
            }
            else if (state.IsFlagSet(ControlPanelState.Previewing))
            {
                RenderPreview(writer);
            }
            else
            {
                base.Render(writer);
            }
        }
Esempio n. 7
0
    public Zone(ZoneName name, Vector2 centerPoint, Vector3 extents)
    {
        this.name        = name;
        this.centerPoint = centerPoint;
        this.extents     = extents;

        //initially there is no receiver in the zone
        this.receiverInZone = null;
    }
        public ZoneName AddZoneName(ZoneName vZoneName)
        {
            try
            {
                Shoppingctx.ZoneNames.Add(vZoneName);
                base.PurgeCacheItems(CacheKey);

                return(Shoppingctx.SaveChanges() > 0 ? vZoneName : null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        /// <summary>Snippet for ListEntitiesAsync</summary>
        public async Task ListEntitiesRequestObjectAsync()
        {
            // Snippet: ListEntitiesAsync(ListEntitiesRequest, CallSettings)
            // Create client
            MetadataServiceClient metadataServiceClient = await MetadataServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListEntitiesRequest request = new ListEntitiesRequest
            {
                ParentAsZoneName = ZoneName.FromProjectLocationLakeZone("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]"),
                View             = ListEntitiesRequest.Types.EntityView.Unspecified,
                Filter           = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListEntitiesResponse, Entity> response = metadataServiceClient.ListEntitiesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Entity item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListEntitiesResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Entity item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int           pageSize   = 10;
            Page <Entity> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Entity item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for ListEntities</summary>
        public void ListEntitiesResourceNames()
        {
            // Snippet: ListEntities(ZoneName, string, int?, CallSettings)
            // Create client
            MetadataServiceClient metadataServiceClient = MetadataServiceClient.Create();
            // Initialize request argument(s)
            ZoneName parent = ZoneName.FromProjectLocationLakeZone("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]");
            // Make the request
            PagedEnumerable <ListEntitiesResponse, Entity> response = metadataServiceClient.ListEntities(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Entity item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListEntitiesResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Entity item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int           pageSize   = 10;
            Page <Entity> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Entity item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Esempio n. 11
0
        protected override void CreateItems(Control container)
        {
            if (State == ControlPanelState.DragDrop && (AllowExternalManipulation || CurrentItem == CurrentPage))
            {
                if (ZoneName.IndexOfAny(new[] { '.', ',', ' ', '\'', '"', '\t', '\r', '\n' }) >= 0)
                {
                    throw new N2Exception("Zone '" + ZoneName + "' contains illegal characters.");
                }

                Panel zoneContainer = AddPanel(this, ZoneName + " dropZone");
                zoneContainer.Attributes[PartUtilities.PathAttribute]    = CurrentItem.Path;
                zoneContainer.Attributes[PartUtilities.ZoneAttribute]    = ZoneName;
                zoneContainer.Attributes[PartUtilities.AllowedAttribute] = PartUtilities.GetAllowedNames(ZoneName, PartsAdapter.GetAllowedDefinitions(CurrentItem, ZoneName, Page.User));
                zoneContainer.ToolTip = GetToolTip(GetDefinition(CurrentItem), ZoneName);
                base.CreateItems(zoneContainer);
            }
            else
            {
                base.CreateItems(this);
            }
        }
Esempio n. 12
0
 public static bool IsPrivate(this Zone zone)
 {
     return(zone.Name switch
     {
         ZoneName.Attached => true,
         ZoneName.Create => true,
         ZoneName.Deck => true,
         ZoneName.DeckBottom => true,
         ZoneName.DeckTop => true,
         ZoneName.Discard => false,
         ZoneName.Hand => true,
         ZoneName.InPlay => false,
         ZoneName.PlayerMat => true,
         ZoneName.RecentBuys => false,
         ZoneName.RecentGains => false,
         ZoneName.RecentPlays => false,
         ZoneName.Revealed => false,
         ZoneName.Stash => true,
         ZoneName.Supply => false,
         ZoneName.Trash => false,
         ZoneName unknown => throw new NotSupportedException($"Unknown privacy zone {unknown}")
     });
Esempio n. 13
0
 public static string GetBiddingZone(ZoneName zoneName)
 {
     return(_biddingZones.Where(i => i.Key == zoneName.ToString().Replace("_", "-")).FirstOrDefault().Value);
 }
Esempio n. 14
0
 public ZoneName UpdateZoneName(ZoneName vZoneName)
 {
     throw new NotImplementedException();
 }
Esempio n. 15
0
 public bool UnDeleteZoneName(ZoneName vZoneName)
 {
     throw new NotImplementedException();
 }