Exemple #1
0
        private SearchStatementModel PrepareBomDetailSearchStatement(GridCommand command, BomDetailSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();

            HqlStatementHelper.AddLikeStatement("Bom", searchModel.BomDetail_Bom, HqlStatementHelper.LikeMatchMode.Start, "bd", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("Code", searchModel.BomDetail_Item, HqlStatementHelper.LikeMatchMode.Start, "bd.Item", ref whereStatement, param);

            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "StructureTypeDescription")
                {
                    command.SortDescriptors[0].Member = "StructureType";
                }
                if (command.SortDescriptors[0].Member == "BackFlushMethodDescription")
                {
                    command.SortDescriptors[0].Member = "BackFlushMethod";
                }
                if (command.SortDescriptors[0].Member == "FeedMethodDescription")
                {
                    command.SortDescriptors[0].Member = "FeedMethod";
                }
            }
            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

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

            return searchStatementModel;
        }
Exemple #2
0
 public ActionResult _AjaxList_Detail(GridCommand command, BomDetailSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = PrepareBomDetailSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<BomDetail>(searchStatementModel, command));
 }
Exemple #3
0
 public ActionResult List_Detail(GridCommand command, BomDetailSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return PartialView();
 }
 public void Export(BomDetailSearchModel searchModel)
 {
     int value = Convert.ToInt32(base.systemMgr.GetEntityPreferenceValue(EntityPreference.CodeEnum.MaxRowSizeOnPage));
     GridCommand command = new GridCommand();
     command.Page = 1;
     command.PageSize = !this.CheckSearchModelIsNull(searchModel) ? 0 : value;
     SearchStatementModel searchStatementModel = PrepareBomDetailSearchStatement(command, searchModel);
     var result = GetAjaxPageData<BomDetail>(searchStatementModel, command);
     if (result.Data != null && result.Data.Count() > 0)
     {
         var allMasterBom = this.genericMgr.FindAll<BomMaster>(string.Format("select b from BomMaster as b where b.Code in ('{0}')", string.Join("','", result.Data.Select(d => d.Bom).ToArray())));
         foreach (var bomDetail in result.Data)
         {
             bomDetail.CurrentBom = allMasterBom.Where(a => a.Code == bomDetail.Bom).FirstOrDefault();
             var item = this.itemMgr.GetCacheItem(bomDetail.Item);
             bomDetail.ItemDescription = item.Description;
             bomDetail.ReferenceItemCode = item.ReferenceCode;
             bomDetail.Description = bomDetail.CurrentBom.Description;
             bomDetail.Qty = bomDetail.CurrentBom.Qty;
             bomDetail.MstrUom = bomDetail.CurrentBom.Uom;
             bomDetail.IsActive = bomDetail.CurrentBom.IsActive;
         }
     }
     ExportToXLS<BomDetail>("BomDet.xls", result.Data.ToList());
 }
 public ActionResult _AjaxList_Detail(GridCommand command, BomDetailSearchModel searchModel)
 {
     string replaceFrom = "_AjaxList_Detail";
     string replaceTo = "List_Detail/";
     this.GetCommand(ref command, searchModel, replaceFrom, replaceTo);
     SearchStatementModel searchStatementModel = PrepareBomDetailSearchStatement(command, searchModel);
     var result = GetAjaxPageData<BomDetail>(searchStatementModel, command);
     if (result.Data != null && result.Data.Count() > 0)
     {
         var allMasterBom = this.genericMgr.FindAll<BomMaster>(string.Format("select b from BomMaster as b where b.Code in ('{0}')", string.Join("','", result.Data.Select(d => d.Bom).ToArray())));
         foreach (var bomDetail in result.Data)
         {
             bomDetail.CurrentBom = allMasterBom.Where(a => a.Code == bomDetail.Bom).FirstOrDefault();
             var item = this.itemMgr.GetCacheItem(bomDetail.Item);
             bomDetail.ItemDescription = item.Description;
             bomDetail.ReferenceItemCode = item.ReferenceCode;
             bomDetail.Description = bomDetail.CurrentBom.Description;
             bomDetail.Qty = bomDetail.CurrentBom.Qty;
             bomDetail.MstrUom = bomDetail.CurrentBom.Uom;
             bomDetail.IsActive = bomDetail.CurrentBom.IsActive;
         }
     }
     return PartialView(result);
 }
 public ActionResult List_Detail(GridCommand command, BomDetailSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     if (searchCacheModel.isBack == true)
     {
         ViewBag.Page = searchCacheModel.Command.Page == 0 ? 1 : searchCacheModel.Command.Page;
     }
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return PartialView();
 }