示例#1
0
        public ActionResult _AjaxHuToMappingList(GridCommand command, HuToMappingSearchModel searchModel)
        {
            SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
            var gridModel = GetAjaxPageData<HuToMapping>(searchStatementModel, command);
            foreach (var huToMapping in gridModel.Data)
            {

                huToMapping.HuToDescription = this.genericMgr.FindById<HuTo>(huToMapping.HuTo).Description;
                if (!string.IsNullOrWhiteSpace(huToMapping.Flow))
                {
                    huToMapping.FlowDescription = this.genericMgr.FindById<FlowMaster>(huToMapping.Flow).Description;
                }
                if (!string.IsNullOrWhiteSpace(huToMapping.Item))
                {
                    huToMapping.ItemDescription = this.genericMgr.FindById<Item>(huToMapping.Item).Description;
                }
                if (!string.IsNullOrWhiteSpace(huToMapping.Fg))
                {
                    huToMapping.FgDescription = this.genericMgr.FindById<Item>(huToMapping.Fg).Description;
                }
                if (!string.IsNullOrWhiteSpace(huToMapping.Party))
                {

                    var party = this.genericMgr.FindById<Party>(huToMapping.Party);
                    huToMapping.PartyName = this.genericMgr.FindById<Party>(huToMapping.Party).Name;
                    if (party is Customer)
                    {
                        huToMapping.PartyType = Resources.EXT.ControllerLan.Con_Customer;
                    }
                    else if (party is Region)
                    {
                        huToMapping.PartyType = Resources.EXT.ControllerLan.Con_Area;
                    }
                    else
                    {
                        huToMapping.PartyType = Resources.EXT.ControllerLan.Con_Supplier;
                    }
                }
            }
            return PartialView(gridModel);
        }
示例#2
0
        private SearchStatementModel PrepareSearchStatement(GridCommand command, HuToMappingSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();
            if (!string.IsNullOrWhiteSpace(searchModel.Flow))
                HqlStatementHelper.AddEqStatement("Flow", searchModel.Flow, "h", ref whereStatement, param);
            if (!string.IsNullOrWhiteSpace(searchModel.HuTo))
                HqlStatementHelper.AddEqStatement("HuTo", searchModel.HuTo, "h", ref whereStatement, param);
            if (!string.IsNullOrWhiteSpace(searchModel.Item))
                HqlStatementHelper.AddEqStatement("Item", searchModel.Item, "h", ref whereStatement, param);
            if (!string.IsNullOrWhiteSpace(searchModel.Party))
                HqlStatementHelper.AddEqStatement("Party", searchModel.Party, "h", ref whereStatement, param);

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);
            if (command.SortDescriptors.Count == 0)
            {
                sortingStatement = " order by h.Id desc";
            }

            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = "select count(*) from HuToMapping as h";
            searchStatementModel.SelectStatement = "select h from HuToMapping as h";
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }
示例#3
0
 public ActionResult HuToMappingList(GridCommand command, HuToMappingSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }