public static List <ProductInStoreWithDetailDto> GetListOnlyOneDetail(int pageIndex, int pageSize) { var list = new List <ProductInStoreWithDetailDto>(); var dmoQuery = new DmoQuery(typeof(ProductInStore)); dmoQuery.Range = new SelectRange(pageSize * pageIndex, pageSize); dmoQuery.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", true)); dmoQuery.Where.Conditions.Add(DQCondition.EQ("Domain_ID", DomainContext.Current.ID)); var dmoList = dmoQuery.EExecuteList().Cast <ProductInStore>(); foreach (ProductInStore inStore in dmoList) { var dto = new ProductInStoreWithDetailDto(); dto.ID = inStore.ID; dto.Date = inStore.InStoreDate; dto.BillState = inStore.BillState.Value; dto.BillStateStr = inStore.BillState.Name; var detail = inStore.Details.FirstOrDefault(); if (detail != null) { dto.Goods_Name = detail.Goods_Name; dto.Goods_Spec = detail.Goods_Spec; dto.Number = detail.Number; dto.SecondNumber = detail.SecondNumber; list.Add(dto); } } return(list); }
public static string GetCalculateSpec() { var query = new DmoQuery(typeof(CalculateSpec)); query.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); var list = query.EExecuteList().Cast <CalculateSpec>().ToList(); return(JsonConvert.SerializeObject(list)); }
private static WorkShopPackBill GetBillByChaCarBarCode(IDmoSession session, string charBarCode) { var query = new DmoQuery(typeof(WorkShopPackBill)); query.Where.Conditions.Add(DQCondition.EQ("ChaCarBarCode", charBarCode)); var res = (WorkShopPackBill)session.ExecuteScalar(query); return(res); }
static ProductNotice GetPrevOrNext(long currentID, bool prev = true) { var query = new DmoQuery(typeof(ProductNotice)); query.Where.Conditions.Add(DQCondition.EQ("Domain_ID", DomainContext.Current.ID)); query.Where.Conditions.Add(prev ? DQCondition.LessThan("ID", currentID) : DQCondition.GreaterThan("ID", currentID)); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID", prev)); query.Range = SelectRange.Top(1); return(query.EExecuteScalar <ProductNotice>()); }
public static string GetAllWorkShopCountConfigList() { var dmoquery = new DmoQuery(typeof(WorkShopCountConfig)); dmoquery.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); var list = dmoquery.EExecuteList().Cast <WorkShopCountConfig>().ToList(); var jsonStr = JsonConvert.SerializeObject(list); //var jsonStr = serializer.Serialize(list); return(jsonStr); }
public static IList <ProductInStoreTemplate> GetProductInStoreTemplate(long[] id) { if (id.Length == 0) { return(new List <ProductInStoreTemplate>()); } var query = new DmoQuery(typeof(ProductInStoreTemplate)); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID")); query.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), id.Select(x => DQExpression.Value(x)).ToArray())); return(query.EExecuteList().Cast <ProductInStoreTemplate>().ToList()); }
public static string GetAllFrozenInStoreSetBillList(int billstate) { var dmoquery = new DmoQuery(typeof(FrozenInStoreSetBill)); dmoquery.Where.Conditions.Add(DQCondition.EQ("BillState", billstate)); var list = dmoquery.EExecuteList().Cast <FrozenInStoreSetBill>().ToList(); var jsonStr = JsonConvert.SerializeObject(list); //var jsonStr = serializer.Serialize(list); return(jsonStr); }
public static string GetList() { using (var session = Dmo.NewSession()) { var query = new DmoQuery(typeof(ClientGoodsSet)); query.Where.Conditions.Add(DQCondition.EQ("Stopped", false)); var list = session.ExecuteList(query).Cast <ClientGoodsSet>().ToList(); var prod = FromProductNotice(session); list.Add(prod); var json = JsonConvert.SerializeObject(list); return(json); } }