73 lines
1.8 KiB
C#
73 lines
1.8 KiB
C#
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
|
|
using Dapper;
|
|
|
|
|
|
namespace NX.ERP.U8.User
|
|
|
|
{
|
|
public class UserDal
|
|
{
|
|
|
|
public IEnumerable<Model.Request.User> GetList(string strWhere = "", object Param = null)
|
|
{
|
|
|
|
|
|
using (var conn = U8LoginContext.Instance.Connection)
|
|
{
|
|
var sql = @" select cUser_Id as UserCode ,cUser_Name as UserName from UFSystem..UA_User ";
|
|
if (!string.IsNullOrEmpty(strWhere))
|
|
{
|
|
sql += $" where {strWhere}";
|
|
}
|
|
return conn.Query<Model.Request.User>(sql, Param);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public Model.Request.User GetModel(string UserCode)
|
|
{
|
|
return this.GetList(" cUser_Id =@UserCode", new { UserCode }).FirstOrDefault();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string Userrole(string Opnanme, string Pasd)
|
|
{
|
|
var AccID = ConfigurationManager.AppSettings["AccId"];
|
|
//NX.ERP.U8.U8LoginContext.Instance.PassWord = System.Configuration.ConfigurationManager.AppSettings["Password"];
|
|
|
|
//NX.ERP.U8.U8LoginContext.Instance.UserId = System.Configuration.ConfigurationManager.AppSettings["UserId"];
|
|
|
|
var Server = ConfigurationManager.AppSettings["Server"];
|
|
var _login = new NX.ERP.U8.U8LoginContext(Server, AccID);
|
|
_login.Login(Opnanme, Pasd);
|
|
|
|
var sql = $@" SELECT 1 from UFSystem..UA_Role where cUser_Id=@Opnanme and cGroup_Id='report' ;";
|
|
|
|
|
|
|
|
using (var conn = _login.Connection)
|
|
{
|
|
return conn.ExecuteScalar<string>(sql, new { Opnanme }, null, 30, System.Data.CommandType.Text);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|