Dtos/CustomerMasterDto.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ChatworkBulkSender.Services.Chatwork;

namespace ChatworkBulkSender.Dtos
{
    public class CustomerMasterDto
    {
        public int ManagementNumber { get; set; }

        public string CustomerName { get; set; }

        public string RoomId { get; set; }

        public string DestinationAccountId { get; set; }

        public int SortOrder { get; set; }

        public bool IsUnused { get; set; }

        public DateTime? CreatedAt { get; set; }

        public string CreatedBy { get; set; }

        public DateTime? UpdatedAt { get; set; }

        public string UpdatedBy { get; set; }

        // 以下、テーブル定義以外のパラメーター
        /// <summary>
        /// 選択されたデータか
        /// </summary>
        public bool IsSelected { get; set; } = false;
        /// <summary>
        /// ファイルパス
        /// ※この顧客に対応するファイルの絶対パス
        /// </summary>
        public string FilePath { get; set; }
        /// <summary>
        /// この顧客に対応する添付PDFファイルが複数見つかったか
        /// </summary>
        public bool ExistsMultiplePDF { get; set; }
        /// <summary>
        /// 実際に送信することになるメッセージ
        /// </summary>
        public string SendActualContents { get; set; }
        /// <summary>
        /// 送信処理結果
        /// </summary>
        public SendResult Result { get; set; }


        public CustomerMasterDto()
        {
            // 送信中に緊急停止した場合、まだ処理されていないCustomerMasterDtoクラスであったとしてもSendResultのインスタンスが用意された状態となるようにする。
            // リザルト画面でエラーなく参照できるようにするため
            Result = new SendResult();
        }
        // ★ コピーコンストラクタ
        public CustomerMasterDto(CustomerMasterDto src)
        {
            this.ManagementNumber = src.ManagementNumber;
            this.CustomerName = src.CustomerName;
            this.RoomId = src.RoomId;
            this.DestinationAccountId = src.DestinationAccountId;
            this.SortOrder = src.SortOrder;
            this.IsUnused = src.IsUnused;
            this.CreatedAt = src.CreatedAt;
            this.CreatedBy = src.CreatedBy;
            this.UpdatedAt = src.UpdatedAt;
            this.UpdatedBy = src.UpdatedBy;

            this.IsSelected = src.IsSelected;
            this.FilePath = src.FilePath;
            this.ExistsMultiplePDF = src.ExistsMultiplePDF;
            this.SendActualContents = src.SendActualContents;
            this.Result = src.Result;
        }
    }
}