public ActionResult _SearchResult(GridCommand command, string item, string supplier, DateTime? dateFrom, DateTime? dateTo) { string sqlStr = PrepareSearchStatement(command, item, supplier, dateFrom, dateTo); IList<object[]> objectList = base.genericMgr.FindAllWithNativeSql<object[]>(sqlStr); var inspectDetailList = (from inp in objectList select new InspectDetail { IpNo = (string)inp[0], ManufactureParty = (string)inp[1], ManufacturePartyName = (string)inp[2], Item = (string)inp[3], ItemDescription = (string)inp[4], ReferenceItemCode = (string)inp[5], UnitCount = (decimal)inp[6], Uom = (string)inp[7], RejectQty = (decimal)inp[8], InspectQty = (decimal)inp[9] }).ToList(); int count = Convert.ToInt32(base.systemMgr.GetEntityPreferenceValue(EntityPreference.CodeEnum.MaxRowSizeOnPage)); if (inspectDetailList.Count > count) { SaveWarningMessage(string.Format("数据超过{0}行,只显示前{0}行", count)); } //return PartialView(inspectDetailList.Take(count)); GridModel<InspectDetail> gridModel = new GridModel<InspectDetail>(); gridModel.Total = count; gridModel.Data = inspectDetailList.Take(count); return PartialView(gridModel); }
public ActionResult Configure(GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) return Content("Access denied"); var tmp = new List<FixedShippingRateModel>(); foreach (var shippingMethod in _shippingService.GetAllShippingMethods()) tmp.Add(new FixedShippingRateModel() { ShippingMethodId = shippingMethod.Id, ShippingMethodName = shippingMethod.Name, Rate = GetShippingRate(shippingMethod.Id) }); var tmp2 = tmp.ForCommand(command); var gridModel = new GridModel<FixedShippingRateModel> { Data = tmp2, Total = tmp2.Count() }; return new JsonResult { Data = gridModel }; }
public ActionResult Categories(GridCommand command) { var model = new GridModel<TaxCategoryModel>(); if (_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings)) { var categoriesModel = _taxCategoryService.GetAllTaxCategories() .Select(x => x.ToModel()) .ForCommand(command) .ToList(); model.Data = categoriesModel; model.Total = categoriesModel.Count; } else { model.Data = Enumerable.Empty<TaxCategoryModel>(); NotifyAccessDenied(); } return new JsonResult { Data = model }; }
public ActionResult Configure(GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings)) return Content("Access denied"); var tmp = new List<FixedTaxRateModel>(); foreach (var taxCategory in _taxCategoryService.GetAllTaxCategories()) tmp.Add(new FixedTaxRateModel() { TaxCategoryId = taxCategory.Id, TaxCategoryName = taxCategory.Name, Rate = GetTaxRate(taxCategory.Id) }); var tmp2 = tmp.ForCommand(command); var gridModel = new GridModel<FixedTaxRateModel> { Data = tmp2, Total = tmp2.Count() }; return new JsonResult { Data = gridModel }; }
public ActionResult List(string id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageEmailAccounts)) return AccessDeniedView(); //mark as default email account (if selected) if (!String.IsNullOrEmpty(id)) { int defaultEmailAccountId = Convert.ToInt32(id); var defaultEmailAccount = _emailAccountService.GetEmailAccountById(defaultEmailAccountId); if (defaultEmailAccount != null) { _emailAccountSettings.DefaultEmailAccountId = defaultEmailAccountId; _settingService.SaveSetting(_emailAccountSettings); } } var emailAccountModels = _emailAccountService.GetAllEmailAccounts() .Select(x => x.ToModel()) .ToList(); foreach (var eam in emailAccountModels) eam.IsDefaultEmailAccount = eam.Id == _emailAccountSettings.DefaultEmailAccountId; var gridModel = new GridModel<EmailAccountModel> { Data = emailAccountModels, Total = emailAccountModels.Count() }; return View(gridModel); }
public ActionResult Weights(string id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMeasures)) return AccessDeniedView(); //mark as primary weight (if selected) if (!String.IsNullOrEmpty(id)) { int primaryWeightId = Convert.ToInt32(id); var primaryWeight = _measureService.GetMeasureWeightById(primaryWeightId); if (primaryWeight != null) { _measureSettings.BaseWeightId = primaryWeightId; _settingService.SaveSetting(_measureSettings); } } var weightsModel = _measureService.GetAllMeasureWeights() .Select(x => x.ToModel()) .ToList(); foreach (var wm in weightsModel) wm.IsPrimaryWeight = wm.Id == _measureSettings.BaseWeightId; var model = new GridModel<MeasureWeightModel> { Data = weightsModel, Total = weightsModel.Count }; return View(model); }
public ActionResult ListAsync() { var clients = _clientRepository.All(); var clientModel = new GridModel(clients); return View(clientModel); }
public ActionResult _AjaxList(GridCommand command, SnapshotFlowDet4LeanEngineSearchModel searchModel) { string selectSql = this.PrepareSearchStatement(command, searchModel); var total = this.genericMgr.FindAllWithNativeSql<int>(string.Format("select count(*) from ({0}) result", selectSql))[0]; string whereStatement = string.Format(" select * from ( {0} ) result where result.RowId between {1} and {2}", selectSql, command.PageSize * (command.Page - 1), command.PageSize * command.Page); //var returnList = this.genericMgr.FindEntityWithNativeSql<SnapshotFlowDet4LeanEngine>(whereStatement); var searchList = this.genericMgr.FindAllWithNativeSql<object[]>(whereStatement); var returnList = (from take in searchList select new SnapshotFlowDet4LeanEngine { Id = (Int64)take[1], Flow = (string)take[2], Item = (string)take[3], LocationFrom = (string)take[4], LocationTo = (string)take[5], OrderNo = (string)take[6], Lvl = Convert.ToInt16((take[7]).ToString()), ErrorId = Convert.ToInt16((take[8]).ToString()), Message = (string)take[9], CreateDate = (DateTime)take[10], BatchNo = (int)take[11], ItemDesc = (string)take[12], ReferenceItemCode = (string)take[13], }).ToList(); GridModel<SnapshotFlowDet4LeanEngine> gridMode = new GridModel<SnapshotFlowDet4LeanEngine>(); gridMode.Total = total; gridMode.Data = returnList; return PartialView(gridMode); //string //SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel); //return PartialView(GetAjaxPageData<SnapshotFlowDet4LeanEngine>(searchStatementModel, command)); }
public ActionResult QueuedEmailList(GridCommand command, QueuedEmailListModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMessageQueue)) return AccessDeniedView(); DateTime? startDateValue = (model.SearchStartDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeHelper.CurrentTimeZone); DateTime? endDateValue = (model.SearchEndDate == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1); var queuedEmails = _queuedEmailService.SearchEmails(model.SearchFromEmail, model.SearchToEmail, startDateValue, endDateValue, model.SearchLoadNotSent, model.SearchMaxSentTries, true, command.Page - 1, command.PageSize, model.SearchSendManually); var gridModel = new GridModel<QueuedEmailModel> { Data = queuedEmails.Select(x => { var m = x.ToModel(); m.CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc); if (x.SentOnUtc.HasValue) m.SentOn = _dateTimeHelper.ConvertToUserTime(x.SentOnUtc.Value, DateTimeKind.Utc); return m; }), Total = queuedEmails.TotalCount }; return new JsonResult { Data = gridModel }; }
public ActionResult Index(GridCommand command, ErrorLogModel model) { if (!PermissionService.Authorize(PermissionProvider.ErrorView)) return AccessDeniedView(); int totalRecords = 0; var query = _unitOfWork.ErrorRepository.GetAsQuerable().OrderByDescending(x => x.CreatedOn); var errorLog = query.ApplyGridCommandsWithPaging(command, out totalRecords); var errorList = errorLog.Select(error => new ErrorLogModel { Id = error.Id, IpAddress = error.IpAddress, PageUrl = error.PageUrl, ShortMessage = error.ShortMessage, FullMessage = error.FullMessage, CreatedOn = error.CreatedOn }).ToList(); var gridModel = new GridModel<ErrorLogModel> { Data = errorList, Total = totalRecords }; return View(gridModel); }
public ActionResult AffiliatedCustomerList(int affiliateId, GridCommand command) { var model = new GridModel<AffiliateModel.AffiliatedCustomerModel>(); if (_permissionService.Authorize(StandardPermissionProvider.ManageAffiliates)) { var affiliate = _affiliateService.GetAffiliateById(affiliateId); var customers = _customerService.GetAllCustomers(affiliate.Id, command.Page - 1, command.PageSize); model.Data = customers.Select(customer => { var customerModel = new AffiliateModel.AffiliatedCustomerModel { Id = customer.Id, Email = customer.Email, Username = customer.Username, FullName = customer.GetFullName() }; return customerModel; }); model.Total = customers.TotalCount; } else { model.Data = Enumerable.Empty<AffiliateModel.AffiliatedCustomerModel>(); NotifyAccessDenied(); } return new JsonResult { Data = model }; }
public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCustomers)) return AccessDeniedView(); var customers = _customerService.GetOnlineCustomers(DateTime.UtcNow.AddMinutes(-_customerSettings.OnlineCustomerMinutes), null, 0, _adminAreaSettings.GridPageSize); var model = new GridModel<OnlineCustomerModel> { Data = customers.Select(x => { return new OnlineCustomerModel() { Id = x.Id, CustomerInfo = x.IsRegistered() ? x.Email : _localizationService.GetResource("Admin.Customers.Guest"), LastIpAddress = x.LastIpAddress, Location = _geoCountryLookup.LookupCountryName(x.LastIpAddress), LastActivityDate = _dateTimeHelper.ConvertToUserTime(x.LastActivityDateUtc, DateTimeKind.Utc), LastVisitedPage = x.GetAttribute<string>(SystemCustomerAttributeNames.LastVisitedPage) }; }), Total = customers.TotalCount }; return View(model); }
public ActionResult CurrentCarts(GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders)) return AccessDeniedView(); var customers = _customerService.GetAllCustomers(null, null, null, null, null, null, null, 0, 0, true, ShoppingCartType.ShoppingCart, command.Page - 1, command.PageSize); var gridModel = new GridModel<ShoppingCartModel> { Data = customers.Select(x => { return new ShoppingCartModel() { CustomerId = x.Id, CustomerName = x.IsGuest() ? "Guest" : x.GetFullName(), TotalItems = x.ShoppingCartItems.Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart).ToList().GetTotalProducts() }; }), Total = customers.TotalCount }; return new JsonResult { Data = gridModel }; }
public ActionResult Providers(string systemName) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings)) return AccessDeniedView(); //mark as active tax provider (if selected) if (!String.IsNullOrEmpty(systemName)) { var taxProvider = _taxService.LoadTaxProviderBySystemName(systemName); if (taxProvider != null) { _taxSettings.ActiveTaxProviderSystemName = systemName; _settingService.SaveSetting(_taxSettings); } } var taxProvidersModel = _taxService.LoadAllTaxProviders() .Select(x => x.ToModel()).ToList(); foreach (var tpm in taxProvidersModel) tpm.IsPrimaryTaxProvider = tpm.SystemName.Equals(_taxSettings.ActiveTaxProviderSystemName, StringComparison.InvariantCultureIgnoreCase); var gridModel = new GridModel<TaxProviderModel> { Data = taxProvidersModel, Total = taxProvidersModel.Count() }; return View(gridModel); }
public ActionResult _AjaxFlowCarrierList(GridCommand command, string id) { GridModel<TransportFlowCarrier> GridModel = new GridModel<TransportFlowCarrier>(); GridModel.Total = (int)this.genericMgr.FindAll<long>("select count(*) from TransportFlowCarrier tf where tf.Flow=?", id)[0]; var result = this.genericMgr.FindAll<TransportFlowCarrier>("from TransportFlowCarrier tf where tf.Flow=? order by Sequence", id); this.FillCodeDetailDescription<TransportFlowCarrier>(result); GridModel.Data = result; return PartialView(GridModel); }
public ActionResult Comments(int? filterByNewsItemId) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews)) return AccessDeniedView(); ViewBag.FilterByNewsItemId = filterByNewsItemId; var model = new GridModel<NewsCommentModel>(); return View(model); }
public ActionResult GetCustomersManualPaging(int page, int size) { var context = new TelerikDemoDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); var result = context.GetCustomersPaged(page, size).ToList(); var gridModel = new GridModel{ Data = result, Total = 91 }; return View(gridModel); }
public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog)) return AccessDeniedView(); var productAttributes = _productAttributeService.GetAllProductAttributes(); var gridModel = new GridModel<ProductAttributeModel> { Data = productAttributes.Select(x => x.ToModel()), Total = productAttributes.Count() }; return View(gridModel); }
public ActionResult _AjaxListMaterial() { string OPName = this.Request.Form["OP"]; string CHARG = this.Request.Form["CHARG"]; List<DocumentaryViewModel> result = new List<DocumentaryViewModel>(); result = CurrentVAN(CurrentStation(OPName, CHARG)); GridModel<DocumentaryViewModel> GridModel = new GridModel<DocumentaryViewModel>(); GridModel.Total = result.Count; GridModel.Data = result .ToList(); return PartialView(GridModel); }
public ActionResult ListTypes() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageActivityLog)) return AccessDeniedView(); var activityLogTypeModel = _customerActivityService.GetAllActivityTypes().Select(x => x.ToModel()); var gridModel = new GridModel<ActivityLogTypeModel> { Data = activityLogTypeModel, Total = activityLogTypeModel.Count() }; return View(gridModel); }
public ActionResult ListTypes(GridCommand command) { var activityLogTypeModel = _customerActivityService.GetAllActivityTypes().Select(x => x.ToModel()); var gridModel = new GridModel<ActivityLogTypeModel> { Data = activityLogTypeModel, Total = activityLogTypeModel.Count() }; return new JsonResult { Data = gridModel }; }
public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageMeasures)) return AccessDeniedView(); var quantityUnitModel = _quantityUnitService.GetAllQuantityUnits().Select(x => x.ToModel()).ToList(); var gridModel = new GridModel<QuantityUnitModel> { Data = quantityUnitModel, Total = quantityUnitModel.Count() }; return View(gridModel); }
public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageDeliveryTimes)) return AccessDeniedView(); var deliveryTimesModel = _deliveryTimeService.GetAllDeliveryTimes().Select(x => x.ToModel()).ToList(); var gridModel = new GridModel<DeliveryTimeModel> { Data = deliveryTimesModel, Total = deliveryTimesModel.Count() }; return View(gridModel); }
public ActionResult Categories() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings)) return AccessDeniedView(); var categoriesModel = _taxCategoryService.GetAllTaxCategories() .Select(x => x.ToModel()) .ToList(); var model = new GridModel<TaxCategoryModel> { Data = categoriesModel, Total = categoriesModel.Count }; return View(model); }
public ActionResult _UpdateFlowCarrier(GridCommand command, TransportFlowCarrier flowCarrier) { var dbFlowCarrier = this.genericMgr.FindById<TransportFlowCarrier>(flowCarrier.Id); dbFlowCarrier.Carrier = flowCarrier.Carrier; dbFlowCarrier.CarrierName = flowCarrier.CarrierName; dbFlowCarrier.TransportMode = flowCarrier.TransportMode; dbFlowCarrier.PriceList = flowCarrier.PriceList; this.genericMgr.Update(dbFlowCarrier); GridModel<TransportFlowCarrier> GridModel = new GridModel<TransportFlowCarrier>(); GridModel.Total = (int)this.genericMgr.FindAll<long>("select count(*) from TransportFlowCarrier tf where tf.Flow=?", dbFlowCarrier.Flow)[0]; var result = this.genericMgr.FindAll<TransportFlowCarrier>("from TransportFlowCarrier tf where tf.Flow=? order by Sequence", dbFlowCarrier.Flow); this.FillCodeDetailDescription<TransportFlowCarrier>(result); GridModel.Data = result; return PartialView(GridModel); }
public JsonResult AjaxIndex(string searchKey) { var data = this.GetStateTrueList(); if (!string.IsNullOrEmpty(searchKey)) { data = data.Where(e => e.Description.Contains(searchKey)); } var dto = data.ToDto(); var model = new GridModel<iPow.Domain.Dto.Sys_RolesDto> { Data = dto, Total = data.Count() }; return new JsonResult { Data = model, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageScheduleTasks)) return AccessDeniedView(); var models = _scheduleTaskService.GetAllTasks(true) .Select(PrepareScheduleTaskModel) .ToList(); var model = new GridModel<ScheduleTaskModel> { Data = models, Total = models.Count }; return View(model); }
public JsonResult AjaxIndex(string searchKey) { var data = this.CurrentUserTourPlan(); if (!string.IsNullOrEmpty(searchKey)) { data = data.Where(e => e.PlanTitle != null && e.PlanTitle.Contains(searchKey)); } var dto = data.ToDto().OrderByDescending(e => e.AddTime); var model = new GridModel<Miaow.Domain.Dto.Sys_TourPlanDto> { Data = dto, Total = dto.Count() }; return new JsonResult { Data = model, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }
public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePromotionFeeds)) return AccessDeniedView(); var feedsModel = new List<PromotionFeedModel>(); var feeds = _promotionFeedService.LoadAllPromotionFeeds(); foreach (var feed in feeds) feedsModel.Add(feed.ToModel()); var gridModel = new GridModel<PromotionFeedModel> { Data = feedsModel, Total = feedsModel.Count() }; return View(gridModel); }
public ActionResult CountryList(GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCountries)) return AccessDeniedView(); var countries = _countryService.GetAllCountries(true); var model = new GridModel<CountryModel> { Data = countries.Select(x => x.ToModel()), Total = countries.Count }; return new JsonResult { Data = model }; }