Exemplo n.º 1
0
        private Section RenderEditItemFields(Item item, ItemType itemtype, bool primary)
        {
            Section section = new Section();

            // render fields
            foreach (Field f in itemtype.Fields.Where(f => f.IsPrimary == primary).OrderBy(f => f.SortOrder))
            {
                var e = RenderEditItemField(item, f);
                if (e != null)
                    section.Add(e);
            }

            return section;
        }
Exemplo n.º 2
0
        private void CreateItem(string name, Folder folder, ItemType itemType, Guid parentID)
        {
            // figure out the sort value
            float sortOrder = 1000f;
            var listItems = folder.Items.Where(it => it.ParentID == parentID).ToList();
            if (listItems.Count > 0)
                sortOrder += listItems.Max(it => it.SortOrder);

            // create the new item
            Item item = new Item()
            {
                Name = name,
                FolderID = folder.ID,
                ItemTypeID = itemType.ID,
                ParentID = parentID,
                SortOrder = sortOrder
            };

            // hack: special case processing for item types that have a Complete field
            // if it exists, set it to false
            if (itemType.HasField("Complete"))
                item.Complete = false;

            // enqueue the Web Request Record
            RequestQueue.EnqueueRequestRecord(RequestQueue.UserQueue,
                new RequestQueue.RequestRecord()
                {
                    ReqType = RequestQueue.RequestRecord.RequestType.Insert,
                    Body = item
                });

            // add the item to the folder
            folder.Items.Add(item);
        }
Exemplo n.º 3
0
 public ItemType(ItemType itemType)
 {
     Copy(itemType);
 }
Exemplo n.º 4
0
        public void Copy(ItemType obj)
        {
            if (obj == null)
                return;

            // copy all of the properties
            foreach (PropertyInfo pi in this.GetType().GetProperties())
            {
                var val = pi.GetValue(obj, null);
                pi.SetValue(this, val, null);
            }
        }
Exemplo n.º 5
0
        private void RenderEditItemFields(Item item, ItemType itemtype, bool primary, bool renderListField)
        {
            // render fields
            foreach (Field f in itemtype.Fields.Where(f => f.IsPrimary == primary).OrderBy(f => f.SortOrder))
                RenderEditItemField(item, f);

            if (renderListField == true)
            {
                Field field = new Field() { Name = "ParentID", DisplayName = "List", DisplayType = DisplayTypes.Lists };
                RenderEditItemField(item, field);

                field = new Field() { Name = "ItemTypeID", DisplayName = "Type", DisplayType = DisplayTypes.ItemTypes };
                RenderEditItemField(item, field);
            }

            // refresh the keyboard tabstops
            keyboardHelper.RefreshTabbedControls(null);
        }
Exemplo n.º 6
0
        private void RenderEditItem(Item item, bool renderListInfo)
        {
            // get itemType for this item
            try
            {
                itemType = App.ViewModel.ItemTypes.Single(it => it.ID == item.ItemTypeID);
            }
            catch (Exception)
            {
                // if can't find the folder type, use the first
                itemType = App.ViewModel.ItemTypes[0];
            }

            // render the primary fields
            RenderEditItemFields(item, itemType, true, renderListInfo);

            // render more button
            moreButton = new Button() { Content = "more details" };
            moreButton.Click += new RoutedEventHandler(MoreButton_Click);
            EditListBox.Items.Add(moreButton);
        }