/// <inheritdoc /> public Task <UpdateResponse <TDocument> > UpdateAsync <TDocument, TPartialDocument>( IUpdateRequest <TDocument, TPartialDocument> request, CancellationToken ct = default ) where TDocument : class where TPartialDocument : class => DoRequestAsync <IUpdateRequest <TDocument, TPartialDocument>, UpdateResponse <TDocument> >(request, request.RequestParameters, ct);
/// <inheritdoc/> public Task <IUpdateResponse> UpdateAsync <TDocument, TPartialDocument>(IUpdateRequest <TDocument, TPartialDocument> request) where TDocument : class where TPartialDocument : class => this.Dispatcher.DispatchAsync <IUpdateRequest <TDocument, TPartialDocument>, UpdateRequestParameters, UpdateResponse, IUpdateResponse>( request, this.LowLevelDispatch.UpdateDispatchAsync <UpdateResponse> );
/// <inheritdoc /> public IUpdateResponse <TDocument> Update <TDocument, TPartialDocument>(IUpdateRequest <TDocument, TPartialDocument> request) where TDocument : class where TPartialDocument : class => Dispatcher.Dispatch <IUpdateRequest <TDocument, TPartialDocument>, UpdateRequestParameters, UpdateResponse <TDocument> >( request, LowLevelDispatch.UpdateDispatch <UpdateResponse <TDocument>, TDocument, TPartialDocument> );
/// <inheritdoc/> public IUpdateResponse Update <TDocument, TPartialDocument>(IUpdateRequest <TDocument, TPartialDocument> request) where TDocument : class where TPartialDocument : class => this.Dispatcher.Dispatch <IUpdateRequest <TDocument, TPartialDocument>, UpdateRequestParameters, UpdateResponse>( request, (p, d) => this.LowLevelDispatch.UpdateDispatch <UpdateResponse>(p, d) );
/// <inheritdoc /> public IUpdateResponse Update <T, K>(IUpdateRequest <T, K> updateSelector) where T : class where K : class { return(this.Dispatch <IUpdateRequest <T, K>, UpdateRequestParameters, UpdateResponse>( updateSelector, (p, d) => this.RawDispatch.UpdateDispatch <UpdateResponse>(p, d) )); }
/// <inheritdoc /> public Task <IUpdateResponse> UpdateAsync <T, K>(IUpdateRequest <T, K> updateRequest) where T : class where K : class { return(this.DispatchAsync <IUpdateRequest <T, K>, UpdateRequestParameters, UpdateResponse, IUpdateResponse>( updateRequest, (p, d) => this.RawDispatch.UpdateDispatchAsync <UpdateResponse>(p, d) )); }
/// <summary> /// 更新 /// </summary> /// <typeparam name="T1"></typeparam> /// <typeparam name="T2"></typeparam> /// <param name="request"></param> /// <returns></returns> public IUpdateResponse <T1> Update <T1, T2>(IUpdateRequest <T1, T2> request) where T1 : class where T2 : class { var response = ElasticClient.Update(request); if (!response.IsValid) { throw new ElasticsearchException("更新失败:" + response.OriginalException.Message); } return(response); }
/// <inheritdoc/> public Task <IUpdateResponse <TDocument> > UpdateAsync <TDocument, TPartialDocument>( IUpdateRequest <TDocument, TPartialDocument> request, CancellationToken cancellationToken = default(CancellationToken) ) where TDocument : class where TPartialDocument : class => this.Dispatcher.DispatchAsync <IUpdateRequest <TDocument, TPartialDocument>, UpdateRequestParameters, UpdateResponse <TDocument>, IUpdateResponse <TDocument> >( request, cancellationToken, this.LowLevelDispatch.UpdateDispatchAsync <UpdateResponse <TDocument>, TDocument, TPartialDocument> );
public static void Update <TDocument, TPartialDocument>( IConnectionSettingsValues settings, ElasticsearchPathInfo <UpdateRequestParameters> pathInfo, IUpdateRequest <TDocument, TPartialDocument> self) where TDocument : class where TPartialDocument : class { if (pathInfo.Id.IsNullOrEmpty()) { if (self.Doc != null) { pathInfo.Id = settings.Inferrer.Id(self.Doc); } else if (self.Upsert != null) { pathInfo.Id = settings.Inferrer.Id(self.Upsert); } } pathInfo.HttpMethod = PathInfoHttpMethod.POST; }
/// <summary> /// 更新部分字段(Patial Fields) /// </summary> /// <typeparam name="T2">包含部分字段的实体类</typeparam> /// <param name="request">更新请求</param> /// <returns></returns> public IUpdateResponse <T> UpdatePFields <T2>(IUpdateRequest <T, T2> request) where T2 : class { return(Client.Update(request)); }
public Task <UpdateResponse <TDocument> > UpdateAsync <TDocument, TPartialDocument>(IUpdateRequest <TDocument, TPartialDocument> request, CancellationToken ct = new CancellationToken()) where TDocument : class where TPartialDocument : class { throw new NotImplementedException(); }
public UpdateResponse <TDocument> Update <TDocument, TPartialDocument>(IUpdateRequest <TDocument, TPartialDocument> request) where TDocument : class where TPartialDocument : class { throw new NotImplementedException(); }
public UpdateResponse RunUpdateRequest(IUpdateRequest request) { _Data.WebShopRecordSet = DataHelper.UpdateRecords(_Data.WebShopRecordSet, request.RecordSet); return(new UpdateResponse(request)); }
/// <inheritdoc /> public UpdateResponse <TDocument> Update <TDocument, TPartialDocument>(IUpdateRequest <TDocument, TPartialDocument> request) where TDocument : class where TPartialDocument : class => DoRequest <IUpdateRequest <TDocument, TPartialDocument>, UpdateResponse <TDocument> >(request, request.RequestParameters);
public void UpdateSheets(IUpdateRequest khsRequest, Action <ProgressInfo> updateProgress, CancellationToken cancelToken, out List <Exception> errorList) { if (khsRequest == null) { throw new ArgumentNullException(nameof(khsRequest)); } errorList = new List <Exception>(); for (int i = 0; i < khsRequest.Files.Count; i++) { if (cancelToken.IsCancellationRequested) { return; } var gFile = khsRequest.Files[i]; updateProgress?.Invoke(new ProgressInfo() { FileName = gFile.Name, FileIndex = i + 1, FilesCount = khsRequest.Files.Count, Progress = (i / (float)khsRequest.Files.Count) }); try { // Define request parameters. var spreadsheetId = gFile?.FileInfo?.Id; var worksheetInfo = this.GetKHSWeekBlocks(spreadsheetId, khsRequest.SheetName); var blocks = worksheetInfo.Blocks; if (blocks == null) { throw new Exception($"{nameof(UpdateSheets)}: Received null value from {nameof(GetKHSWeekBlocks)} method."); } var pair = blocks[blocks.Count - 1]; var lastWeekRow = Math.Max(pair.Item1, pair.Item2); var firstNewWeekRow = lastWeekRow; var lastNewWeekRow = firstNewWeekRow + khsRequest.SubjectGoalList.Count; var batchRequest = new BatchUpdateSpreadsheetRequest() { Requests = new List <Request>() { //Fill all basic data GCellRequestFactory.GenerateUpdateCellsRequest(khsRequest.GetGRowList(), new GCoordinate(worksheetInfo.SheetId, firstNewWeekRow, 1)), //Merges first column (date) GMergeCellsFactory.GenerateRequest(GMergeType.MergeAll, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 1, 2)), //Update date in first column (rotation is split to 2 requests) GCellRequestFactory.GenerateRepeatCellRequest( new GCoordinate(worksheetInfo.SheetId, firstNewWeekRow, 1), new GRowList() { new GRow() { new GCell() .AddFormat(GCellFormat.WrapStrategy, "WRAP") .AddFormat(GCellFormat.TextRotationVertical, true) .AddFormat(GCellFormat.VerticalAlignment, "MIDDLE") .AddFormat(GCellFormat.HorizontalAlignment, "CENTER") .AddFormat(GCellFormat.TextFormatBold, true) .AddFormat(GCellFormat.TextFormatFontSize, 8) } } ), //Rotate date in first column GCellRequestFactory.GenerateRepeatCellRequest( new GCoordinate(worksheetInfo.SheetId, firstNewWeekRow, 1), new GRowList() { new GRow() { new GCell() .AddFormat(GCellFormat.TextRotationAngle, 90) } } ), //Update formatting in second column (subject) GCellRequestFactory.GenerateRepeatCellRequest( new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 2, 3), new GCell() .AddFormat(GCellFormat.WrapStrategy, "WRAP") .AddFormat(GCellFormat.VerticalAlignment, "MIDDLE") .AddFormat(GCellFormat.HorizontalAlignment, "CENTER") .AddFormat(GCellFormat.TextFormatBold, true) .AddFormat(GCellFormat.TextFormatFontSize, 10) ), //Update formatting in third column (goal) GCellRequestFactory.GenerateRepeatCellRequest( new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 3, 4), new GCell() .AddFormat(GCellFormat.WrapStrategy, "WRAP") .AddFormat(GCellFormat.VerticalAlignment, "MIDDLE") .AddFormat(GCellFormat.HorizontalAlignment, "CENTER") .AddFormat(GCellFormat.TextFormatBold, false) .AddFormat(GCellFormat.TextFormatFontSize, 10) ), //Update formatting in third column (goal) GCellRequestFactory.GenerateRepeatCellRequest( new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 4, 9), new GCell() .AddFormat(GCellFormat.VerticalAlignment, "MIDDLE") .AddFormat(GCellFormat.HorizontalAlignment, "CENTER") ), //Creates borders around added part, inner rows lines, inner columns lines GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 1, 2)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 2, 3)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 3, 4)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 4, 5)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 5, 6)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 6, 7)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 7, 8)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 8, 9)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 9, 10)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.Outer, GBorderLineType.SolidMedium, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 10, 11)), GUpdateBordersFactory.GenerateRequest(GUpdateBordersType.InnerRows, GBorderLineType.Dashed, new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 1, 11)), //End of create borders around added part, inner rows lines, inner columns lines //Set background to cols 4-8 GCellRequestFactory.GenerateRepeatCellRequest( new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 4, 9), new GCell() .AddFormat(GCellFormat.BackgroundColorRed, 1f) .AddFormat(GCellFormat.BackgroundColorGreen, 242 / 255f) .AddFormat(GCellFormat.BackgroundColorBlue, 204 / 255f) ), //Wrap cols 8-10 GCellRequestFactory.GenerateRepeatCellRequest( new GRange(worksheetInfo.SheetId, firstNewWeekRow, lastNewWeekRow, 8, 11), new GCell() .AddFormat(GCellFormat.WrapStrategy, "WRAP") .AddFormat(GCellFormat.VerticalAlignment, "MIDDLE") .AddFormat(GCellFormat.HorizontalAlignment, "CENTER") ), } }; var update = Service.Spreadsheets.BatchUpdate(batchRequest, spreadsheetId); var response = update.Execute(); } catch (Exception ex) { errorList.Add(ex); } } ; }
public UpdateWithUpdateRequestAsyncAction(IUpdateRequest <TDocument, TPartialDocument> request) { _request = request; }
/// <inheritdoc/> public IUpdateResponse Update <TDocument>(IUpdateRequest <TDocument, TDocument> request) where TDocument : class => this.Update <TDocument, TDocument>(request);
/// <summary> /// 更新部分字段(Patial Fields)T2=》object(异步) /// </summary> /// <param name="request">更新请求</param> /// <returns></returns> public async Task <IUpdateResponse <T> > UpdatePFieldsAsync(IUpdateRequest <T, object> request) { return(await Client.UpdateAsync(request)); }
/// <inheritdoc /> public IUpdateResponse Update <T>(IUpdateRequest <T, T> updateSelector) where T : class { return(this.Update <T, T>(updateSelector)); }
/// <inheritdoc/> public Task <IUpdateResponse <TDocument> > UpdateAsync <TDocument>( IUpdateRequest <TDocument, TDocument> request, CancellationToken cancellationToken = default(CancellationToken) ) where TDocument : class => this.UpdateAsync <TDocument, TDocument>(request, cancellationToken);
/// <summary> /// 更新部分字段(Patial Fields)(异步) /// </summary> /// <typeparam name="T2">包含部分字段的实体类</typeparam> /// <param name="request">更新请求</param> /// <returns></returns> public async Task <IUpdateResponse <T> > UpdatePFieldsAsync <T2>(IUpdateRequest <T, T2> request) where T2 : class { return(await Client.UpdateAsync(request)); }
/// <inheritdoc/> public Task <IUpdateResponse> UpdateAsync <TDocument>(IUpdateRequest <TDocument, TDocument> request) where TDocument : class => this.UpdateAsync <TDocument, TDocument>(request);
/// <summary> /// 更新部分字段(Patial Fields)T2=》object /// </summary> /// <param name="request">更新请求</param> /// <returns></returns> public IUpdateResponse <T> UpdatePFields(IUpdateRequest <T, object> request) { return(Client.Update(request)); }
/// <inheritdoc /> public Task <IUpdateResponse> UpdateAsync <T>(IUpdateRequest <T, T> updateRequest) where T : class { return(this.UpdateAsync <T, T>(updateRequest)); }
/// <summary> /// 更新全部字段(All Fields) /// </summary> /// <param name="request">更新请求</param> /// <returns></returns> public IUpdateResponse <T> UpdateAFields(IUpdateRequest <T, T> request) { return(Client.Update <T, T>(request)); }
/// <inheritdoc /> public Task <UpdateResponse <TDocument> > UpdateAsync <TDocument>( IUpdateRequest <TDocument, TDocument> request, CancellationToken ct = default ) where TDocument : class => UpdateAsync <TDocument, TDocument>(request, ct);
/// <summary> /// 部分更新 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <typeparam name="TPartialEntity"></typeparam> /// <param name="elasticClient"></param> /// <param name="request"></param> /// <returns></returns> public static UpdateResponse <TEntity> UpdateDocumentPartial <TEntity, TPartialEntity>(this IElasticClient elasticClient , IUpdateRequest <TEntity, TPartialEntity> request ) where TEntity : class where TPartialEntity : class { //[ 部分字段/局部更新 (TPartialEntity中的字段) ] UpdateResponse <TEntity> response = elasticClient.Update(request); return(response); }
/// <inheritdoc /> public UpdateResponse <TDocument> Update <TDocument>(IUpdateRequest <TDocument, TDocument> request) where TDocument : class => Update <TDocument, TDocument>(request);
public UpdateResponse(IUpdateRequest request) : base(Communication.RequestTypeEnum.Update) { Request = request; }
/// <summary> /// Is a Dynamo update available. /// </summary> /// <returns>True if a newer version is available, and sets the update info. /// Returns false if no newer update is available, or nothing is returned from the request.</returns> public bool IsUpdateAvailable(IUpdateRequest request) { if (string.IsNullOrEmpty(request.UpdateRequestData)) return false; XNamespace ns = "http://s3.amazonaws.com/doc/2006-03-01/"; XDocument doc = null; using (TextReader td = new StringReader(request.UpdateRequestData)) { doc = XDocument.Load(td); } var bucketresult = doc.Element(ns + "ListBucketResult"); var builds = bucketresult.Descendants(ns + "LastModified"). OrderByDescending(x => DateTime.Parse(x.Value)). Where(x => x.Parent.Value.Contains("DynamoInstall")). Select(x => x.Parent); var xElements = builds as XElement[] ?? builds.ToArray(); if (!xElements.Any()) { return false; } var latestBuild = xElements.First(); var latestBuildFileName = latestBuild.Element(ns + "Key").Value; var latestBuildDownloadUrl = Path.Combine(Configurations.UpdateDownloadLocation, latestBuildFileName); var latestBuildVersion = BinaryVersion.FromString(Path.GetFileNameWithoutExtension(latestBuildFileName).Remove(0, 13)); if (latestBuildVersion > ProductVersion) { updateInfo = new AppVersionInfo() { Version = latestBuildVersion, VersionInfoURL = Configurations.UpdateDownloadLocation, InstallerURL = latestBuildDownloadUrl }; return true; } updateInfo = null; return false; }