79 lines
2.8 KiB
C#
79 lines
2.8 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.Http;
|
|
using Xylem.Common.Cryptology.Security;
|
|
using Xylem.Common.Logic.ServiceCore;
|
|
|
|
namespace Xylem.Common.Service.MeterProcessState.Controllers
|
|
{
|
|
public class LutController : ApiController
|
|
{
|
|
public static class GlobalConfig
|
|
{
|
|
public static Lazy<String> connectionString = new Lazy<String>(()
|
|
=>
|
|
System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
|
|
);
|
|
}
|
|
//
|
|
[Route("GetLutList"), HttpGet]
|
|
public async Task<HttpResponseMessage> GetLutList()
|
|
{
|
|
|
|
return await Task.Run(() =>
|
|
{
|
|
try
|
|
{
|
|
var ret = new System.Collections.Generic.List<UserInformation>();
|
|
using (var dataacces = new SqlDataAccess(GlobalConfig.connectionString.Value))
|
|
{
|
|
var sb = new StringBuilder();
|
|
|
|
sb.AppendLine($" SELECT [Id] , lut.[FileID] ,[DataLength] ,[Version] ,[FileCrc] ,[MeterSize] ,[FileContent] FROM[Auftrag].[dbo].[Cordonel_Lut] lut inner join [Auftrag].[dbo].[File] f on lut.FileID = f.FileId");
|
|
|
|
|
|
var dbResult = dataacces.ExecuteQuery(sb.ToString());
|
|
|
|
foreach (DataRow row in dbResult.Rows)
|
|
{
|
|
ret.Add(
|
|
new UserInformation((Int32)row["UserId"])
|
|
{
|
|
FullName = row["FullName"] == DBNull.Value ? "" : (String)row["FullName"],
|
|
LogInName = (String)row["LogInName"],
|
|
Domain = (String)row["Domain"],
|
|
HardwareId = row["HardwareId"] == DBNull.Value ? "" : (String)row["HardwareId"],
|
|
PasswordHash = row["PasswordHash"] == DBNull.Value ? "" : (String)row["PasswordHash"],
|
|
RegisterDate = (DateTimeOffset)row["RegisterDate"],
|
|
ValidDate = (DateTimeOffset)row["ValidDate"],
|
|
AccountActive = (Boolean)row["AccountActive"],
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return Request.CreateResponse(HttpStatusCode.OK, true);
|
|
|
|
|
|
//return Request.CreateResponse(HttpStatusCode.OK, getUserList(LogInName, Id));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Request.CreateResponse(HttpStatusCode.InternalServerError, ex);
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|