using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Data.SqlClient; using System.Text; using HotelPms.Share.Data; using HotelPms.Share.Util; using Google.Protobuf.WellKnownTypes; using customTypes; using System.Data.Common; namespace HotelPms.Data.Master { /// ****************************** Description ******************************* /// ◇システム名称 ///  ホテルPMS /// ◇概要 ///   /// ◇履歴 ///  2021/05/14 コード作成ツール 自動作成 /// ****************************** Declarations ****************************** [Serializable()] public partial class RoomCell : RecordBase { #region ★★★★★ Property ★★★★★ public static ConcurrentDictionary PrimaryKey { get; } = new ConcurrentDictionary(); #endregion partial void OnConstruction() { if (PrimaryKey.Count == 0) { PrimaryKey.TryAdd("TabID", 0); PrimaryKey.TryAdd("CtrlName", 0); } } #region ★★★★★ Function ★★★★★ public bool CompareTo(RoomCell item) { if (TabID.CompareTo(item.TabID) != 0 || CtrlName.CompareTo(item.CtrlName) != 0 || ID.CompareTo(item.ID) != 0 || Content.CompareTo(item.Content) != 0 || TextAlign.CompareTo(item.TextAlign) != 0 || Top.CompareTo(item.Top) != 0 || Left.CompareTo(item.Left) != 0 || Width.CompareTo(item.Width) != 0 || Heigh.CompareTo(item.Heigh) != 0 || BackColor.CompareTo(item.BackColor) != 0 || ForeColor.CompareTo(item.ForeColor) != 0 || BorderStyle.CompareTo(item.BorderStyle) != 0 || FontName.CompareTo(item.FontName) != 0 || FontSize.CompareTo(item.FontSize) != 0 || FontBold.CompareTo(item.FontBold) != 0 || FontItalic.CompareTo(item.FontItalic) != 0 || FontUnderline.CompareTo(item.FontUnderline) != 0 || Memo.CompareTo(item.Memo) != 0 ) { return false; } return true; } public override void CopyTo(object dest) { RoomCell item = dest as RoomCell; item.TabID = TabID; item.CtrlName = CtrlName; item.ID = ID; item.Content = Content; item.TextAlign = TextAlign; item.Top = Top; item.Left = Left; item.Width = Width; item.Heigh = Heigh; item.BackColor = BackColor; item.ForeColor = ForeColor; item.BorderStyle = BorderStyle; item.FontName = FontName; item.FontSize = FontSize; item.FontBold = FontBold; item.FontItalic = FontItalic; item.FontUnderline = FontUnderline; item.Memo = Memo; } public override void Clear() { TabID = 0; CtrlName = string.Empty; ID = 0; Content = string.Empty; TextAlign = 0; Top = 0; Left = 0; Width = 0; Heigh = 0; BackColor = string.Empty; ForeColor = string.Empty; BorderStyle = 0; FontName = string.Empty; FontSize = 0; FontBold = false; FontItalic = false; FontUnderline = false; Memo = string.Empty; } public RoomCell DeepClone() { RoomCell item = new RoomCell(); item.TabID = TabID; item.CtrlName = CtrlName; item.ID = ID; item.Content = Content; item.TextAlign = TextAlign; item.Top = Top; item.Left = Left; item.Width = Width; item.Heigh = Heigh; item.BackColor = BackColor; item.ForeColor = ForeColor; item.BorderStyle = BorderStyle; item.FontName = FontName; item.FontSize = FontSize; item.FontBold = FontBold; item.FontItalic = FontItalic; item.FontUnderline = FontUnderline; item.Memo = Memo; return item; } public override bool ConvertDataRow(System.Data.DataRow row) { TabID = CConvert.ToInt(row["TabID"],TabID); CtrlName = row["CtrlName"].ToString(); ID = CConvert.ToInt(row["ID"],ID); Content = row["Content"].ToString(); TextAlign = CConvert.ToInt(row["TextAlign"],TextAlign); Top = CConvert.ToFloat(row["Top"],Top); Left = CConvert.ToFloat(row["Left"],Left); Width = CConvert.ToFloat(row["Width"],Width); Heigh = CConvert.ToFloat(row["Heigh"],Heigh); BackColor = row["BackColor"].ToString(); ForeColor = row["ForeColor"].ToString(); BorderStyle = CConvert.ToInt(row["BorderStyle"],BorderStyle); FontName = row["FontName"].ToString(); FontSize = CConvert.ToInt(row["FontSize"],FontSize); FontBold = CConvert.ToBool(row["FontBold"]); FontItalic = CConvert.ToBool(row["FontItalic"]); FontUnderline = CConvert.ToBool(row["FontUnderline"]); Memo = row["Memo"].ToString(); return true; } public void ToDataRow(System.Data.DataRow row) { row["TabID"] = TabID; row["CtrlName"] = CtrlName; row["ID"] = ID; row["Content"] = Content; row["TextAlign"] = TextAlign; row["Top"] = Top; row["Left"] = Left; row["Width"] = Width; row["Heigh"] = Heigh; row["BackColor"] = BackColor; row["ForeColor"] = ForeColor; row["BorderStyle"] = BorderStyle; row["FontName"] = FontName; row["FontSize"] = FontSize; row["FontBold"] = FontBold; row["FontItalic"] = FontItalic; row["FontUnderline"] = FontUnderline; row["Memo"] = Memo; } public void ConvertReader(DbDataReader row) { TabID = CConvert.ToInt(row["TabID"],TabID); CtrlName = row["CtrlName"].ToString(); ID = CConvert.ToInt(row["ID"],ID); Content = row["Content"].ToString(); TextAlign = CConvert.ToInt(row["TextAlign"],TextAlign); Top = CConvert.ToFloat(row["Top"],Top); Left = CConvert.ToFloat(row["Left"],Left); Width = CConvert.ToFloat(row["Width"],Width); Heigh = CConvert.ToFloat(row["Heigh"],Heigh); BackColor = row["BackColor"].ToString(); ForeColor = row["ForeColor"].ToString(); BorderStyle = CConvert.ToInt(row["BorderStyle"],BorderStyle); FontName = row["FontName"].ToString(); FontSize = CConvert.ToInt(row["FontSize"],FontSize); FontBold = CConvert.ToBool(row["FontBold"]); FontItalic = CConvert.ToBool(row["FontItalic"]); FontUnderline = CConvert.ToBool(row["FontUnderline"]); Memo = row["Memo"].ToString(); } public string AddSql() { return $@"INSERT INTO M_RoomCell(TabID,CtrlName,ID,Content,TextAlign,Top,Left,Width,Heigh,BackColor,ForeColor,BorderStyle,FontName,FontSize,FontBold,FontItalic,FontUnderline,Memo) VALUES({TabID},N'{CtrlName}',{ID},N'{Content}',{TextAlign},{Top},{Left},{Width},{Heigh},N'{BackColor}',N'{ForeColor}',{BorderStyle},N'{FontName}',{FontSize},{(FontBold ? 1 : 0)},{(FontItalic ? 1 : 0)},{(FontUnderline ? 1 : 0)},N'{Memo}');"; } public string UpdateSql() { return $@"UPDATE M_RoomCell SET ID = {ID},Content = N'{Content}',TextAlign = {TextAlign},Top = {Top},Left = {Left},Width = {Width},Heigh = {Heigh},BackColor = N'{BackColor}',ForeColor = N'{ForeColor}',BorderStyle = {BorderStyle},FontName = N'{FontName}',FontSize = {FontSize},FontBold = {(FontBold ? 1 : 0)},FontItalic = {(FontItalic ? 1 : 0)},FontUnderline = {(FontUnderline ? 1 : 0)},Memo = N'{Memo}' WHERE TabID = {TabID} AND CtrlName = N'{CtrlName}';"; } public string ToText() { StringBuilder text = new StringBuilder(); text.AppendFormat("TabID={0};", TabID); text.AppendFormat("CtrlName={0};", CtrlName); text.AppendFormat("ID={0};", ID); text.AppendFormat("Content={0};", Content); text.AppendFormat("TextAlign={0};", TextAlign); text.AppendFormat("Top={0};", Top); text.AppendFormat("Left={0};", Left); text.AppendFormat("Width={0};", Width); text.AppendFormat("Heigh={0};", Heigh); text.AppendFormat("BackColor={0};", BackColor); text.AppendFormat("ForeColor={0};", ForeColor); text.AppendFormat("BorderStyle={0};", BorderStyle); text.AppendFormat("FontName={0};", FontName); text.AppendFormat("FontSize={0};", FontSize); text.AppendFormat("FontBold={0};", FontBold); text.AppendFormat("FontItalic={0};", FontItalic); text.AppendFormat("FontUnderline={0};", FontUnderline); text.AppendFormat("Memo={0};", Memo); return text.ToString(); } public override object GetField(string name) { if (name == "TabID") { return TabID; } else if (name == "CtrlName") { return CtrlName; } else if (name == "ID") { return ID; } else if (name == "Content") { return Content; } else if (name == "TextAlign") { return TextAlign; } else if (name == "Top") { return Top; } else if (name == "Left") { return Left; } else if (name == "Width") { return Width; } else if (name == "Heigh") { return Heigh; } else if (name == "BackColor") { return BackColor; } else if (name == "ForeColor") { return ForeColor; } else if (name == "BorderStyle") { return BorderStyle; } else if (name == "FontName") { return FontName; } else if (name == "FontSize") { return FontSize; } else if (name == "FontBold") { return FontBold; } else if (name == "FontItalic") { return FontItalic; } else if (name == "FontUnderline") { return FontUnderline; } else if (name == "Memo") { return Memo; } else { return null; } } public override bool SetField(string name, object value) { if (name == "TabID") { TabID = CConvert.ToInt(value); return true; } else if (name == "CtrlName") { CtrlName = value.ToString(); return true; } else if (name == "ID") { ID = CConvert.ToInt(value); return true; } else if (name == "Content") { Content = value.ToString(); return true; } else if (name == "TextAlign") { TextAlign = CConvert.ToInt(value); return true; } else if (name == "Top") { Top = CConvert.ToFloat(value); return true; } else if (name == "Left") { Left = CConvert.ToFloat(value); return true; } else if (name == "Width") { Width = CConvert.ToFloat(value); return true; } else if (name == "Heigh") { Heigh = CConvert.ToFloat(value); return true; } else if (name == "BackColor") { BackColor = value.ToString(); return true; } else if (name == "ForeColor") { ForeColor = value.ToString(); return true; } else if (name == "BorderStyle") { BorderStyle = CConvert.ToInt(value); return true; } else if (name == "FontName") { FontName = value.ToString(); return true; } else if (name == "FontSize") { FontSize = CConvert.ToInt(value); return true; } else if (name == "FontBold") { FontBold = CConvert.ToBool(value); return true; } else if (name == "FontItalic") { FontItalic = CConvert.ToBool(value); return true; } else if (name == "FontUnderline") { FontUnderline = CConvert.ToBool(value); return true; } else if (name == "Memo") { Memo = value.ToString(); return true; } else { return false; } } #endregion } }