Ejemplo n.º 1
0
 /// <summary>
 /// Create a new ItemExclusion object.
 /// </summary>
 /// <param name="itemExclusionID">Initial value of the ItemExclusionID property.</param>
 /// <param name="publicKey">Initial value of the PublicKey property.</param>
 public static ItemExclusion CreateItemExclusion(global::System.Int32 itemExclusionID, global::System.String publicKey)
 {
     ItemExclusion itemExclusion = new ItemExclusion();
     itemExclusion.ItemExclusionID = itemExclusionID;
     itemExclusion.PublicKey = publicKey;
     return itemExclusion;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ItemExclusions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToItemExclusions(ItemExclusion itemExclusion)
 {
     base.AddObject("ItemExclusions", itemExclusion);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a List Item Exclusion which will hide this List Item
        /// from Consumers on a Shared List
        /// </summary>
        /// <param name="listSharePublicKey"></param>
        /// <param name="itemPublicKey"></param>
        /// <returns></returns>
        public ItemExclusion ItemExclusion_Create(int listShareID, int itemID)
        {
            ItemExclusion rcItemExclusion = new ItemExclusion();
            // First, make sure  the ListShare and Item exist
            if ((listShareID != null) && (itemID != null ))
            {
                // Make sure we don't already have an ItemExclusion for this
                if (ItemExclusion_Count(listShareID, itemID) == 0)
                {
                    try
                    {
                        rcItemExclusion.ItemID = itemID;
                        rcItemExclusion.CreateDate = DateTime.Now;
                        rcItemExclusion.ListShareID = listShareID;
                        rcItemExclusion.PublicKey = GeneratePublicKey();

                        _gyftoListEntities.ItemExclusions.AddObject(rcItemExclusion);
                        _gyftoListEntities.SaveChanges();

                    }
                    catch (Exception e)
                    {
                        throw new Exception(string.Format("Unable to create List Item Exclusion '{0}'", e.ToString()));
                    }
                }
            }
            else
            {
                throw new Exception("Unable to create Item Exclusion - either List Share Public Key or Item Public Key not provided");
            }

            return rcItemExclusion;
        }