예제 #1
0
        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        public bool AddItem(UPCharacteristicsItem item)
        {
            if (this.itemDict.ContainsKey(item.CatalogValue))
            {
                return(false);
            }

            this.itemArray.Add(item);
            this.itemDict[item.CatalogValue] = item;
            return(true);
        }
예제 #2
0
        /// <summary>
        /// Returns changed records.
        /// </summary>
        /// <returns></returns>
        public override List <UPCRMRecord> ChangedRecords()
        {
            if (this.IsReadOnly)
            {
                return(null);
            }

            UPMCharacteristicsPage characteristicsPage = (UPMCharacteristicsPage)this.Page;

            foreach (UPMCharacteristicsItemGroup group in characteristicsPage.Children)
            {
                foreach (UPMCharacteristicsItem item in group.Children)
                {
                    UPCharacteristicsItem crmItem = this.FindCharacteristicItemWithGroupIdentifierItemIdentifier(group.Identifier, item.Identifier);
                    bool updateEditFields         = true;
                    if (item.SelectedField.Changed)
                    {
                        if (crmItem != null)
                        {
                            if (item.SelectedField.BoolValue)
                            {
                                crmItem.MarkItemAsSet();
                            }
                            else
                            {
                                crmItem.MarkItemAsUnset();
                                updateEditFields = false;
                            }
                        }
                    }

                    if (updateEditFields)
                    {
                        for (int editFieldIndex = 0; editFieldIndex < item.EditFields.Count; editFieldIndex++)
                        {
                            UPMEditField field = item.EditFields[editFieldIndex] as UPMEditField;
                            if (field != null && field.Changed)
                            {
                                List <UPEditFieldContext> fieldContextList = this.editPageContext.EditFields.Values.ToList();
                                foreach (UPEditFieldContext fieldContext in fieldContextList)
                                {
                                    if (fieldContext.EditField == field)
                                    {
                                        crmItem?.SetValueForAdditionalFieldPosition(fieldContext.Value, editFieldIndex);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(this.Characteristics?.ChangedRecords());
        }