using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using DirectService.Tools;
using JLHHJSvr.BLL;
using JLHHJSvr.Com;
using JLHHJSvr.Com.Model;
using JLHHJSvr.Helper;
using JLHHJSvr.LJException;
using LJLib.DAL.SQL;
using LJLib.Net.SPI.Server;
using LJLib.SQLEX;

namespace JLHHJSvr.Excutor
{
    internal sealed class GetSoftBedConfigureListExcutor : ExcutorBase<GetSoftBedConfigureListRequest, GetSoftBedConfigureListResponse>
    {
        protected override void ExcuteInternal(GetSoftBedConfigureListRequest request, object state, GetSoftBedConfigureListResponse rslt)
        {
            var tokendata = BllHelper.GetToken(request.token);
            if (tokendata == null)
            {
                rslt.ErrMsg = "会话已经中断，请重新登录";
                return;
            }

            using (var con = GlobalVar.ConnectionString.NewSqlConnection())
            using (var cmd = con.CreateCommand())
            {
                con.Open();

                var softBedHelper = HelperBase.GetHelper<SoftBedHelper>(cmd);
                rslt.typeList = softBedHelper.GetSoftBedConfigureList(request.softbed,null);
            }
        }
    }
}
