public ActionResult _AjaxList(GridCommand command, MultiSupplyGroupSearchModel searchModel)
        {
            SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
            var model = GetAjaxPageData<MultiSupplyGroupView>(searchStatementModel, command);
            var list = model.Data.OrderBy(c => c.Supplier).OrderBy(c => c.GroupNo).ToList();

            var lastGroupNo = "";
            var lastSupplier = "";
            foreach (MultiSupplyGroupView view in list)
            {
                if (!string.IsNullOrWhiteSpace(lastGroupNo) && view.GroupNo == lastGroupNo)
                {
                    lastGroupNo = view.GroupNo;
                    view.DisplayGroupNo = string.Empty;
                    view.Description = string.Empty;
                    view.EffecitveSupplier = string.Empty;
                    view.TargetCycleQty = null;
                    view.AccumulateQty = null;

                    if (view.Supplier == lastSupplier)
                    {
                        lastSupplier = view.Supplier;
                        view.Sequence = null;
                        view.Supplier = string.Empty;
                        view.CycleQty = null;
                        view.SpillQty = null;
                        view.Proportion = null;
                        view.IsActive = null;
                    }
                    else
                    {
                        lastSupplier = view.Supplier;
                    }
                }
                else
                {
                    view.DisplayGroupNo = view.GroupNo;
                    lastGroupNo = view.GroupNo;
                    lastSupplier = view.Supplier;
                }
            }

            model.Data = list;
            return PartialView(model);
        }
        public void ExportXLS(MultiSupplyGroupSearchModel searchModel)
        {
            var selectMultiSupplyGroupView = "select v from MultiSupplyGroupView as v where 1=1 ";

            if (searchModel.GroupNo != null)
            {
                selectMultiSupplyGroupView += " and v.GroupNo like '" + searchModel.GroupNo + "%'";
            }
            if (searchModel.Supplier != null)
            {
                selectMultiSupplyGroupView += " and v.Supplier='" + searchModel.Supplier + "'";
            }
            if (searchModel.Item != null)
            {
                selectMultiSupplyGroupView += " and v.Item='" + searchModel.Item + "'";
            }
            if (searchModel.SubstituteGroup != null)
            {
                selectMultiSupplyGroupView += " and v.SubstituteGroup like '" + searchModel.SubstituteGroup + "%'";
            }

            string maxRows = this.systemMgr.GetEntityPreferenceValue(EntityPreference.CodeEnum.ExportMaxRows);
            IList<MultiSupplyGroupView> views = base.genericMgr.FindAll<MultiSupplyGroupView>(selectMultiSupplyGroupView, 0, int.Parse(maxRows));

            ExportToXLS<MultiSupplyGroupView>("MultiSupplyGroup", "XLS", views);
        }
 public ActionResult List(GridCommand command, MultiSupplyGroupSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
        /// <summary>
        /// Search Statement
        /// </summary>
        /// <param name="command">Telerik GridCommand</param>
        /// <param name="searchModel">MultiSupplyGroup Search Model</param>
        /// <returns>return MultiSupplyGroup search model</returns>
        private SearchStatementModel PrepareSearchStatement(GridCommand command, MultiSupplyGroupSearchModel searchModel)
        {
            string whereStatement = string.Empty;

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

            HqlStatementHelper.AddLikeStatement("GroupNo", searchModel.GroupNo, HqlStatementHelper.LikeMatchMode.Start, "msg", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Supplier", searchModel.Supplier, "msg", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Item", searchModel.Item, "msg", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("SubstituteGroup", searchModel.SubstituteGroup, HqlStatementHelper.LikeMatchMode.Start, "msg", ref whereStatement, param);

            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "DisplayGroupNo")
                {
                    command.SortDescriptors[0].Member = "GroupNo";
                }
            }
            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

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

            return searchStatementModel;
        }