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; }
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); }
public ItemType(ItemType itemType) { Copy(itemType); }
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); } }
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); }
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); }