アプリケーションの定型コードを短くしたい (1)
05/29/2011

ShortReflAttr.SomeModel

using System;
using System.Collections;
using System.Collections.Generic;
using CodeCompress;

using System.Reflection;

namespace CodeCompress.ShortReflAttr
{
    [OnPropertyChangedCall]
    public class SomeModel : AbstractModel
    {
         /// <summary>
        /// コンストラクタ
        /// </summary>
        public SomeModel()
        {
        }

        /// <summary>
        /// コンストラクタ
        /// </summary>
        public SomeModel(SomeModel someModel) : base(someModel)
        {
        }

        /// <summary>
        /// メッセージ
        /// </summary>
        private class Message
        {
            /// <summary>
            /// エラー
            /// </summary>
            public class Error
            {
                /// <summary>
                /// 必須入力
                /// </summary>
                public const string Required = "{0}は、必須入力です。";
            }
        }


        /// <summary>
        /// 何かコード
        /// </summary>
        public string SomeCd { get; set; }

        /// <summary>
        /// 表示順
        /// </summary>
        public int Order { get; set;}

        /// <summary>
        /// 名称漢字
        /// </summary>
        public string Nmj { get; set; }

        /// <summary>
        /// 名称カナ
        /// </summary>
        public string Nmk  { get; set; }

        /// <summary>
        /// 略称
        /// </summary>
        public string Nms { get; set; }

        /// <summary>
        /// 何かグループコード
        /// </summary>
        public string SomeAreaCd { get; set; }

        /// <summary>
        /// 何か区分
        /// </summary>
        public int SomeType { get; set; }

        /// <summary>
        /// 何か形態
        /// </summary>
        public int Mode { get; set; }

        /// <summary>
        /// 契約形態
        /// </summary>
        public int Catego { get; set; }

        /// <summary>
        /// 倉庫コード
        /// </summary>
        public string WarehouseCd { get; set; }

        /// <summary>
        /// 郵便番号
        /// </summary>
        public string Postno { get; set; }

        /// <summary>
        /// 住所1
        /// </summary>
        public string Addre1 { get; set; }

        /// <summary>
        /// 住所2
        /// </summary>
        public string Addre2 { get; set; }

        /// <summary>
        /// 住所3
        /// </summary>
        public string Addre3 { get; set; }

        /// <summary>
        /// 電話番号
        /// </summary>
        public string Telno { get; set; }

        /// <summary>
        /// FAX番号
        /// </summary>
        public string Faxno { get; set; }

        /// <summary>
        /// URL
        /// </summary>
        public string Url { get; set; }

        /// <summary>
        /// E-Mailアドレス
        /// </summary>
        public string EMail { get; set; }

        /// <summary>
        /// 床数
        /// </summary>
        public decimal FloorNum { get; set; }

        /// <summary>
        /// POS台数
        /// </summary>
        public decimal PosNum { get; set; }

        /// <summary>
        /// 参加者数
        /// </summary>
        public decimal EmpNum { get; set; }

        /// <summary>
        /// 定休日
        /// </summary>
        public DateTime Rest { get; set; }

        /// <summary>
        /// 区分1
        /// </summary>
        public string Rsv1 { get; set; }

        /// <summary>
        /// 区分2
        /// </summary>
        public string Rsv2 { get; set; }

        /// <summary>
        /// 区分3
        /// </summary>
        public string Rsv3 { get; set; }

        /// <summary>
        /// 稼動フラグ
        /// </summary>
        public bool ActiveFlg { get; set; }

        /// <summary>
        /// 更新フラグ
        /// </summary>
        public bool UpdateFlg { get; set; }

        /// <summary>
        /// 更新実行日
        /// </summary>
        public DateTime UpdateYmd { get; set; }

        /// <summary>
        /// 登録日
        /// </summary>
        public DateTime RegistYmd { get; set; }

        /// <summary>
        /// 修正日
        /// </summary>
        public DateTime ModifyYmd { get; set; }

        /// <summary>
        /// 登録何かコード
        /// </summary>
        public string RegistSomeCd { get; set; }

        /// <summary>
        /// 登録参加者コード
        /// </summary>
        public string RegistEmpCd { get; set; }
        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="messages"></param>
        protected void SetPropValidate_SomeCd(ref IList<string>messages)
        {
            if (string.IsNullOrEmpty(this.SomeCd))
            {
                messages.Add(string.Format(Message.Error.Required, "何かコード"));
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="messages"></param>
        protected void SetPropValidate_SomeAreaCd(ref IList<string> messages)
        {
            if (string.IsNullOrEmpty(this.SomeAreaCd))
            {
                messages.Add(string.Format(Message.Error.Required, "何かグループ"));
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="messages"></param>
        protected void SetPropValidate_Nmj(ref IList<string> messages)
        {
            if (string.IsNullOrEmpty(this.Nmj))
            {
                messages.Add(string.Format(Message.Error.Required, "名称(漢字)"));
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="messages"></param>
        protected void SetPropValidate_Nmk(ref IList<string> messages)
        {
            if (string.IsNullOrEmpty(this.Nmk))
            {
                messages.Add(string.Format(Message.Error.Required, "名称(カナ)"));
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="messages"></param>
        protected void SetPropValidate_Nms(ref IList<string> messages)
        {
            if (string.IsNullOrEmpty(this.Nms))
            {
                messages.Add(string.Format(Message.Error.Required, "略称(漢字)"));
            }
        }
    }
}

Top of Site
Copyright (c) 2011 Takao Tamura