|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using ButcherManage.BO;
|
|
|
|
|
|
namespace ButcherManage.BO.LocalBL
|
|
|
{
|
|
|
public static class GradeAndWeightBL
|
|
|
{
|
|
|
public static IEnumerable<Livestock> GetLivestock()
|
|
|
{
|
|
|
var query = new DQueryDom(new JoinAlias(typeof(Livestock)));
|
|
|
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("SortNum"));
|
|
|
query.Columns.Add(DQSelectColumn.Field("ID"));
|
|
|
query.Columns.Add(DQSelectColumn.Field("Name"));
|
|
|
query.Columns.Add(DQSelectColumn.Field("Technics"));
|
|
|
using (var session = DmoSession.New())
|
|
|
{
|
|
|
var list = query.EExecuteList<long, string, short>(session);
|
|
|
return list.Select(x => new Livestock { ID = x.Item1, Name = x.Item2, Technics = x.Item3 });
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static IEnumerable<BodyDiscont> GetBodyDiscont()
|
|
|
{
|
|
|
var dom = new DmoQuery(typeof(BodyDiscont));
|
|
|
dom.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
|
|
|
using (var session = DmoSession.New())
|
|
|
{
|
|
|
return session.ExecuteList(dom).Cast<BodyDiscont>();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//public static void SetGradeFinish(int order, DateTime date, short technics)
|
|
|
//{
|
|
|
// using (var session = DmoSession.New())
|
|
|
// {
|
|
|
// if (Finished(session, date, order, technics))
|
|
|
// return;
|
|
|
// session.Insert(new OrderGradeFinishRelate(order, date, technics));
|
|
|
// session.Commit();
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
//static bool Finished(IDmoSession session, DateTime date, int order, short technics)
|
|
|
//{
|
|
|
// var query = new DQueryDom(new JoinAlias(typeof(OrderGradeFinishRelate)));
|
|
|
// query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Order", order), DQCondition.EQ("Date", date), DQCondition.EQ("Technics", technics)));
|
|
|
// query.Columns.Add(DQSelectColumn.Create(DQExpression.Value("1"), "c"));
|
|
|
// return session.ExecuteScalar(query) != null;
|
|
|
//}
|
|
|
}
|
|
|
}
|