protected T SetViewResult <T, S>(T viewResult, string pOID = null) where T : IOrder <S>, new() where S : IOrderDetails, new() { if (!string.IsNullOrEmpty(pOID)) { var service = new VInventoryListService(); int totalCount = 0; var queryResult = service.Query(new VInventoryListQueryConditions { POID = pOID }, out totalCount); if (totalCount != 0) { viewResult = EntityHelper.CopyEntity(queryResult.First(), viewResult); viewResult.Details = EntityHelper.CopyEntities(queryResult, new List <S>()); } } var orderForeID = BuilderDictionary.ForeIDDictionary.FirstOrDefault(i => i.Key == typeof(T)).Value; var nowDate = DateTime.Now; viewResult.ID = orderForeID + nowDate.ToString("yyyyMMddHHmmss"); viewResult.Date = nowDate; //EntityHelper.SetEntityID(viewResult, orderForeID + nowDate.ToString("yyyyMMddHHmmss")); //EntityHelper.SetPropertyValue(viewResult, "Date", nowDate); return(viewResult); }
public ActionResult TOAddPage() { var viewResult = new TransferOrderViewResult(); string pOID = Request.QueryString["poid"]; if (!string.IsNullOrEmpty(pOID)) { var service = new VInventoryListService(); int totalCount = 0; var queryResult = service.Query(new VInventoryListQueryConditions { POID = pOID }, out totalCount); if (totalCount != 0) { viewResult.OutName = queryResult.First().WarehouseName; viewResult.Details = EntityHelper.CopyEntities(queryResult, new List <TODetailsViewResult>()); } } var orderForeID = BuilderDictionary.ForeIDDictionary.FirstOrDefault(i => i.Key == typeof(TransferOrderViewResult)).Value; var nowDate = DateTime.Now; EntityHelper.SetEntityID(viewResult, orderForeID + nowDate.ToString("yyyyMMddHHmmss")); EntityHelper.SetPropertyValue(viewResult, "Date", nowDate); return(View("TOAddPage", viewResult)); }
public ActionResult Index() { int totalCount = 0; var queryConditions = new VInventoryListQueryConditions { OrderBy = "WarehouseID", PageSize = 15, PageIndex = 1 }; if (Request.QueryString.HasKeys()) { queryConditions.GetValues(Request.QueryString); } if (queryConditions.PageIndex < 1) { queryConditions.PageIndex = 1; } var service = new VInventoryListService(); var results = service.Query(queryConditions, out totalCount); ViewBag.ViewResults = EntityHelper.CopyEntities(results, new List <VInventoryListViewResult>()); ViewBag.TotalPage = (totalCount + 14) / 15; ViewBag.PageIndex = queryConditions.PageIndex; ViewBag.QueryConditions = queryConditions; return(View("Index")); }