DataEntry.iPerl bug fixes when invoked without the production tracing, ver. 3.1.1846

This commit is contained in:
Milan Hanajik
2022-01-06 08:00:07 +01:00
parent df89050d78
commit 4d018a8ba8
3 changed files with 16 additions and 10 deletions
+10 -4
View File
@@ -240,14 +240,20 @@ namespace TBF.Rig.Output.DB.ProductionTracing
return null;
}
public IList<OrderInfo> ReadOrders(ISession session)
public IList<OrderInfo> ReadOrders(ISession session = null)
{
bool openAndCloseSession = (session == null) || !session.IsOpen;
try
{
session = SessionFactory.OpenSession();
if (openAndCloseSession) session = SessionFactory.OpenSession();
var result = session.QueryOver<OrderInfo>()
.Where(x => (x.POState == (sbyte)OrderState.New || x.POState == (sbyte)OrderState.Active))
.List<OrderInfo>();
if (openAndCloseSession) session.Close();
return result;
}
catch (Exception exc)
@@ -266,8 +272,8 @@ namespace TBF.Rig.Output.DB.ProductionTracing
if (openAndCloseSession) session = SessionFactory.OpenSession();
var list = session.QueryOver<OrderInfo>()
.Where(x => (x.Id == order.Id))
.List();
.Where(x => (x.Id == order.Id))
.List();
if (openAndCloseSession) session.Close();