ホテル管理システム
ogi
yesterday 1a1c8e71fcd14858f595029f089b2d4a00202b32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
using Grpc.Net.Client;
using Grpc.Net.Client.Web;
using HotelPms.Data;
using HotelPms.Data.Client;
using HotelPms.Data.Common;
using HotelPms.Data.UseInfo;
using HotelPms.DataAccessGrpc.Client;
using HotelPms.Share.Data;
using HotelPms.Share.NetWork;
using HotelPms.Share.Util;
using HotelPms.Share.Windows.Component;
using HotelPms.Share.Windows.Tool;
using HotelPms.Share.Windows.Util;
using HotelPms.SourceFactory.Util;
using HotelPms.VerUp.DataBase;
using MailKit.Net.Smtp;
using MailKit.Security;
using MimeKit;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System.Data;
using System.Data.Common;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Text.Json;
 
namespace HotelPms.SourceFactory
{
    public partial class FormMain : FormBase
    {
        public FormMain()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
 
            string file = @"C:\Temp\newdd.xls";
            if (File.Exists(file)) { File.Delete(file); }
            File.Copy(@"C:\Users\Administrator\Desktop\AESDemo\AESDemo\temp.xls", file);
 
            using (NPOIExcel excel = new NPOIExcel(file))
            {
                int tmpRow1 = 0;
                int tmpRow2 = 1;
 
                //excel.SetCurrentSheet(1);
                //excel.SetCell("D1", "15");
                //excel.SetCellComment("D1", "UseNo");
 
                //一個目の入区分の数でtmpRow2を偏移する
                int persons = 2;
                excel.SetCurrentSheet(0);
 
                for (int i = 1; i <= 2; i++)
                {
                    excel.Sheet.CopyRow(tmpRow1, tmpRow2 + i);
                    excel.Sheet.GetRow(tmpRow2 + i).Height = excel.Sheet.GetRow(tmpRow1).Height;
                }
 
                //CellRangeAddress cellRangeAddress = new CellRangeAddress(tmpRow2 + 1, tmpRow2 + persons, 0, 1);
                //excel.Sheet.AddMergedRegion(cellRangeAddress);
 
                //cellRangeAddress = new CellRangeAddress(tmpRow2 + 1, tmpRow2 + persons, 2, 3);
                //excel.Sheet.AddMergedRegion(cellRangeAddress);
 
                int r = excel.Sheet.LastRowNum;
                for (int i = 1; i <= 2; i++)
                {
                    r += 1;
                    excel.Sheet.CopyRow(tmpRow2, r);
                    excel.Sheet.GetRow(r).Height = excel.Sheet.GetRow(tmpRow2).Height;
                    string col = ((int)(r + 1)).ToString();
                    excel.SetCell("A" + col, col);
                }
 
                r = excel.Sheet.LastRowNum + 1;
                excel.Sheet.CopyRow(tmpRow1, r);
                excel.Sheet.GetRow(r).Height = excel.Sheet.GetRow(tmpRow1).Height;
 
                //excel.Sheet.GetRow(tmpRow2).ZeroHeight = true;
                //excel.Sheet.GetRow(tmpRow1).ZeroHeight = true;
                excel.Sheet.RemoveRow(excel.Sheet.GetRow(tmpRow2));
                excel.Sheet.RemoveRow(excel.Sheet.GetRow(tmpRow1));
 
                excel.Sheet.ShiftRows(2, excel.Sheet.LastRowNum, -2, true, false);
            }
 
            Process.Start(@"C:\Temp\newdd.xls");
        }
 
        private void button2_Click(object sender, EventArgs e)
        {
            //new PostgreSqlDemo().Show();
            HSSFWorkbook workbook = new HSSFWorkbook();
            HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet("Sheet1");
            HSSFRow row = (HSSFRow)sheet.CreateRow(0);
            HSSFCell cell = (HSSFCell)row.CreateCell(0);
            cell.SetCellValue("Cell1");
 
            // Create the drawing patriarch (top level container for all shapes including cell comments)
            IDrawing patriarch = (HSSFPatriarch)sheet.CreateDrawingPatriarch();
 
            // Client anchor defines size and position of the comment in the worksheet
            IComment comment = patriarch.CreateCellComment(new HSSFClientAnchor(0, 0, 0, 0, 2, 1, 4, 4));
 
            // Set comment author
            comment.Author = "Author";
 
            // Set text in the comment
            comment.String = new HSSFRichTextString($"{comment.Author}:{Environment.NewLine}A comment");
 
            // If you want the author displayed in bold on top like in Excel
            // The author will be displayed in the status bar when on mouse over the commented cell
            IFont font = workbook.CreateFont();
            font.Boldweight = (short)FontBoldWeight.Bold;
            comment.String.ApplyFont(0, comment.Author.Length, font);
 
            // Set comment visible
            comment.Visible = true;
 
            // Assign comment to a cell
            cell.CellComment = comment;
 
            //using (MemoryStream exportData = new MemoryStream())
            //{
            //    workbook.Write(exportData);
            //    //Response.ContentEncoding = Encoding.UTF8;
            //    //Response.Charset = Encoding.UTF8.EncodingName;
            //    //Response.ContentType = "application/vnd.ms-excel";
            //    //Response.AddHeader("content-disposition", $"attachment; filename=test.xls");
            //    //Response.Clear();
            //    //Response.BinaryWrite(exportData.GetBuffer());
            //    //Response.End();
            //}
        }
 
        private void FormMain_KeyDown(object sender, KeyEventArgs e)
        {
 
        }
 
        private Task<string> GetData()
        {
            System.Diagnostics.Debug.WriteLine($"【{DateTime.Now.ToString("HH:mm:ss fff")}】GetData開始");
            return Task<string>.Run(() =>
            {
                Thread.Sleep(20000);
                return "結果ですよ:" + DateTime.Now.ToString("HH:mm:ss fff");
            });
        }
 
        private Task<string> GetData(object param)
        {
            Func<object, string> action = (o) =>
            {
                Thread.Sleep((int)o);
                return "aaaa結果ですよ:" + DateTime.Now.ToString("HH:mm:ss fff");
            };
            return new TaskFactory().StartNew<string>(action, param);
        }
 
 
        private async void FormMain_Load(object sender, EventArgs e)
        {
            this.ActiveControl = LoadingObj;
            LoadingObj.ShowWaiting();
            string data = await GetData(2000);
            textBox1.Text = data;
            LoadingObj.CloseWaiting();
 
            Dictionary<string, int> dict = new Dictionary<string, int>();
            dict["Name"] = 180;
 
            dict["Name"] = 30;
            textBox3.Text = $"【{DateTime.Now.ToString("HH:mm:ss fff")}】FormMain_Load準備OK";
 
            Use item = new()
            {
                ID = 1
            };
            //var a = item.GetCinDate();
        }
 
        private void button3_Click(object sender, EventArgs e)
        {
            new TableToExcel().Show();
        }
 
        private void button4_Click(object sender, EventArgs e)
        {
            //Json Object
            var cc = new { ID = 1, Name = "小木", Other = "aaa" };
            //cc["Name"] = "aa";
 
 
            string name = cc.Name;
            int id = cc.ID;
 
 
 
            new FormGdi().Show();
        }
 
        private void button5_Click(object sender, EventArgs e)
        {
            var message = new MimeMessage();
            message.From.Add(new MailboxAddress("小木勝龍", "liangbenyinjp@yahoo.co.jp"));
            message.To.Add(new MailboxAddress("小木勝龍", "shr.ogi@sj-sol.com"));
            message.Subject = "How you doin'?";
 
            message.Body = new TextPart("plain")
            {
                Text = @"Hey Chandler,
 
I just wanted to let you know that Monica and I were going to go play some paintball, you in?
 
-- Joey"
            };
 
            //using (var client = new SmtpClient())
            //{
            //    client.ServerCertificateValidationCallback =
            //                   (sender, certificate, certChainType, errors) => true;
            //    client.AuthenticationMechanisms.Remove("XOAUTH2");
 
            //    client.Connect("smtp.mail.yahoo.co.jp", 465, true);
 
            //    // Note: only needed if the SMTP server requires authentication
            //    client.Authenticate("liangbenyinjp", "lby10180331");
 
            //    client.Send(message);
            //    client.Disconnect(true);
            //}
 
            //GmailのSMTPサーバーアドレス:smtp.gmail.com
            //GmailのSMTP名:あなたの氏名
            //GmailのSMTPユーザー名:あなたのGmailアドレス(例:you @gmail.com)
            //GmailのSMTPパスワード:あなたのGmailのログインパスワード
            //GmailのSMTPポート(TLS): 587
            //GmailのSMTPポート(SSL): 465
 
            using (var mySmtpClient = new SmtpClient())
            {
                string host = "smtp.mail.yahoo.co.jp";
                int port = 465; // 587
                string userId = "liangbenyinjp";
                string password = "lby10180331";
 
                mySmtpClient.Connect(host, port, SecureSocketOptions.Auto);
                mySmtpClient.Authenticate(new SaslMechanismLogin(userId, password));
                mySmtpClient.Send(message);
                mySmtpClient.Disconnect(true);
            }
        }
 
        private void button6_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = (int)numericUpDown1.Value; i < (int)numericUpDown2.Value; i++)
            {
                sb.AppendLine(string.Format(textBox2.Text, i));
            }
            richTextBox1.Text = sb.ToString();
        }
 
        private void button7_Click(object sender, EventArgs e)
        {
            byte[] data;
            using (DataTable table = new DataTable())
            {
                for (int i = 0; i < 50; i++)
                {
                    table.Columns.Add($"Fields{i}");
                }
 
                for (int r = 0; r < 500; r++)
                {
                    DataRow row = table.NewRow();
                    table.Rows.Add(row);
 
                    for (int i = 0; i < 50; i++)
                    {
                        row[$"Fields{i}"] = $"データだよData({r},{i})";
                    }
                }
                data = Export(table, "xls");
            }
        }
 
        public static byte[] Export(DataTable dt, string type = "xlsx")
        {
            const int headerRowIndex = 0;
 
            // ブック作成
            IWorkbook book;
            switch (type)
            {
                case "xls":
                    book = new HSSFWorkbook();
                    break;
                case "xlsx":
                    book = new XSSFWorkbook();
                    break;
                default:
                    return null;
            }
 
            // シート作成
            var sheet = book.CreateSheet("Table");
 
            // ヘッダ行作成
            var headerRow = sheet.CreateRow(0);
            foreach (DataColumn col in dt.Columns)
            {
                ICell cell = headerRow.CreateCell(dt.Columns.IndexOf(col));
                cell.SetCellValue(col.ColumnName);
            }
 
            // データ行作成
            foreach (DataRow row in dt.Rows)
            {
                var dataRow = sheet.CreateRow(headerRowIndex + 1 + dt.Rows.IndexOf(row));
 
                foreach (DataColumn col in dt.Columns)
                {
                    var colIndex = dt.Columns.IndexOf(col);
                    if (row[colIndex] == DBNull.Value) continue;
 
                    ICell cell = dataRow.CreateCell(colIndex);
                    cell.SetCellValue(row[colIndex].ToString());
                }
            }
 
 
            // ブックを出力(保存)
            //using (var ms = new MemoryStream())
            //{
            var ms = new MemoryStream();
            book.Write(ms, true);
            byte[] data = ms.ToArray();
            ms.Close();
 
            File.WriteAllBytes("1.xls", data);
            return data;
            //}
        }
 
        private void button8_Click(object sender, EventArgs e)
        {
            new FormExProperty().Show();
        }
 
        private void button9_Click(object sender, EventArgs e)
        {
            GC.Collect();  //使う前に一回メモリー回収必要
            StringBuilder sb = new StringBuilder();
            foreach (KeyValuePair<Control, ControlPropertyEx> item in ControlPropertyEx.Data)
            {
                if (item.Key.IsDisposed)
                {
                    sb.AppendLine($"IsDisposed⇒{item.Value}");
                }
                else
                {
                    sb.AppendLine($"{item.Key.Name}({item.Key.Handle})⇒{item.Value}");
                }
            }
            richTextBox1.Text = sb.ToString();
        }
 
        private void button10_Click(object sender, EventArgs e)
        {
            new FormReport().Show();
        }
 
        private void button11_Click(object sender, EventArgs e)
        {
            string a = string.Empty;
            for (int i = 0; i < int.MaxValue; i++)
            {
                a += "s";
                System.Diagnostics.Debug.WriteLine(i);
            }
 
            System.Diagnostics.Debug.WriteLine(a.Length);
        }
 
        private void button12_Click(object sender, EventArgs e)
        {
            using (DBLogin login = new DBLogin())
            {
                if (login.ShowDialog() != DialogResult.OK) { return; }
                EnvironmentSetting.Default.DataBase = new Share.Data.DBConnectItem(login.DataSource, login.Catalog, login.UseID, login.PassWord);
            }
 
            using (BeanCreator form = new BeanCreator())
            {
                form.ShowDialog();
            }
        }
 
        private void button13_Click(object sender, EventArgs e)
        {
            new FormEdge().Show();
        }
 
        private void button14_Click(object sender, EventArgs e)
        {
            new FormSignalR().Show();
        }
 
        private void FetchReport(DbDataReader reader, List<TestBean> data)
        {
            while (reader.Read())
            {
                var testBean = new TestBean
                {
                    ID = CConvert.ToInt(reader["ID"]),
                    Name = reader["Name"].ToString()
                };
                data.Add(testBean);
            }
        }
 
        private void FetchRoomType(DbDataReader reader, List<TestBean> data)
        {
            while (reader.Read())
            {
                var testBean = new TestBean
                {
                    ID = CConvert.ToInt(reader["RoomTypeNo"]),
                    Name = reader["RoomTypeName"].ToString()
                };
                data.Add(testBean);
            }
        }
 
        private void button15_Click(object sender, EventArgs e)
        {
            using (MsSqlNet msSqlNet = new MsSqlNet("localhost", "sa", "oatcti", "HotelPms"))
            {
                var result = msSqlNet.GetDataReader<List<TestBean>>("SELECT * FROM M_Room", (reader, data) =>
                {
                    while (reader.Read())
                    {
                        var testBean = new TestBean
                        {
                            ID = CConvert.ToInt(reader["ID"]),
                            Name = reader["Name"].ToString()
                        };
                        data.Add(testBean);
                    }
                });
 
                if (result == null) { return; }
 
                foreach (TestBean item in result)
                {
                    System.Diagnostics.Debug.WriteLine($"{item.ID}.{item.Name}");
                }
 
                var demo = msSqlNet.GetDataReader<List<HotelPms.Data.Master.Demo>>(@"SELECT ID,[Name],FInt,FTinyInt,FSmallInt,FFloat,FBit,FDecimal,FDate,UpdateDate,UpdateID FROM M_Demo", (reader, data) =>
                {
                    while (reader.Read())
                    {
                        var testBean = new HotelPms.Data.Master.Demo();
                        testBean.ConvertReader(reader);
                        System.Diagnostics.Debug.WriteLine(testBean.ToText());
                        data.Add(testBean);
                    }
                });
 
 
                result = msSqlNet.GetDataReader<List<TestBean>>("SELECT * FROM S_Report", FetchReport);
 
                if (result == null) { return; }
 
                foreach (TestBean item in result)
                {
                    System.Diagnostics.Debug.WriteLine($"{item.ID}.{item.Name}");
                }
 
                result = msSqlNet.GetDataReader<List<TestBean>>("SELECT * FROM M_RoomType", (reader, data) => FetchRoomType(reader, data));
 
                if (result == null) { return; }
 
                foreach (TestBean item in result)
                {
                    System.Diagnostics.Debug.WriteLine($"{item.ID}.{item.Name}");
                }
            }
        }
 
        private void button16_Click(object sender, EventArgs e)
        {
            CalendarSelectorOne.Execute(textBox3);
        }
 
        private void button17_Click(object sender, EventArgs e)
        {
            CalendarSelector.Execute(textBox3);
        }
 
        private void FormMain_Shown(object sender, EventArgs e)
        {
            richTextBox1.Text = $"【{DateTime.Now.ToString("HH:mm:ss fff")}】FormMain_Shown準備OK";
        }
 
        private void button18_Click(object sender, EventArgs e)
        {
            new FormValid().Show();
        }
 
        private void button19_Click(object sender, EventArgs e)
        {
            new ExcelToTable().Show();
        }
 
        private void button20_Click(object sender, EventArgs e)
        {
            new FormScript().Show();
        }
 
        private async void button21_Click(object sender, EventArgs e)
        {
            var httpClientHandler = new HttpClientHandler();
            httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
            GrpcChannelOptions options = new GrpcChannelOptions()
            {
                MaxReceiveMessageSize = int.MaxValue,
                HttpHandler = httpClientHandler
            };
            using (var Channel = GrpcChannel.ForAddress("https://localhost:7228", options))
            {
                HelloRequest request = new HelloRequest();
                request.Name = "aaa";
                var client = new Greeter.GreeterClient(Channel);
                HelloReply reply = await client.SayHelloAsync(request);
                richTextBox1.Text = reply.ToString();
 
                //GrpcSet grpcSet = await GrpcClient.GetDataSet(Channel, (int)ESetActionType.ColSetting, $"localhost,Web,10000");
                //DataSet ds = grpcSet.ToDataSet();
 
                //using (RoomViewLayoutAccess access = new RoomViewLayoutAccess(Channel))
                //{
                //    DataSet ds1 = await access.GetRoomViewData($"2022/07/13,1");
                //}
            }
        }
 
        private void button22_Click(object sender, EventArgs e)
        {
            var httpClientHandler = new HttpClientHandler();
            httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
            var httpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, httpClientHandler);
            //var httpClient = new HttpClient(httpClientHandler);
            GrpcChannelOptions options = new GrpcChannelOptions()
            {
                MaxReceiveMessageSize = int.MaxValue,
                HttpHandler = httpHandler //httpClientHandler
            };
            using (var Channel = GrpcChannel.ForAddress("https://localhost:7240", options))
            {
                HelloRequest request = new HelloRequest();
                request.Name = "aaa";
                var client = new Greeter.GreeterClient(Channel);
                HelloReply reply = client.SayHello(request);
                richTextBox1.Text = reply.ToString();
            }
        }
 
        private async void button23_Click(object sender, EventArgs e)
        {
            var httpClientHandler = new HttpClientHandler();
            httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
            var handler = new SubdirectoryHandler(httpClientHandler, "/grpc");
            var httpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWebText, handler);
            GrpcChannelOptions options = new GrpcChannelOptions()
            {
                MaxReceiveMessageSize = int.MaxValue,
                HttpHandler = httpHandler
            };
            using (var Channel = GrpcChannel.ForAddress("https://www.navc2.net", options))
            {
                HelloRequest request = new HelloRequest();
                request.Name = "IIS CALLだぞ ";
                var client = new Greeter.GreeterClient(Channel);
                HelloReply reply = await client.SayHelloAsync(request);
                richTextBox1.Text = reply.ToString();
            }
        }
 
        private void button24_Click(object sender, EventArgs e)
        {
            new ExcelCopy().Show();
        }
 
        private void button25_Click(object sender, EventArgs e)
        {
            using (DBCore core = new DBCore(new DBConnectItem("localhost", "HotelPms", "sa", "oatcti")))
            {
                core.Output += Core_Output;
                core.Execute();
            }
            MessageBox.Show("OK");
        }
 
        private void Core_Output(object sender, MessageEventArgs e)
        {
            richTextBox1.AppendText(Environment.NewLine);
            richTextBox1.AppendText(e.Message);
        }
 
        private void button26_Click(object sender, EventArgs e)
        {
            var serializerOptions = new JsonSerializerOptions
            {
                Converters = { new DynamicJsonConverter() },
                WriteIndented = true
            };
 
            var jsonText = File.ReadAllText("sample.json");
 
            dynamic obj = JsonSerializer.Deserialize<dynamic>(jsonText, serializerOptions);
 
            string id = obj.id;
            string type = obj.type;
 
            string json = JsonSerializer.Serialize(obj, serializerOptions);
 
            obj = new { ID = 1, Name = "aaa" };
            json = JsonSerializer.Serialize(obj, serializerOptions);
 
        }
 
        private async void button27_Click(object sender, EventArgs e)
        {
            //AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
            var httpClientHandler = new HttpClientHandler();
            httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
            var handler = new SubdirectoryHandler(httpClientHandler, "/grpc");
            var httpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWebText, handler);
            GrpcChannelOptions options = new GrpcChannelOptions()
            {
                MaxReceiveMessageSize = int.MaxValue,
                HttpHandler = httpHandler
            };
            //using (var Channel = GrpcChannel.ForAddress("https://www.navc2.net", options))
            using (var Channel = GrpcChannel.ForAddress("https://ginbow.eu.org", options))
            {
                HelloRequest request = new HelloRequest();
                request.Name = "IIS CALLだぞ ";
                var client = new Greeter.GreeterClient(Channel);
                HelloReply reply = await client.SayHelloAsync(request);
                richTextBox1.Text = reply.ToString();
 
                GrpcSet grpcSet = await GrpcClient.GetDataSet(Channel, (int)ESetActionType.ColSetting, $"localhost,Web,10000");
                DataSet ds = grpcSet.ToDataSet();
 
                using (RoomViewLayoutAccess access = new RoomViewLayoutAccess(Channel))
                {
                    DataSet ds1 = await access.GetRoomViewData($"2022/07/13,1");
                }
            }
        }
 
        private async void button28_Click(object sender, EventArgs e)
        {
            //Content-Type application/grpc
            var httpClientHandler = new HttpClientHandler();
            httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
            var httpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWeb, httpClientHandler);
            GrpcChannelOptions options = new GrpcChannelOptions()
            {
                MaxReceiveMessageSize = int.MaxValue,
                //HttpHandler = httpClientHandler
                HttpHandler = httpHandler
            };
            using (var Channel = GrpcChannel.ForAddress("https://ginbow.eu.org", options))
            {
                HelloRequest request = new HelloRequest();
                request.Name = "aaa";
                var client = new Greeter.GreeterClient(Channel);
                HelloReply reply = await client.SayHelloAsync(request);
                richTextBox1.Text = reply.ToString();
 
                GrpcSet grpcSet = await GrpcClient.GetDataSet(Channel, (int)ESetActionType.ColSetting, $"localhost,Web,10000");
                DataSet ds = grpcSet.ToDataSet();
 
                using (RoomViewLayoutAccess access = new RoomViewLayoutAccess(Channel))
                {
                    DataSet ds1 = await access.GetRoomViewData($"2022/07/13,1");
                }
            }
        }
 
        private void button29_Click(object sender, EventArgs e)
        {
            Process.Start(new ProcessStartInfo
            {
                FileName = "cmd",
                Arguments = $"/c start \"\" \"notepad.exe\"",
                CreateNoWindow = true,
                UseShellExecute = false
            });
 
            //Process.Start(new ProcessStartInfo
            //{
            //    FileName = "notepad.exe",
            //    Arguments = @"c:\temp\LabelPrinterUtility.ini", // 虽然打不开内容,但能验证是否递归
            //    UseShellExecute = true
            //});
        }
 
        private void button30_Click(object sender, EventArgs e)
        {
 
        }
    }
}