using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using RDH.Data.Models;

namespace RDH.Data.BLL
{
    public partial class OperationRoomBLL : BaseOrclBLL<OperationRoom>, IOperationRoomBLL
    {
        public OperationRoomBLL() : base()
        {
            AliasTableName = "opr";
        }

        internal override String TABLE_NAME { get { return "OPERATION_ROOM"; } }//TB_NAME
        internal override string ENTITY_NAME { get { return "OperationRoom"; } }
        internal override String KEY_COLUMN { get { return "KEY"; } }//KEY_COLUMN

        internal override void InitMaps()
        {
            ColumnPropMaps.Add("KEY", "Key");
            ColumnPropMaps.Add("CREATE_BY", "CreateBy");
            ColumnPropMaps.Add("CREATE_TIME", "CreateTime");
            ColumnPropMaps.Add("ROOM_ID", "RoomId");
            ColumnPropMaps.Add("ROOM_NAME", "RoomName");
            ColumnPropMaps.Add("ROOM_DESCRIPTION", "RoomDescription");
            ColumnPropMaps.Add("FLAG", "Flag");
            ColumnPropMaps.Add("CLIENT_TIME", "ClientTime");
            ColumnPropMaps.Add("SERVER_TIME", "ServerTime");
            ColumnPropMaps.Add("EXT01", "Ext01");
            ColumnPropMaps.Add("EXT02", "Ext02");
            ColumnPropMaps.Add("EXT03", "Ext03");
            ColumnPropMaps.Add("EXT04", "Ext04");
            ColumnPropMaps.Add("EXT05", "Ext05");
            ColumnPropMaps.Add("EXT06", "Ext06");
            ColumnPropMaps.Add("EXT07", "Ext07");
            ColumnPropMaps.Add("EXT08", "Ext08");
            ColumnPropMaps.Add("EXT09", "Ext09");
            ColumnPropMaps.Add("EXT10", "Ext10");//COLUMN_MAPS
        }

        internal override object GetParam(OperationRoom operationroom)
        {
            return new
            {
                Key = operationroom.Key,
                CreateBy = operationroom.CreateBy,
                CreateTime = operationroom.CreateTime,
                IsDelete = operationroom.IsDelete,
                RoomId = operationroom.RoomId,
                RoomName = operationroom.RoomName,
                RoomDescription = operationroom.RoomDescription,
                Flag = operationroom.Flag,
                ClientTime = operationroom.ClientTime,
                ServerTime = operationroom.ServerTime,
                Ext01 = operationroom.Ext01,
                Ext02 = operationroom.Ext02,
                Ext03 = operationroom.Ext03,
                Ext04 = operationroom.Ext04,
                Ext05 = operationroom.Ext05,
                Ext06 = operationroom.Ext06,
                Ext07 = operationroom.Ext07,
                Ext08 = operationroom.Ext08,
                Ext09 = operationroom.Ext09,
                Ext10 = operationroom.Ext10,   //Params
            };
        }
        public OperationRoom GetOperationRoomBySignalStation(String stationCode) 
        {
            return SqlMapper.Query<OperationRoom>(ConnectionFactory.Current.GetSessionConnection(),
                BuildBaseSql() + " WHERE ext02=:stationCode",
                new { stationCode = stationCode }).FirstOrDefault();
        }
    }

}