using HotelPms.Share.Util; using System.Data; using System.Reflection; namespace HotelPms.Share.Data; public abstract class RecordBase : IRecord { /// /// eƒf[ƒ^ /// public object Parent { get; set; } = null; /// /// –Ú•WƒNƒ‰ƒX‚ɃRƒs[‚·‚é /// /// public abstract void CopyTo(object dest); /// /// ƒf[ƒ^‚ðƒNƒŠƒA‚·‚é /// public abstract void Clear(); public abstract object? GetField(string name); public virtual bool SetField(string name, object value) { return false; } /// /// DataRow‚̏î•ñ‚ÅŽ©g‚ðXV‚·‚é(”Ä—p‚¾‚©‚çA‚¿‚å‚Á‚Æ’x‚¢) /// /// /// public abstract bool ConvertDataRow(DataRow row); /// iƒeƒXƒg—pjŒ³ƒf[ƒ^‚Æ”äŠr‚µ‚ĕςí‚Á‚½‚Æ‚±‚ë‚́uV©Œ³yIzv‚Æ‚·‚é /// /// /// public string CompareOrgItem(RecordBase orgItem) { string outInfo = string.Empty; try { if (orgItem == null) return this.ToString(); Dictionary dic = new Dictionary(); PropertyInfo[] myInfo = orgItem.GetType().GetProperties(); foreach (PropertyInfo item in myInfo) { dic.Add(item.Name, new object[] { string.Format("{0}", CConvert.GetPropertyValue(orgItem, item.Name)), null }); } myInfo = this.GetType().GetProperties(); foreach (PropertyInfo item in myInfo) { dic[item.Name][1] = string.Format("{0}", CConvert.GetPropertyValue(this, item.Name)); if (dic[item.Name][1].Equals(dic[item.Name][0])) { outInfo += string.Format("{0} = {1}" + Environment.NewLine, item.Name, dic[item.Name][1]); } else { outInfo += string.Format("{0} = {1} © {2}yIz" + Environment.NewLine, item.Name, dic[item.Name][1], dic[item.Name][0]); } } } catch (Exception ex) { outInfo = ex.Message; } return outInfo; } }