public ActionResult Query(LotBinQueryViewModel model) { if (ModelState.IsValid) { using (LotBinServiceClient client = new LotBinServiceClient()) { MethodReturnResult <IList <PackageBin> > result = client.QueryBinListFromPackageLine(model.PackageLine); if (result.Code == 0) { ViewBag.List = result.Data; } } } if (Request.IsAjaxRequest()) { return(PartialView("_ListPartial", model)); } else { return(View(model)); } }
public string GetQueryCondition(LotBinQueryViewModel model) { StringBuilder where = new StringBuilder(); /* * if (model != null) * { * where.Append(@" EXISTS ( From LotTransaction as p * WHERE p.Key=self.Key.TransactionKey * AND p.UndoFlag='0')"); * * if (!string.IsNullOrEmpty(model.OrderNumber)) * { * where.AppendFormat(@" {0} EXISTS( From LotTransaction as p * WHERE p.Key=self.Key.TransactionKey * AND p.OrderNumber='{1}')" * , where.Length > 0 ? "AND" : string.Empty * , model.OrderNumber); * } * * if (!string.IsNullOrEmpty(model.RouteStepName)) * { * where.AppendFormat(@" {0} EXISTS( From LotTransaction as p * WHERE p.Key=self.Key.TransactionKey * AND p.RouteStepName='{1}')" * , where.Length > 0 ? "AND" : string.Empty * , model.RouteStepName); * } * * if (!string.IsNullOrEmpty(model.ReasonCodeName)) * { * where.AppendFormat(" {0} Key.ReasonCodeName LIKE '{1}%'" * , where.Length > 0 ? "AND" : string.Empty * , model.ReasonCodeName); * } * * if (!string.IsNullOrEmpty(model.RouteOperationName)) * { * where.AppendFormat(" {0} RouteOperationName LIKE '{1}%'" * , where.Length > 0 ? "AND" : string.Empty * , model.RouteOperationName); * } * * if (!string.IsNullOrEmpty(model.ResponsiblePerson)) * { * where.AppendFormat(" {0} ResponsiblePerson LIKE '{1}%'" * , where.Length > 0 ? "AND" : string.Empty * , model.ResponsiblePerson); * } * * if (model.StartTime != null) * { * where.AppendFormat(" {0} EditTime >= '{1:yyyy-MM-dd HH:mm:ss}'" * , where.Length > 0 ? "AND" : string.Empty * , model.StartTime); * } * * if (model.EndTime != null) * { * where.AppendFormat(" {0} EditTime <= '{1:yyyy-MM-dd HH:mm:ss}'" * , where.Length > 0 ? "AND" : string.Empty * , model.EndTime); * } * * }*/ return(where.ToString()); }
public ActionResult Query() { LotBinQueryViewModel model = new LotBinQueryViewModel(); return(Query(model)); }