Пример #1
0
        private SearchStatementModel PrepareInventoryBalanceSearchStatement(GridCommand command, InventoryBalanceSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();
            HqlStatementHelper.AddEqStatement("Location", searchModel.Location, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Item", searchModel.Item, "i", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("SnapTime", searchModel.SnapTime, "i", ref whereStatement, param);



            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);


            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = selectCountInventoryBalanceStatement;
            searchStatementModel.SelectStatement = selectInventoryBalanceStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }
Пример #2
0
 public ActionResult _AjaxInventoryBalanceList(GridCommand command, InventoryBalanceSearchModel searchModel)
 {
     if (searchModel.SnapTime == DateTime.MinValue)
     {
         return PartialView(new GridModel(new List<InventoryBalance>()));
     }
     SearchStatementModel searchStatementModel = this.PrepareInventoryBalanceSearchStatement(command, searchModel);
     var dataList = GetAjaxPageData<InventoryBalance>(searchStatementModel, command);
     foreach (var data in dataList.Data)
     {
         data.ItemDescription = itemMgr.GetCacheItem(data.Item).FullDescription;
     }
     return PartialView(dataList);
 }
Пример #3
0
        public ActionResult _Update(GridCommand command, InventoryBalance inventoryBalance, string locationTo, string itemTo, DateTime? snapTimeTo
            )
        {
            InventoryBalanceSearchModel searchModel = new InventoryBalanceSearchModel();

            searchModel.Location = locationTo;
            searchModel.Item = itemTo;
            searchModel.SnapTime = snapTimeTo.Value;
            InventoryBalance newInventoryBalance = genericMgr.FindAll<InventoryBalance>(" from InventoryBalance as i where  i.Id=? ", new object[] { inventoryBalance.Id })[0];
            if (inventoryBalance.Qty != newInventoryBalance.Qty)
            {
                newInventoryBalance.Qty = inventoryBalance.Qty;
                genericMgr.Update(newInventoryBalance);
            }

            SearchStatementModel searchStatementModel = PrepareInventoryBalanceSearchStatement(command, searchModel);
            return PartialView(GetAjaxPageData<InventoryBalance>(searchStatementModel, command));
        }
Пример #4
0
 public ActionResult InventoryBalanceList(GridCommand command, InventoryBalanceSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.Location = searchModel.Location;
     ViewBag.Item = searchModel.Item;
     ViewBag.SnapTime = searchModel.SnapTime;
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     if (searchModel.SnapTime == DateTime.MinValue)
     {
         SaveErrorMessage(Resources.EXT.ControllerLan.Con_SnapTimeCanNotBeEmpty);
     }
     return View();
 }