From 1a1c8e71fcd14858f595029f089b2d4a00202b32 Mon Sep 17 00:00:00 2001
From: ogi <Administrator@S-OGI-PC>
Date: Fri, 05 Dec 2025 09:24:16 +0900
Subject: [PATCH] プロジェクトファイルを追加。

---
 HotelPms.DataAccessGrpc.Client/UseAccess.cs |  114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 114 insertions(+), 0 deletions(-)

diff --git a/HotelPms.DataAccessGrpc.Client/UseAccess.cs b/HotelPms.DataAccessGrpc.Client/UseAccess.cs
new file mode 100644
index 0000000..97a3b8b
--- /dev/null
+++ b/HotelPms.DataAccessGrpc.Client/UseAccess.cs
@@ -0,0 +1,114 @@
+using Google.Protobuf;
+using Grpc.Core;
+using Grpc.Net.Client;
+using HotelPms.Data.Common;
+using HotelPms.Data.UseInfo;
+using HotelPms.Share.Util;
+using System;
+using System.Data;
+using System.Threading.Tasks;
+using HotelPms.Data;
+using System.Collections.Generic;
+using HotelPms.Data.Common.Pagination;
+using System.Text.Json;
+using System.Threading;
+using HotelPms.Data.Client;
+
+namespace HotelPms.DataAccessGrpc.Client
+{
+    public class UseAccess : IDisposable
+    {
+        /// <summary>
+        /// チャネル
+        /// </summary>
+        public GrpcChannel Channel { get; private set; }
+        public UseCore.UseCoreClient Client { get; private set; }
+
+
+        public UseAccess(GrpcChannel channel)
+        {
+            Channel = channel;
+            Client = new UseCore.UseCoreClient(Channel);
+        }
+
+        public void Dispose()
+        {
+
+        }
+
+        /// <summary>
+        /// 同期データ取得
+        /// </summary>
+        /// <param name="where"></param>
+        /// <returns></returns>
+        public Use GetData(string where)
+        {
+            return Client.GetData(GrpcClient.CreateDataRequest(0, where));
+        }
+
+        public async Task<Use> GetDataAsync(string where)
+        {
+            return await Client.GetDataAsync(GrpcClient.CreateDataRequest(0, where));
+        }
+
+        public async Task<Use> GetDataStream()
+        {
+            return await GetDataStream(string.Empty);
+        }
+
+        /// <summary>
+        /// データ取得
+        /// </summary>
+        /// <returns></returns>
+        public async Task<Use> GetDataStream(string where)
+        {
+            Use table = null;
+            using (var call = Client.GetDataStream())
+            {
+                await call.RequestStream.WriteAsync(GrpcClient.CreateDataRequest(0, where));
+                await call.RequestStream.CompleteAsync();   // Finish call and report results
+
+                //データの取得
+                await foreach (var message in call.ResponseStream.ReadAllAsync<Use>())
+                {
+                    table = message;
+                    break;
+                }
+            }
+            return table;
+        }
+
+        public DataResult SetData(Use table)
+        {
+            return Client.SetData(table);
+        }
+
+        public async Task<DataResult> SetDataAsync(Use table)
+        {
+            return await Client.SetDataAsync(table);
+        }
+
+        /// <summary>
+        /// バッチ更新
+        /// </summary>
+        /// <param name="table"></param>
+        /// <returns></returns>
+        public async Task<DataResult> SetDataStream(Use table)
+        {
+            DataResult result = null;
+            using (var call = Client.SetDataStream())
+            {
+                await call.RequestStream.WriteAsync(table);
+                await call.RequestStream.CompleteAsync();   // Finish call and report results
+
+                //データの取得
+                await foreach (var message in call.ResponseStream.ReadAllAsync<DataResult>())
+                {
+                    result = message;
+                    break;
+                }
+            }
+            return result;
+        }
+    }
+}

--
Gitblit v1.10.0