1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| public MODEL.LITModel GetInfoLIT(int k1, int k2, int k3, int k4, int k5,int k6, int k7, int k8)
{
MODEL.LITModel result = new MODEL.LITModel();
try
{
this.OpenConnection();
string request = @"SELECT LIT0001,LIT0002 , LIT0003,TT8710,TT8720,TT8730,WT8730_WD,WT8730_WS
FROM LIT_TT_WT
WHERE id = (Select TOP 1 id FROM LIT_TT_WT ORDER BY id Desc)";
this.Cmd = new SqlCommand(request, Cnx);
SqlDataReader Rd = this.Cmd.ExecuteReader();
if (Rd.HasRows)
{
Rd.Read();
result = new MODEL.LITModel
{
LIT0001 = Rd.GetFloat(0),
LIT0002 = Rd.GetFloat(1),
LIT0003 = Rd.GetFloat(2),
TT8710 = Rd.GetFloat(3),
TT8720 = Rd.GetFloat(4),
TT8730 = Rd.GetFloat(5),
WT8730_WD = Rd.GetFloat(6),
WT8730_WS = Rd.GetFloat(7),
};
}
Service.modbusRegistre[k1] = Rd.GetFloat(6);
Service.modbusRegistre[k2] = Rd.GetFloat(7);
Service.modbusRegistre[k3] = Rd.GetFloat(0);
Service.modbusRegistre[k4] = Rd.GetFloat(1);
Service.modbusRegistre[k5] = Rd.GetFloat(2);
Service.modbusRegistre[k6] = Rd.GetFloat(3);
Service.modbusRegistre[k7] = Rd.GetFloat(4);
Service.modbusRegistre[k8] = Rd.GetFloat(5);
}
catch (Exception ex)
{
result = new MODEL.LITModel();
}
finally
{
this.CloseConnection();
}
return result;
} |
Partager