public ActionResult List(GridCommand command, ProdBomDetForecastChargSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return PartialView();
 }
        private string PrepareSearchStatement(GridCommand command, ProdBomDetForecastChargSearchModel searchModel)
        {

            string groupItemByCHARGNative = PermissionSearch + groupItemByCHARGNative_p1;
            if (searchModel.CHARG != null)
            {
                groupItemByCHARGNative += " WHERE CHARG = '" + searchModel.CHARG + "'";
            }
            groupItemByCHARGNative += groupItemByCHARGNative_p2;
            return groupItemByCHARGNative;
        }
        private List<ProdBomDetForecastChargView> GetChargData(ProdBomDetForecastChargSearchModel searchModel)
        {
            List<ProdBomDetForecastChargView> result = new List<ProdBomDetForecastChargView>();
            if (Session["LES_ProdBomDetForecastCharg" + this.CurrentUser.Code] == null)
            {
                IList<object[]> groupedmatnr = this.genericMgr
                    .FindAllWithNativeSql<object[]>(
                    PermissionSearch +
                    groupItemByCHARGNative_p1 +
                    groupItemByCHARGNative_p2, this.CurrentUser.Code);

                foreach (object[] obj in groupedmatnr)
                {
                    ProdBomDetForecastChargView pb = new ProdBomDetForecastChargView();
                    pb.MATNR = obj[0].ToString();
                    pb.MEINS = (obj[1] ?? string.Empty).ToString();
                    pb.BDMNG = decimal.Parse((obj[2] ?? 0).ToString());
                    pb.BDTER = DateTime.Parse(obj[3].ToString());
                    pb.WERKS = (obj[4] ?? string.Empty).ToString();
                    pb.DESC = (obj[5] ?? string.Empty).ToString();
                    pb.REFCODE = (obj[6] ?? string.Empty).ToString();
                    pb.CHARG = obj[7].ToString();
                    pb.SEQNR = obj[8].ToString();
                    result.Add(pb);
                }
                Session["LES_ProdBomDetForecastCharg"+this.CurrentUser.Code] = result;
            }
            else
            {
                result = (List<ProdBomDetForecastChargView>)Session["LES_ProdBomDetForecastCharg" + this.CurrentUser.Code];
            }
            if (searchModel.CHARG != null)
            {
                return result.Where(pdf => pdf.CHARG == searchModel.CHARG).ToList();
            }
            else
            {
                return result;
            }
        }
        public ActionResult _AjaxListForCHARG(GridCommand command, ProdBomDetForecastChargSearchModel searchModel)
        {
            List<ProdBomDetForecastChargView> result = GetChargData(searchModel);

            GridModel<ProdBomDetForecastChargView> GridModel = new GridModel<ProdBomDetForecastChargView>();
            GridModel.Total = result.Count;
            GridModel.Data = result
                .OrderBy(pf => pf.SEQNR)
                .ThenBy(pf => pf.CHARG)
                .Skip((command.Page - 1) * command.PageSize)
                .Take(command.PageSize).ToList();
            ViewBag.Total = GridModel.Total;

            return PartialView(GridModel);
        }