public FileResult BonusNoChequeReport( string bonus_from, string bonus_to, string bonus_date, string bonus_type, string bonus_added, string bonus_redeemed, string bonus_burned, string bonus_phone) { try { BonusesNotForPurchasesRequest request = new BonusesNotForPurchasesRequest { Operator = Implementation.JwtProps.GetOperator(), Date = bonus_date, DateStart = bonus_from, DateEnd = bonus_to, Phone = bonus_phone, Page = -1, PageSize = -1 }; if (!string.IsNullOrEmpty(bonus_type)) { request.Name = bonus_type.Substring(1, bonus_type.Length - 2); } if (!string.IsNullOrEmpty(bonus_added)) { var values = bonus_added.Split('-'); try { request.AddedMore = values[0]; } catch { }; try { request.AddedLess = values[1]; } catch { }; } if (!string.IsNullOrEmpty(bonus_redeemed)) { var values = bonus_redeemed.Split('-'); try { request.RedeemedMore = values[0]; } catch { }; try { request.RedeemedLess = values[1]; } catch { }; } if (!string.IsNullOrEmpty(bonus_burned)) { var values = bonus_burned.Split('-'); try { request.BurnMore = values[0]; } catch { }; try { request.BurnLess = values[1]; } catch { }; } ReportResponse response = new ReportResponse(); HttpResponseMessage responseMessage = HttpClientService.PostAsync("api/reports/BonusesNoChequeReport", request).Result; if (responseMessage.IsSuccessStatusCode) { response = responseMessage.Content.ReadAsAsync <ReportResponse>().Result; if (response.ErrorCode != 0 || !string.IsNullOrEmpty(response.Message)) { return(null); } var reportName = "Отчёт по бонусам не за покупки"; if (!string.IsNullOrEmpty(bonus_from)) { reportName = reportName + " с " + bonus_from; } if (!string.IsNullOrEmpty(bonus_to)) { reportName = reportName + " по " + bonus_to; } reportName = reportName + ".xlsx"; return(File(response.Report, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", reportName)); } return(null); } catch { return(null); } }
public FileResult BookkeepingReport( string from, string to, string name, string buys, string added, string redeemed, string clients) { ReportResponse response = new ReportResponse(); BookkeepingRequest request = new BookkeepingRequest(); try { request.Operator = JwtProps.GetOperator(); } catch { } try { request.Partner = JwtProps.GetPartner(); } catch { } try { request.Pos = JwtProps.GetPos(); } catch { } try { if (!string.IsNullOrEmpty(name)) { request.Name = name; } request.DateStart = from; request.DateEnd = to; request.Page = -1; request.PageSize = -1; if (!string.IsNullOrEmpty(buys)) { var values = buys.Split('-'); try { request.PurchasesMore = values[0]; } catch { }; try { request.PurchasesLess = values[1]; } catch { }; } if (!string.IsNullOrEmpty(added)) { var values = added.Split('-'); try { request.AddedMore = values[0]; } catch { }; try { request.AddedLess = values[1]; } catch { }; } if (!string.IsNullOrEmpty(redeemed)) { var values = redeemed.Split('-'); try { request.RedeemedMore = values[0]; } catch { }; try { request.RedeemedLess = values[1]; } catch { }; } if (!string.IsNullOrEmpty(clients)) { var values = clients.Split('-'); try { request.ClientsMore = values[0]; } catch { }; try { request.ClientsLess = values[1]; } catch { }; } HttpResponseMessage responseMessage = HttpClientService.PostAsync("api/reports/BookkeepingReport", request).Result; if (responseMessage.IsSuccessStatusCode) { response = responseMessage.Content.ReadAsAsync <ReportResponse>().Result; if (response.ErrorCode != 0 || !string.IsNullOrEmpty(response.Message)) { return(null); } var reportName = "Отчёт по сверке"; if (!string.IsNullOrEmpty(from)) { reportName = reportName + " с " + from; } if (!string.IsNullOrEmpty(to)) { reportName = reportName + " по " + to; } reportName = reportName + ".xlsx"; return(File(response.Report, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", reportName)); } return(null); } catch { return(null); } }