public ActionResult _Update(GridCommand command, RccpPlan rccpPlan, string importTypeTo, string startMonthTo , string endMonthTo, string startWeekTo, string endWeekTo, string itemTo, DateTime? startDate, DateTime? endDate) { RccpPlanSearchModel searchModel = new RccpPlanSearchModel(); searchModel.ImportType = importTypeTo; searchModel.Item = itemTo; searchModel.StartMonth = startMonthTo; searchModel.EndMonth = endMonthTo; searchModel.StartWeek = startWeekTo; searchModel.EndWeek = endWeekTo; searchModel.StartDate = startDate; searchModel.EndDate = endDate; RccpPlan newRccpPlan = genericMgr.FindById<RccpPlan>(rccpPlan.Id); if (rccpPlan.Qty != newRccpPlan.Qty) { newRccpPlan.Qty = rccpPlan.Qty; genericMgr.Update(newRccpPlan); var rccpPlanLog = genericMgr.FindAll<RccpPlanLog> (" from RccpPlanLog where PlanId =? and PlanVersion = ?", new object[] { rccpPlan.Id, rccpPlan.PlanVersion }).First(); rccpPlanLog.Qty = rccpPlan.Qty; rccpPlanLog.UnitQty = 1; this.genericMgr.Update(rccpPlanLog); } SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel); return PartialView(GetAjaxPageData<RccpPlan>(searchStatementModel, command)); }
public ActionResult _AjaxList(GridCommand command, RccpPlanSearchModel searchModel) { SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel); return PartialView(GetAjaxPageData<RccpPlan>(searchStatementModel, command)); }
private SearchStatementModel PrepareSearchStatement(GridCommand command, RccpPlanSearchModel searchModel) { string whereStatement = string.Empty; IList<object> param = new List<object>(); if (searchModel.ImportType == "4") { if (searchModel.StartWeek != null & searchModel.EndWeek != null) { HqlStatementHelper.AddEqStatement("DateType", com.Sconit.CodeMaster.TimeUnit.Day, "r", ref whereStatement, param); HqlStatementHelper.AddBetweenStatement("DateIndex", searchModel.StartDate, searchModel.EndDate, "r", ref whereStatement, param); } } else if (searchModel.ImportType == "5") { if (searchModel.StartWeek != null & searchModel.EndWeek != null) { HqlStatementHelper.AddEqStatement("DateType", com.Sconit.CodeMaster.TimeUnit.Week, "r", ref whereStatement, param); HqlStatementHelper.AddBetweenStatement("DateIndex", searchModel.StartWeek, searchModel.EndWeek, "r", ref whereStatement, param); } } else if (searchModel.ImportType == "6") { if (!string.IsNullOrEmpty(searchModel.StartMonth) && !string.IsNullOrEmpty(searchModel.EndMonth)) { HqlStatementHelper.AddEqStatement("DateType", com.Sconit.CodeMaster.TimeUnit.Month, "r", ref whereStatement, param); HqlStatementHelper.AddBetweenStatement("DateIndex", searchModel.StartMonth, searchModel.EndMonth, "r", ref whereStatement, param); } } HqlStatementHelper.AddEqStatement("Item", searchModel.Item, "r", ref whereStatement, param); string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors); SearchStatementModel searchStatementModel = new SearchStatementModel(); searchStatementModel.SelectCountStatement = selectCountStatement; searchStatementModel.SelectStatement = selectStatement; searchStatementModel.WhereStatement = whereStatement; searchStatementModel.SortingStatement = sortingStatement; searchStatementModel.Parameters = param.ToArray<object>(); return searchStatementModel; }
public ActionResult _GetRccpPlanList(RccpPlanSearchModel searchModel) { ViewBag.PageSize = 20; ViewBag.ImportType = searchModel.ImportType; ViewBag.Item = searchModel.Item; ViewBag.StartMonth = searchModel.StartMonth; ViewBag.EndMonth = searchModel.EndMonth; ViewBag.StartWeek = searchModel.StartWeek; ViewBag.EndWeek = searchModel.EndWeek; ViewBag.StartDate = searchModel.StartDate; ViewBag.EndDate = searchModel.EndDate; return View(); }