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.Client.Blazor/Models/RoomTypeInputRow.cs |  124 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 124 insertions(+), 0 deletions(-)

diff --git a/HotelPms.Client.Blazor/Models/RoomTypeInputRow.cs b/HotelPms.Client.Blazor/Models/RoomTypeInputRow.cs
new file mode 100644
index 0000000..8c5ef40
--- /dev/null
+++ b/HotelPms.Client.Blazor/Models/RoomTypeInputRow.cs
@@ -0,0 +1,124 @@
+using HotelPms.Client.Blazor.Util;
+using HotelPms.Data.UseInfo;
+using HotelPms.Share.Util;
+using Microsoft.AspNetCore.Components.Forms;
+using Microsoft.JSInterop;
+using MudBlazor;
+using System.Text.Json.Serialization;
+using static HotelPms.Client.Blazor.Util.SystemEnum;
+
+namespace HotelPms.Client.Blazor.Models
+{
+    /// <summary>
+    /// 利用日毎
+    /// 空白行が必要のため、
+    /// 全部文字列にする
+    /// </summary>
+    public class RoomTypeInputRow : EditRow
+    {
+        public enum ColType : int
+        {
+            ID = 0,
+            Name,
+            Count,
+        }
+
+        public RoomTypeInputRow()
+        {
+            Cells.Add(new ViewModel.ValidField { Name = ColType.ID.ToString(), MaxLenth = 3, InputChar = EInputChar.Num });
+            Cells.Add(new ViewModel.ValidField { Name = ColType.Name.ToString() });            
+            Cells.Add(new ViewModel.ValidField { Name = ColType.Count.ToString(), MaxLenth = 3, InputChar = EInputChar.Num });
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            if (!disposing)
+            {
+                base.Dispose(false);
+            }
+        }
+
+        /// <summary>
+        /// 関連伝票情報
+        /// </summary>
+        [JsonIgnore(Condition = JsonIgnoreCondition.Always)]
+        public List<UseRoom> DataList { get; set; } = new List<UseRoom>();
+
+        /// <summary>
+        /// 値変更あり
+        /// </summary>
+        /// <param name="inputText"></param>
+        /// <returns></returns>
+        public override bool IsValueChanged(int index, string inputText)
+        {
+            if (index == (int)ColType.ID)
+            {
+                if (DataList.Count == 0) { return true; }
+                return CConvert.ToInt(inputText) != DataList[0].RoomTypeID;
+            }
+            else if (index == (int)ColType.Count)
+            {
+                return CConvert.ToInt(inputText) != DataList.Count;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        /// <summary>
+        /// DOMの表示値
+        /// </summary>
+        /// <param name="index"></param>
+        /// <param name="JSRuntime"></param>
+        /// <returns></returns>
+        public async Task<string> GetInputValue(int index, IJSRuntime JSRuntime)
+        {
+            return await Cells[index].Ref.GetInputValue(JSRuntime);
+        }
+
+        /// <summary>
+        /// 表示の値の復元
+        /// </summary>
+        /// <param name="index"></param>
+        public void RestoreText(ColType index)
+        {
+            SetCellText((int)index, GetDataField((int)index));
+        }
+
+        /// <summary>
+        /// データの値
+        /// </summary>
+        /// <param name="index"></param>
+        /// <returns></returns>
+        public string GetDataField(int index)
+        {
+            if (index == (int)ColType.ID)
+            {
+                return DataList.Count == 0 ? string.Empty : DataList[0].RoomTypeID.ToString(); 
+            }
+            else if (index == (int)ColType.Count)
+            {
+                return DataList.Count.ToString();
+            }
+            else
+            {
+                return string.Empty;
+            }
+        }
+
+        public void SetDataField(int index, string inputText)
+        {
+            if (index == (int)ColType.ID)
+            {
+                foreach(UseRoom item in DataList)
+                {
+                    item.RoomTypeID = CConvert.ToInt(inputText);
+                }
+            }
+            else if (index == (int)ColType.Count)
+            {
+            }
+        }
+    }
+}

--
Gitblit v1.10.0