コード例 #1
0
        public static object ApplySpreadsheetData(
            this object asset,
            ISpreadsheetData spreadsheetData,
            string sheetName,
            object keyValue       = null,
            string sheetFieldName = "")
        {
            if (spreadsheetData.HasSheet(sheetName) == false)
            {
                return(asset);
            }

            var syncAsset = asset.CreateSheetScheme();

            var sheetValueIndo = new SheetValueInfo
            {
                Source          = asset,
                SheetName       = sheetName,
                SpreadsheetData = spreadsheetData,
                SyncScheme      = syncAsset,
                SyncFieldName   = sheetFieldName,
                SyncFieldValue  = keyValue,
                StartColumn     = 0
            };

            return(DefaultProcessor.ApplyData(sheetValueIndo));
        }
        public override IEnumerable <object> ImportObjects(IEnumerable <object> source, ISpreadsheetData spreadsheetData)
        {
            var result = new List <object>();

            foreach (var item in source.OfType <SheetSyncItem>())
            {
                if (!spreadsheetData.HasSheet(item.sheetId) || item.asset == null)
                {
                    continue;
                }
                var asset = item.asset.
                            ApplySpreadsheetData(spreadsheetData, item.sheetId);
                result.Add(asset);
            }

            return(result);
        }