当前位置: 首页>>代码示例>>C#>>正文


C# SpreadsheetsService.Batch方法代码示例

本文整理汇总了C#中Google.GData.Spreadsheets.SpreadsheetsService.Batch方法的典型用法代码示例。如果您正苦于以下问题:C# SpreadsheetsService.Batch方法的具体用法?C# SpreadsheetsService.Batch怎么用?C# SpreadsheetsService.Batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Google.GData.Spreadsheets.SpreadsheetsService的用法示例。


在下文中一共展示了SpreadsheetsService.Batch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateEntryCellsMap

        private static Dictionary<string, CellEntry> CreateEntryCellsMap(SpreadsheetsService service, CellFeed cellFeed,
            List<ExcelCell> cells)
        {
            Dictionary<string, CellEntry> res = new Dictionary<string, CellEntry>();

            CellFeed batchRequest = new CellFeed(new Uri(cellFeed.Self), service);
            foreach (ExcelCell cell in cells) {
                if (cell.GetEntry() == null) {
                    CellEntry batchEntry = new CellEntry(cell.Row, cell.Column, cell.GetBatchID());
                    batchEntry.Id = new AtomId(string.Format("{0}/{1}", cellFeed.Self, cell.GetBatchID()));
                    batchEntry.BatchData = new GDataBatchEntryData(cell.GetBatchID(), GDataBatchOperationType.query);
                    batchRequest.Entries.Add(batchEntry);
                }
                else {
                    if (!res.ContainsKey(cell.GetBatchID())) {
                        res.Add(cell.GetBatchID(), cell.GetEntry());
                    }
                }
            }

            if (batchRequest.Entries.Count > 0) {
                CellFeed queryBatchResponse = (CellFeed) service.Batch(batchRequest, new Uri(cellFeed.Batch));
                foreach (CellEntry entry in queryBatchResponse.Entries) {
                    res.Add(entry.BatchData.Id, entry);
                }
            }

            return res;
        }
开发者ID:mgerasika,项目名称:gam-gam,代码行数:29,代码来源:BatchCellUpdater.cs

示例2: SheetSync

        /// <summary>
        /// Updates the online spreadsheet according the maps file
        /// </summary>
        /// 
        public static void SheetSync(bool ForceSync)
        {
            Bot.SteamFriends.SetPersonaName("[" + ImpMaster.Maplist.Count.ToString() + "] " + Bot.DisplayName);

            if ((GroupChatHandler.OnlineSync.StartsWith("true", StringComparison.OrdinalIgnoreCase) && !SyncRunning) || ForceSync)
            {
                SyncRunning = true;
                //Log.Interface ("Beginning Sync");
                OAuth2Parameters parameters = new OAuth2Parameters();
                parameters.ClientId = GroupChatHandler.CLIENT_ID;
                parameters.ClientSecret = GroupChatHandler.CLIENT_SECRET;
                parameters.RedirectUri = GroupChatHandler.REDIRECT_URI;
                parameters.Scope = GroupChatHandler.SCOPE;
                parameters.AccessType = "offline";
                parameters.RefreshToken = GroupChatHandler.GoogleAPI;
                OAuthUtil.RefreshAccessToken(parameters);
                string accessToken = parameters.AccessToken;

                GOAuth2RequestFactory requestFactory = new GOAuth2RequestFactory(null, GroupChatHandler.IntegrationName, parameters);
                SpreadsheetsService service = new SpreadsheetsService(GroupChatHandler.IntegrationName);
                service.RequestFactory = requestFactory;
                SpreadsheetQuery query = new SpreadsheetQuery(SpreadSheetURI);
                SpreadsheetFeed feed = service.Query(query);
                SpreadsheetEntry spreadsheet = (SpreadsheetEntry)feed.Entries[0];
                WorksheetFeed wsFeed = spreadsheet.Worksheets;
                WorksheetEntry worksheet = (WorksheetEntry)wsFeed.Entries[0];

                worksheet.Cols = 5;
                worksheet.Rows = Convert.ToUInt32(ImpMaster.Maplist.Count + 1);

                worksheet.Update();

                CellQuery cellQuery = new CellQuery(worksheet.CellFeedLink);
                cellQuery.ReturnEmpty = ReturnEmptyCells.yes;
                CellFeed cellFeed = service.Query(cellQuery);
                CellFeed batchRequest = new CellFeed(cellQuery.Uri, service);

                int Entries = 1;

                foreach (var item in ImpMaster.Maplist)
                {
                    Entries = Entries + 1;
                    foreach (CellEntry cell in cellFeed.Entries)
                    {
                        if (cell.Title.Text == "A" + Entries.ToString())
                        {
                            cell.InputValue = item.Key;
                        }
                        if (cell.Title.Text == "B" + Entries.ToString())
                        {
                            cell.InputValue = item.Value.Item1;

                        }
                        if (cell.Title.Text == "C" + Entries.ToString())
                        {
                            cell.InputValue = item.Value.Item2.ToString();

                        }
                        if (cell.Title.Text == "D" + Entries.ToString())
                        {
                            cell.InputValue = item.Value.Item3.ToString();

                        }
                        if (cell.Title.Text == "E" + Entries.ToString())
                        {
                            cell.InputValue = item.Value.Item4.ToString();
                        }
                    }
                }

                cellFeed.Publish();
                CellFeed batchResponse = (CellFeed)service.Batch(batchRequest, new Uri(cellFeed.Batch));
                // Log.Interface("Completed Sync");
                SyncRunning = false;

            }
            else if (GroupChatHandler.OnlineSync.StartsWith("true", StringComparison.OrdinalIgnoreCase))
            {
                GroupChatHandler.SpreadsheetSync = true;
            }
        }
开发者ID:TF2Maps,项目名称:VBot,代码行数:85,代码来源:BackgroundWork.cs


注:本文中的Google.GData.Spreadsheets.SpreadsheetsService.Batch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。