コード例 #1
0
        public async Task <IActionResult> ExportAdvancePaymentShipment(AdvancePaymentCriteria advancePaymentCriteria)
        {
            var accessToken        = Request.Headers["Authorization"].ToString();
            var advancePaymentsAPI = await HttpServiceExtension.PostAPI(advancePaymentCriteria, aPis.AccountingAPI + Urls.Accounting.AdvancePaymentUrl, accessToken);

            var           advancePayments = advancePaymentsAPI.Content.ReadAsAsync <List <AdvancePaymentModel> >();
            List <string> codes           = new List <string>();

            foreach (var item in advancePayments.Result)
            {
                codes.Add(item.AdvanceNo);
            }
            var responseFromApi = await HttpServiceExtension.PostAPI(codes, aPis.AccountingAPI + Urls.Accounting.GetGroupRequestsByAdvanceNoList, accessToken);

            var dataObjects = responseFromApi.Content.ReadAsAsync <List <AdvancePaymentRequestModel> >();

            var stream = new AccountingHelper().GenerateAdvancePaymentShipmentExcel(dataObjects.Result);

            if (stream == null)
            {
                return(null);
            }
            FileContentResult fileContent = new FileHelper().ExportExcel(stream, "Advance Payment List Shipment.xlsx");

            return(fileContent);
        }
コード例 #2
0
        public async Task <IActionResult> ExportAdvancePayment(AdvancePaymentCriteria advancePaymentCriteria)
        {
            var responseFromApi = await HttpServiceExtension.GetDataFromApi(advancePaymentCriteria, aPis.AccountingAPI + Urls.Accounting.AdvancePaymentUrl);

            var dataObjects = responseFromApi.Content.ReadAsAsync <List <AdvancePaymentModel> >();

            var stream = new AccountingHelper().GenerateAdvancePaymentExcel(dataObjects.Result);

            if (stream == null)
            {
                return(null);
            }
            FileContentResult fileContent = new FileHelper().ExportExcel(stream, "Advance Payment List.xlsx");

            return(fileContent);
        }