public async Task <FileResult> GetSkuBreakDownReportItemsReportFile([FromQuery] string from, [FromQuery] string to) { var dFrom = from.GetDateFromQueryStringInPst(TimeZoneHelper.PstTimeZoneInfo); var dTo = to.GetDateFromQueryStringInPst(TimeZoneHelper.PstTimeZoneInfo); if (!dFrom.HasValue || !dTo.HasValue) { return(null); } SkuBreakDownReportFilter filter = new SkuBreakDownReportFilter() { From = dFrom.Value, To = dTo.Value.AddDays(1), }; filter.Paging = null; var data = await productService.GetSkuBreakDownReportItemsAsync(filter); var result = _skuBreakDownReportItemCSVExportService.ExportToCsv(data); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.SKU_BREAKDOWN_REPORT, DateTime.Now) }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return(File(result, "text/csv")); }
public async Task<FileResult> GetCustomersForAffiliates([FromQuery]int idaffiliate) { IList<ExtendedVCustomer> items = new List<ExtendedVCustomer>(); if (idaffiliate != 0) { CustomerFilter filter = new CustomerFilter() { IdAffiliate = idaffiliate }; filter.Paging = new Paging() { PageIndex = 1, PageItemCount = 1000000 }; var result = await _customerService.GetCustomersAsync(filter); items = result.Items; } foreach(var item in items) { if (item.FirstOrderPlaced.HasValue) { item.FirstOrderPlaced=TimeZoneInfo.ConvertTime(item.FirstOrderPlaced.Value, TimeZoneInfo.Local, TimeZoneHelper.PstTimeZoneInfo); } } var data = _csvExportCustomersForAffiliatesService.ExportToCsv(items); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.AFFILIATE_CUSTOMERS_REPORT, DateTime.Now.ToString("MM_dd_yyyy_hh_mm_ss")) }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return File(data, "text/csv"); }
public async Task <FileResult> GetInventorySkuUsageReportFile([FromQuery] string from, [FromQuery] string to, [FromQuery] string skuids, [FromQuery] string invskuids) { var dFrom = from.GetDateFromQueryStringInPst(TimeZoneHelper.PstTimeZoneInfo); var dTo = to.GetDateFromQueryStringInPst(TimeZoneHelper.PstTimeZoneInfo); if (!dFrom.HasValue || !dTo.HasValue) { return(null); } InventorySkuUsageReportFilter filter = new InventorySkuUsageReportFilter() { From = dFrom.Value, To = dTo.Value, SkuIds = !string.IsNullOrEmpty(skuids) ? skuids.Split(',').Select(Int32.Parse).ToList() : new List <int>(), InvSkuIds = !string.IsNullOrEmpty(invskuids) ? invskuids.Split(',').Select(Int32.Parse).ToList() : new List <int>(), }; filter.To = filter.To.AddDays(1); var result = await _inventorySkuService.GetInventorySkuUsageReportForExportAsync(filter); var data = _inventorySkuUsageReportItemForExportCSVExportService.ExportToCsv(result); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.INVENTORY_SKUS_REPORT, DateTime.Now) }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return(File(data, "text/csv")); }
public async Task <FileResult> GetServiceCodeRefundItemsReportFile([FromQuery] DateTime?from, [FromQuery] DateTime?to, [FromQuery] int servicecode) { ServiceCodeItemsFilter filter = new ServiceCodeItemsFilter() { From = from, To = to, ServiceCode = servicecode, }; if (filter.To.HasValue) { filter.To = filter.To.Value.AddDays(1); } var result = await _serviceCodeService.GetServiceCodeRefundItemsAsync(filter); var data = _serviceCodeRefundItemCSVExportService.ExportToCsv(result.Items); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.REFUNDS_REPORT, DateTime.Now) }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return(File(data, "text/csv")); }
public async Task <Result <string> > RequestAffiliatesReportFile([FromBody] VAffiliateFilter filter) { filter.Paging = null; var data = await _affiliateService.GetAffiliatesAsync(filter); var result = _affiliateListItemModelСSVExportService.ExportToCsv(data.Items.Select(p => new AffiliateListItemModel(p)).ToList()); var guid = Guid.NewGuid().ToString().ToLower(); _cache.SetItem(String.Format(CacheKeys.ReportFormat, guid), result); return(guid); }
public async Task <FileResult> GetSkuInventoriesInfoReportFile([FromQuery] bool activeOnly = false, [FromQuery] bool withInventories = false) { var result = await _inventorySkuService.GetSkuInventoriesInfoAsync(activeOnly, withInventories); var data = _skuInventoriesInfoItemCSVExportService.ExportToCsv(result); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.SKU_PART_SUMMARY_LIST, DateTime.Now) }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return(File(data, "text/csv")); }
public async Task <FileResult> GetCatalogRequestsReportFile() { var items = await _catalogRequestAddressService.GetCatalogRequestsAsync(); var data = _exportCatalogRequestAddressService.ExportToCsv(items); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.CATALOG_REQUESTS_REPORT, DateTime.Now.ToString("MM_dd_yyyy_hh_mm_ss")), }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return(File(data, "text/csv")); }
public async Task <Result <string> > RequestGiftCertificatesReportFile([FromBody] GCFilter filter) { filter.Paging = null; var data = (await GCService.GetGiftCertificatesAsync(filter)).Items. Select(p => new GCListItemModel(p, LookupHelper.GetGCTypeName(p.GCType))).ToList(); var result = _gCListItemModelExportCSVExportService.ExportToCsv(data); var guid = Guid.NewGuid().ToString().ToLower(); _cache.SetItem(String.Format(CacheKeys.ReportFormat, guid), result); return(guid); }
public async Task <Result <string> > RequestSkuAverageDailySalesBySkuReportFile([FromBody] SkuAverageDailySalesReportFilter filter) { filter.Paging = null; filter.To = filter.To.AddDays(1); filter.Mode = SkuAverageDailySalesReportMode.BySku; var data = await productService.GetSkuAverageDailySalesBySkuReportItemsAsync(filter); var result = _skuAverageDailySalesBySkuReportItemCsvMapCSVExportService.ExportToCsv(data.Items); var guid = Guid.NewGuid().ToString().ToLower(); _cache.SetItem(String.Format(CacheKeys.ReportFormat, guid), result); return(guid); }
public async Task <FileResult> GetGiftCertificatesWithOrderInfoReportFile([FromQuery] string from, [FromQuery] string to, [FromQuery] int?type = null, [FromQuery] int?status = null, [FromQuery] string billinglastname = null, [FromQuery] string shippinglastname = null, [FromQuery] bool notzerobalance = false) { DateTime?dFrom = !string.IsNullOrEmpty(from) ? from.GetDateFromQueryStringInPst(TimeZoneHelper.PstTimeZoneInfo) : null; DateTime?dTo = !string.IsNullOrEmpty(to) ? to.GetDateFromQueryStringInPst(TimeZoneHelper.PstTimeZoneInfo) : null; GCFilter filter = new GCFilter() { From = dFrom, To = dTo?.AddDays(1) ?? dTo, Type = type.HasValue ? (GCType?)type.Value : null, StatusCode = status.HasValue ? (RecordStatusCode?)status.Value : null, BillingAddress = !String.IsNullOrEmpty(billinglastname) ? new CustomerAddressFilter() { LastName = billinglastname }: null, ShippingAddress = !String.IsNullOrEmpty(shippinglastname) ? new CustomerAddressFilter() { LastName = shippinglastname } : null, NotZeroBalance = notzerobalance, }; filter.Paging = null; var data = await GCService.GetGiftCertificatesWithOrderInfoAsync(filter); foreach (var item in data.Items) { item.Created = TimeZoneInfo.ConvertTime(item.Created, TimeZoneInfo.Local, TimeZoneHelper.PstTimeZoneInfo); } var result = _gCWithOrderListItemModelCsvMapCSVExportService.ExportToCsv(data.Items); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.GIFT_CERTIFICATES_REPORT_STATISTIC, DateTime.Now) }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return(File(result, "text/csv")); }
public async Task <FileResult> GetDiscountsReportFile([FromQuery] string validfrom, [FromQuery] string validto, [FromQuery] int?status = null, [FromQuery] string searchtext = null, [FromQuery] int?datestatus = null, [FromQuery] bool searchbyassigned = false, [FromQuery] int?assigned = null, [FromQuery] string path = null, [FromQuery] string sortorder = null) { DateTime?dValidFrom = !string.IsNullOrEmpty(validfrom) ? validfrom.GetDateFromQueryStringInPst(TimeZoneHelper.PstTimeZoneInfo) : null; DateTime?dValidTo = !string.IsNullOrEmpty(validto) ? validto.GetDateFromQueryStringInPst(TimeZoneHelper.PstTimeZoneInfo) : null; DiscountFilter filter = new DiscountFilter() { ValidFrom = dValidFrom, ValidTo = dValidTo, Status = (RecordStatusCode?)status, SearchText = searchtext, DateStatus = (DateStatus?)datestatus, SearchByAssigned = searchbyassigned, Assigned = (CustomerType?)assigned, }; filter.Paging = null; if (!string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(sortorder)) { filter.Sorting = new SortFilter() { Path = path, SortOrder = sortorder == Enum.GetName(typeof(FilterSortOrder), FilterSortOrder.Asc) ? FilterSortOrder.Asc : FilterSortOrder.Desc, }; } var data = await _discountService.GetDiscountsAsync(filter); var result = _discountListItemExportCsvMapСSVExportService.ExportToCsv(data.Items.Select(p => new DiscountListItemModel(p)).ToList()); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.DISCOUNTS_REPORT, DateTime.Now) }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return(File(result, "text/csv")); }
public async Task<FileResult> GetWholesalesReportFile([FromQuery]int? idtradeclass = null, [FromQuery]int? idtier = null, [FromQuery]bool? onlyactive = true) { WholesaleFilter filter = new WholesaleFilter() { IdTradeClass = idtradeclass, IdTier = idtier, OnlyActive = onlyactive ?? true }; filter.Paging = null; var data = await _customerService.GetWholesalesAsync(filter); var result = _csvExportWholesaleListitemService.ExportToCsv(data.Items); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.WHOLESALE_LIST_REPORT, DateTime.Now) }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return File(result, "text/csv"); }
public async Task <FileResult> GetVitalGreenReportFile([FromQuery] string year, [FromQuery] string month) { DateTime utcDate = new DateTime(Int32.Parse(year), Int32.Parse(month), 1); utcDate = TimeZoneInfo.ConvertTime(utcDate, TimeZoneHelper.PstTimeZoneInfo, TimeZoneInfo.Local); var toReturn = await _vitalGreenService.GetVitalGreenReport(utcDate); var requests = new List <VitalGreenRequest>(); foreach (var date in toReturn.Dates) { requests.AddRange(date.Requests); } var data = _csvExportVitalGreenRequestService.ExportToCsv(requests); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.VITAL_GREEN_REPORT_FILE_NAME_FORMAT, month, year), }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return(File(data, "text/csv")); }
public async Task <FileResult> GetProductCategoriesStatisticReportFile([FromQuery] DateTime from, [FromQuery] DateTime to) { var rootItem = await productCategoryService.GetProductCategoriesStatisticAsync( new ProductCategoryStatisticFilter() { From = from, To = to }); List <ProductCategoryStatisticTreeItemModel> items = new List <ProductCategoryStatisticTreeItemModel>(); TransformProductCategoryTreeToList(rootItem, items, 1); items.Remove(rootItem); var data = productCategoryStatisticTreeItemCSVExportService.ExportToCsv(items); var contentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = String.Format(FileConstants.PRODUCT_CATEGORY_STATISTIC, DateTime.Now) }; Response.Headers.Add("Content-Disposition", contentDisposition.ToString()); return(File(data, "text/csv")); }