public virtual ReportStatementSearchModel PrepareReportStatementSearchModel(ReportStatementSearchModel model = null) { if (null == model) { model = new ReportStatementSearchModel(); } baseAdminModelFactory.PrepareLogisticsOrderStatus(model.AvailableOrderStatuses); if (model.AvailableOrderStatuses.Any()) { if (model.OrderStatuses?.Any() ?? false) { var statuses = model.OrderStatuses.Select(x => x.ToString()); model.AvailableOrderStatuses.Where(x => statuses.Contains(x.Value)).ToList() .ForEach(x => x.Selected = true); } else { model.AvailableOrderStatuses.FirstOrDefault().Selected = true; } } baseAdminModelFactory.PrepareLogisticsPaymentStatus(model.AvailablePaymentStatuses); if (model.AvailablePaymentStatuses.Any()) { if (model.PaymentStatuses?.Any() ?? false) { var statuses = model.PaymentStatuses.Select(x => x.ToString()); model.AvailablePaymentStatuses.Where(x => statuses.Contains(x.Value)).ToList() .ForEach(x => x.Selected = true); } else { model.AvailablePaymentStatuses.FirstOrDefault().Selected = true; } } baseAdminModelFactory.PrepareLogisticsShippingStatus(model.AvailableShippingStatuses); if (model.AvailableShippingStatuses.Any()) { if (model.ShippingStatuses?.Any() ?? false) { var statuses = model.ShippingStatuses.Select(x => x.ToString()); model.AvailableShippingStatuses.Where(x => statuses.Contains(x.Value)).ToList() .ForEach(x => x.Selected = true); } else { model.AvailableShippingStatuses.FirstOrDefault().Selected = true; } } return(model); }
public virtual ConsignmentOrderSearchModel PrepareSearchModel(ConsignmentOrderSearchModel searchModel) { if (null == searchModel) { throw new ArgumentNullException(nameof(searchModel)); } baseAdminModelFactory.PrepareShipmentMethods(searchModel.AvailableShipmentMethods); baseAdminModelFactory.PrepareLogisticsOrderStatus(searchModel.AvailableOrderStatuses); baseAdminModelFactory.PrepareLogisticsPaymentStatus(searchModel.AvailablePaymentStatuses); searchModel.SetGridPageSize(); return(searchModel); }