public IList <T> GetByForeignKey(string key, Int64 value, string sortKey, MPRController.Direction direction)
        {
            MPRSession session = MPRController.StartSession();
            IList <T>  items   = MPRController.RetrieveByForeignKey <T>(session, key, value, sortKey, direction);

            MPRController.EndSession(session, true);
            return(items);
        }
        public void TestForeignKey()
        {
            MPRSession            session  = MPRController.StartSession();
            IList <MPItemVersion> versions =
                MPRController.RetrieveByForeignKey <MPItemVersion>(session, "Item", 11);

            foreach (MPItemVersion version in versions)
            {
                System.Console.WriteLine("{0} : {1}", version.Version, version.UpdateDate);
            }

            MPRController.EndSession(session, true);
        }
예제 #3
0
        public void GetCategoriesForType()
        {
            Int64 typeId = 4;

            MPRSession session = MPRController.StartSession();

            IList <MPCategory> categories = MPRController.RetrieveByForeignKey <MPCategory>(session, "Type", typeId);

            foreach (MPCategory category in categories)
            {
                System.Console.WriteLine("{0}:{1}:{2};", category.Id, category.Name, category.Description);
            }

            MPRController.EndSession(session, true);
        }
        public string GetCategories(Int64 typeId)
        {
            MPRSession         session    = MPRController.StartSession();
            IList <MPCategory> categories = MPRController.RetrieveByForeignKey <MPCategory>(session, "Type", typeId);

            string result = "";

            foreach (MPCategory category in categories)
            {
                result += System.String.Format("{0}:{1}:{2};", category.Id, category.Name, category.Type);
            }

            MPRController.EndSession(session, true);

            return(result);
        }
예제 #5
0
        protected void FillCategoriesForSelectedItemType(MPRSession session)
        {
            if (typesList.SelectedValue == null)
            {
                return;
            }

            // Remove the previous categories
            categoriesList.Items.Clear();

            // Fill the categories for the selected type
            Int64 typeId;

            Int64.TryParse(typesList.SelectedValue, out typeId);
            IList <MPCategory> categories = MPRController.RetrieveByForeignKey <MPCategory>(session, "Type", typeId);

            foreach (MPCategory category in categories)
            {
                categoriesList.Items.Add(new ListItem(category.Name, category.Id.ToString()));
            }
        }