using DeviceRepair.DataAccess.Data; using DeviceRepair.DataAccess.Utils; using DeviceRepair.Models; using DeviceRepair.Models.SFC; using DeviceRepair.Utils; using NLog; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; namespace DeviceRepair.DataAccess.User { public class UserDa : BaseDa { private static readonly Logger log = LogManager.GetCurrentClassLogger(); public UserDa() : base() { } public UserDa(IDictionary apiParams) : base(apiParams) { } /// /// 用户登录 /// /// /// /// /// public APIResponseData UserLogin(string userCode, string pwd, out DataSet dsDatas) { dsDatas = new DataSet("Datas"); try { dsDatas = sfcData.Ado.UseStoredProcedure().GetDataSetAll(SQLConstants.SP_USER_LOGIN, new { UserCode = userCode, Pwd = pwd, cType = "I", ClientIP = ApiParameters["CLIENTIP"], ClientMAC = ApiParameters["CLIENTMAC"], ClientName = ApiParameters["CLIENTNAME"] }); return new APIResponseData() { Code = 1, Message = "用户登陆成功!" }; } catch (Exception ex) { log.Error(ex); return new APIResponseData { Code = -1, Message = ex.Message }; } } /// /// 获取全部SFC用户信息 /// /// public DataSet Get_User_Datas() { DataSet dsDatas = new DataSet("Datas"); try { List Datas = sfcData.Ado.SqlQuery("SELECT Id,GUID,UserCode,UserName,UserType,Status FROM dbo.UserInfo "); DataTable table = Datas.ToDataTable(); dsDatas.Tables.Add(table); return dsDatas; } catch (SqlException sqlEx) { throw sqlEx; } catch (Exception ex) { throw ex; } } } }