Пример #1
0
        public SheetCell(String value, EquatableBindingList <CategoryItem> categoryItems)
        {
            try
            {
                Value         = value;
                CategoryItems = categoryItems;

                if (CategoryItems != null)
                {
                    CategoryItems.ListChanged += new ListChangedEventHandler(CategoryItems_ListChanged);
                }
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);

                throw;
            }
        }
        /// <summary>
        /// Syncs property values from working fields to reference fields.
        /// </summary>
        public override void Sync()
        {
            try
            {
                __Version = _Version;
                __Sheets  = ObjectHelper.Clone <EquatableBindingList <Sheet> >(_Sheets, Ssepan.Utility.SerializationFormat.DataContract);

                //DEBUG:(breaks Dirty flag)
                //force Dirty to False in sheets Equal comparison
                base.Sync();

                //Note:where we have cloned collections; the collection comparison will never find the orignla items in the cloned collection if it is looking at identity vs content--SJS
                //if (Dirty)
                //{
                //    throw new ApplicationException("Sync failed.");
                //}
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);

                throw;
            }
        }