using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using JLHHJSvr.BLL;
using JLHHJSvr.Com;
using JLHHJSvr.Com.Model;
using JLHHJSvr.DBA.DBModle;
using LJLib.DAL.SQL;
using LJLib.Net.SPI.Server;

namespace JLHHJSvr.Excutor
{
    internal sealed class GetUserListExcutor : ExcutorBase<GetUserListRequest, GetUserListResponse>
    {
        protected override void ExcuteInternal(GetUserListRequest request, object state, GetUserListResponse rslt)
        {
            var tokendata = BllHelper.GetToken(request.token);
            if (tokendata == null)
            {
                rslt.ErrMsg = "会话已经中断，请重新登录";
                return;
            }
            using (var con = new SqlConnection(GlobalVar.ConnectionString))
            using (var cmd = con.CreateCommand())
            {
                con.Open();

                rslt.userList = new List<u_user_jlhprice>();
                DbSqlHelper.Select(cmd, "u_user_jlhprice", null, null, null, 0, 0, rslt.userList, null,
                    "empid, userid, username, rightstring, descrp, deptstr, usermode, outrepstr, pricelist_seestr, pricelist_editstr,access_failed_count,last_failed_attempt_time");
            }
        }
    }
}
