public static async Task <ReportListResponse> GetReportsByUsername(string username) { ReportListResponse failedResponse = null; try { var response = await client.GetAsync($"Reports/username/{username}"); var getReportsResponse = await response.Content.ReadAsStringAsync(); var defaultResponseObject = JsonConvert.DeserializeObject <ReportListResponse>(getReportsResponse); if (!response.IsSuccessStatusCode) { failedResponse = new ReportListResponse(); failedResponse.Message = "Error connecting to server"; Debug.WriteLine($"Error connecting to server"); return(failedResponse); } else { return(defaultResponseObject); } } catch (Exception ex) { failedResponse.Message = "Retrieving reports by username operation failed. Exception occured"; Debug.WriteLine($"Reports retrieval error : {ex.Message}"); return(failedResponse); } }
public ReportListResponse GetReportLists(ReportListRequest request) { var response = new ReportListResponse(); if (request.LoadOptions.Contains("Reports")) { if (request.LoadOptions.Contains("B04BCTC")) { response.B04BCTC = ReportListDao.GetReportB04BCTC(request.StoreProdure, request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)); } } return(response); }
public ReportListResponse SetReportLists(ReportListRequest request) { var response = new ReportListResponse(); try { if (request.Action == PersistType.Update) { response.Message = ReportListDao.UpdateReport(request.ReportList); } return(response); } catch (Exception ex) { response.Acknowledge = AcknowledgeType.Failure; response.Message = ex.Message; return(response); } }
/// <summary> /// Gets the report lists. /// </summary> /// <param name="request">The request.</param> /// <returns></returns> public ReportListResponse GetReportLists(ReportListRequest request) { var response = new ReportListResponse(); if (request.LoadOptions.Contains("ReportLists")) { response.ReportLists = ReportListDao.GetReportLists(); } if (request.LoadOptions.Contains("ReportListsByReportGroup")) { response.ReportLists = ReportListDao.GetReportListsByReportGroup(request.ReportGroupId); } if (request.LoadOptions.Contains("ReportList")) { response.ReportList = ReportListDao.GetReportListById(request.ReportListId); } if (request.LoadOptions.Contains("Reports")) { if (request.LoadOptions.Contains("AccountingVoucher")) { response.AccountingVoucher = ReportListDao.GetAccountingVoucher(request.StoreProdure, request.RefIdList, request.RefTypeId).ToList(); } if (request.LoadOptions.Contains("C22H")) { response.C22H = ReportListDao.GetReportC22H(request.StoreProdure, request.RefIdList); } if (request.LoadOptions.Contains("C11H")) { response.C11H = ReportListDao.GetReportC11H(request.StoreProdure, request.RefIdList).ToList(); } if (request.LoadOptions.Contains("A02LDTL")) { response.A02LDTL = ReportListDao.Get02LdtlWithStoreProdure(request.StoreProdure, request.FromDate, request.ToDate).ToList(); } if (request.LoadOptions.Contains("A02LDTLIsRetail")) { response.A02LDTL = ReportListDao.Get02LdtlRetailWithStoreProdure(request.StoreProdure, request.FromDate, request.ToDate, request.WhereClause, request.IsEmployee).ToList(); } if (request.LoadOptions.Contains("S03AH")) { response.S03AH = ReportListDao.GetS03AHWithStoreProdure(request.StoreProdure, request.FromDate, request.ToDate, request.CurrencyCode, request.AmounType).ToList(); } if (request.LoadOptions.Contains("B14Q")) { response.B14Q = ReportListDao.GetB14QWithStoreProdure(request.StoreProdure, request.FromDate, request.ToDate, request.CurrencyCode, request.AccountNumber, request.ListStockId, request.AmounType).ToList(); } if (request.LoadOptions.Contains("GeneralReceiptEstimate")) //Tổng hợp dự toán thu ngân sách nhà nước { response.GeneralReceiptEstimates = ReportListDao.GetGeneralReceiptEstimates(request.YearOfEstimate); } if (request.LoadOptions.Contains("GeneralPaymentEstimate")) //Tổng hợp dự toán chi ngân sách nhà nước { response.GeneralPaymentEstimates = ReportListDao.GetGeneralPaymentEstimates(request.YearOfEstimate); } if (request.LoadOptions.Contains("GeneralEstimate")) //Tổng hợp dự toán thu chi ngân sách nhà nước { response.GeneralEstimates = ReportListDao.GetGeneralEstimates(request.YearOfEstimate); } if (request.LoadOptions.Contains("GeneralPaymentDetailEstimate")) //Tổng hợp dự toán thu chi ngân sách nhà nước { response.GeneralPaymentDetailEstimates = ReportListDao.GetGeneralPaymentDetailEstimates(request.YearOfEstimate); } if (request.LoadOptions.Contains("FixedAssetB03H")) //Báo cáo tăng giảm tài sản cố định { response.FixedAssetB03H = ReportListDao.GetFixedAssetB03H(request.FromDate, request.ToDate, request.CurrencyCode); } if (request.LoadOptions.Contains("FixedAssetC55aHD")) //Báo cáo hao mòn TSCĐ { response.FixedAssetC55aHD = ReportListDao.GetFixedAssetC55aHD(request.FromDate, request.ToDate, request.FixedAssetParameter, request.FaCategoryCode, request.CurrencyCode); } if (request.LoadOptions.Contains("FixedAssetC55aHDAmountType")) //Báo cáo hao mòn TSCĐ quy đổi { response.FixedAssetC55aHD = ReportListDao.GetFixedAssetC55aHDAmountType(request.FromDate, request.ToDate, request.FixedAssetParameter, request.FaCategoryCode, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetFAInventory")) //Báo cáo kiểm kê TSCĐ { response.FixedAssetFAInventory = ReportListDao.GetFixedAssetFAInventory(request.FromDate, request.ToDate, request.CurrencyCode, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetFAInventoryAmountType")) //Báo cáo kiểm kê TSCĐ quy đổi { response.FixedAssetFAInventory = ReportListDao.GetFixedAssetFAInventoryAmountType(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetFAInventoryHouse")) //Báo cáo kê khai nhà cửa đất đai TSCĐ { response.FixedAssetFAInventoryHouse = ReportListDao.GetFixedAssetFAInventoryHouse(request.FromDate, request.ToDate, request.CurrencyCode); } if (request.LoadOptions.Contains("FixedAssetFAInventoryHouseAmountType")) //Báo cáo kê khai nhà cửa theo type { response.FixedAssetFAInventoryHouse = ReportListDao.GetFixedAssetFAInventoryHouseAmountType(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetFAInventoryCar")) //Báo cáo kiểm kê TSCĐ { response.FixedAssetFAInventoryCar = ReportListDao.GetFixedAssetFAInventoryCar(request.FromDate, request.ToDate, request.CurrencyCode); } if (request.LoadOptions.Contains("FixedAssetFAInventoryCarAmountType")) //Báo cáo kiểm kê TSCĐ quy đổi { response.FixedAssetFAInventoryCar = ReportListDao.GetFixedAssetFAInventoryCarAmountType(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetFAInventory3000")) //Báo cáo kiểm kê TSCĐ nguyên giá trên 3000 { response.FixedAssetFAInventory = ReportListDao.GetFixedAssetFAInventory3000(request.FromDate, request.ToDate, request.CurrencyCode); } if (request.LoadOptions.Contains("FixedAssetFAInventoryAmountType3000")) //Báo cáo kiểm kê TSCĐ quy đổi có nguyên giá trên 3000 { response.FixedAssetFAInventory = ReportListDao.GetFixedAssetFAInventoryAmountType3000(request.FromDate, request.ToDate); } if (request.LoadOptions.Contains("FixedAssetS31H")) //Báo cáo tăng giảm tài sản cố định { response.FixedAssetS31H = ReportListDao.GetFixedAssetS31H(request.FromDate, request.ToDate, request.FixedAssetParameter, request.FaCategoryCode, request.CurrencyCode); } if (request.LoadOptions.Contains("FixedAssetB02")) //Báo cáo tăng giảm tài sản cố định { response.FixedAssetB02 = ReportListDao.GetFixedAssetB02(request.FromDate, request.ToDate, request.CurrencyCode); } if (request.LoadOptions.Contains("FixedAssetB02AmountType")) //Báo cáo tăng giảm tài sản cố định { response.FixedAssetB02 = ReportListDao.GetFixedAssetB02ByAmountType(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetB01")) //Báo cáo tăng giảm tài sản cố định { response.FixedAssetB01 = ReportListDao.GetFixedAssetB01(request.FromDate, request.ToDate, request.CurrencyCode); } if (request.LoadOptions.Contains("FixedAssetB01AmountType")) //Báo cáo giảm tài sản cố định { response.FixedAssetB01 = ReportListDao.GetFixedAssetB01AmountType(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetB03HAmountType")) //Báo cáo tăng giảm tài sản cố định { response.FixedAssetB03H = ReportListDao.GetFixedAssetB03HAmountType(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetB03H30K")) //Báo cáo tăng giảm tài sản nhà nước { response.FixedAssetB03H30K = ReportListDao.GetFixedAssetB03H30K(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAsset30KPart2")) //Báo cáo kiểm kê tscđ trên 30k USD mẫu mới { response.FixedAsset30KPart2 = ReportListDao.GetFixedAsset30KPart2(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetFAB01Car")) //Báo cáo giảm ô tô { response.FixedAssetFAInventoryCar = ReportListDao.GetFixedAssetFAB01Car(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetFAB01House")) //Báo cáo giảm nhà cửa trụ sở làm việc { response.FixedAssetFAInventoryHouse = ReportListDao.GetFixedAssetFAB01House(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("FixedAssetFAB0130KPart2")) // Báo cáo giảm tscđ có nguyên giá trên 30k { response.FixedAsset30KPart2 = ReportListDao.GetFixedAssetFAB0130KPart2(request.FromDate, request.ToDate, request.CurrencyDecimalDigits); } //if (request.LoadOptions.Contains("FixedAssetCard")) // Báo cáo thẻ TSCĐ // response.FixedAssetCards = ReportListDao.GetFixedAssetCard(request.StrFixedAssetId, request.CurrencyDecimalDigits); if (request.LoadOptions.Contains("FixedAssetCards")) // Báo cáo thẻ TSCĐ { response.FixedAssetCard = ReportListDao.GetFixedAssetCards(request.StrFixedAssetId, request.CurrencyDecimalDigits); } if (request.LoadOptions.Contains("B01H")) //Báo cáo cân đối tài khoản { response.B01H = ReportListDao.GetB01HWithStoreProdure(request.StoreProdure, request.FromDate, request.ToDate, request.CurrencyCode, request.AmounType).ToList(); } if (request.LoadOptions.Contains("B01BCTC")) //Báo cáo tình hình tài chính { response.B01BCTC = ReportListDao.GetB01BCTC(request.StoreProdure, request.FromDate, request.ToDate, request.CurrencyCode, request.AmounType).ToList(); } if (request.LoadOptions.Contains("B03bBCTC")) //Báo cáo lưu chuyển tiền tệ { response.B03bBCTC = ReportListDao.GetB03bBCTC(request.StoreProdure, request.FromDate, request.ToDate, request.CurrencyCode, request.AmounType).ToList(); } if (request.LoadOptions.Contains("CashReportS11H")) //Báo cáo sổ chi tiền mặt/tiền gửi { response.CashReportList = ReportListDao.CashRepportListGeneal(request.StoreProdure, request.FromDate, request.ToDate, request.AccountNumber, request.CurrencyCode, request.AmounType, request.IsBank, request.BankId).ToList(); } if (request.LoadOptions.Contains("CashReportS11AH")) //Báo cáo sổ chi tiền mặt/tiền gửi { response.CashReportList = ReportListDao.CashRepportListDetail(request.StoreProdure, request.FromDate, request.ToDate, request.AccountNumber, request.CorrespondingAccountNumber, request.CurrencyCode, request.AmounType, request.IsBank, request.BankId).ToList(); } if (request.LoadOptions.Contains("CashReportS12H")) //Báo cáo sổ chi tiền mặt/tiền gửi { response.CashReportList = ReportListDao.CashRepportListGeneal(request.StoreProdure, request.FromDate, request.ToDate, request.AccountNumber, request.CurrencyCode, request.AmounType, request.IsBank, request.BankId).ToList(); } if (request.LoadOptions.Contains("CashReportS12AH")) //Báo cáo sổ chi tiền mặt/tiền gửi { response.CashReportList = ReportListDao.CashRepportListDetail(request.StoreProdure, request.FromDate, request.ToDate, request.AccountNumber, request.CorrespondingAccountNumber, request.CurrencyCode, request.AmounType, request.IsBank, request.BankId).ToList(); } if (request.LoadOptions.Contains("S03BH")) //Báo cáo sổ cái tài khoản { response.S03BHList = ReportListDao.GetS03BHWithStoreProdure(request.StoreProdure, request.FromDate, request.ToDate, request.AccountNumber, request.CorrespondingAccountNumber, request.CurrencyCode, request.AmounType).ToList(); } if (request.LoadOptions.Contains("C30BB")) //Báo cáo sổ chi tiền mặt/tiền gửi { response.C30BBList = ReportListDao.GetReportC30BB(request.Year, request.RefTypeId).ToList(); } if (request.LoadOptions.Contains("C30BBItem")) //Báo cáo sổ chi tiền mặt/tiền gửi { response.C30BBList = ReportListDao.GetReportC30BBItem(request.Year, request.RefTypeId).ToList(); } if (request.LoadOptions.Contains("C30BB501")) //Báo cáo sổ chi tiền mặt/tiền gửi { response.C30BB501List = ReportListDao.GetReportC30BB501(request.StoreProdure, request.RefIdList).ToList(); } //C30BBItem if (request.LoadOptions.Contains("S33H")) //Báo cáo sổ chi tiết tài khoản { response.S33H = ReportListDao.GetS33HWithStoreProdure(request.StoreProdure, request.AccountNumber, request.FromDate, request.ToDate, request.CurrencyCode, request.BudgetGroupCode, request.FixedAssetCode, request.DepartmentCode, request.AmounType, request.WhereClause, request.SelectedField, request.SelectedAllValueField).ToList(); } if (request.LoadOptions.Contains("S05H")) { response.S05H = ReportListDao.GetS05HWithStoreProdure(request.StoreProdure, request.FromDate, request.ToDate, request.CurrencyCode, request.AmounType).ToList(); } if (request.LoadOptions.Contains("AdvancePayment")) { response.AdvancePayment = ReportListDao.GetAdvancePaymentHWithStoreProdure(request.StoreProdure, request.FromDate, request.ToDate, request.CurrencyCode, request.AmounType, request.Year).ToList(); //AnhNT: request.Year = accountType } if (request.LoadOptions.Contains("B03BNG")) //Báo cáo tạm ứng { response.B03BNGs = ReportListDao.GetReportB03BNGs((short)request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)).ToList(); } if (request.LoadOptions.Contains("F03BNG")) //Báo cáo Quyết toán nguồn kinh phí TT146 { response.F03BNGs = ReportListDao.GetReportF03BNGs(request.StoreProdure, (short)request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)).ToList(); } if (request.LoadOptions.Contains("F331BNG")) //Báo cáo Quyết toán nguồn kinh phí Quỹ tạm giữ { response.F331BNGs = ReportListDao.GetReportF331BNGs(request.StoreProdure, (short)request.AmounType, request.AccountNumber, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)).ToList(); } if (request.LoadOptions.Contains("B09BNG")) //Báo cáo thu, chi quỹ tạm giữ nsnn từ nguồn 70% số thu phí, lệ phí lãnh sự { if (DateTime.Parse(request.ToDate).Month > 0 && DateTime.Parse(request.ToDate).Month <= 3) { response.B09BNGs = ReportListDao.GetReportB09BNGs(request.StoreProdure, (short)request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)).Where(x => x.QuarterB09 == 1).ToList(); } if (DateTime.Parse(request.ToDate).Month > 3 && DateTime.Parse(request.ToDate).Month <= 6) { response.B09BNGs = ReportListDao.GetReportB09BNGs(request.StoreProdure, (short)request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)).Where(x => x.QuarterB09 == 2).ToList(); } if (DateTime.Parse(request.ToDate).Month > 6 && DateTime.Parse(request.ToDate).Month <= 9) { response.B09BNGs = ReportListDao.GetReportB09BNGs(request.StoreProdure, (short)request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)).Where(x => x.QuarterB09 == 3).ToList(); } if (DateTime.Parse(request.ToDate).Month > 9 && DateTime.Parse(request.ToDate).Month <= 12) { response.B09BNGs = ReportListDao.GetReportB09BNGs(request.StoreProdure, (short)request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)).Where(x => x.QuarterB09 == 4).ToList(); } } if (request.LoadOptions.Contains("FinacialB01BCQT")) { response.FinacialB01BCQTs = ReportListDao.GetReportB01BCQTs(request.StoreProdure, (short)request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)); } if (request.LoadOptions.Contains("EstimateDetailStatement")) //thuyết mih dự toán { if (request.IsCompanyProfile) { response.EstimateDetailStatement = new EstimateDetailStatementEntity { Employees = ReportListDao.GetEmployeeForEstimateReport(true), EmployeeOthers = EmployeeLeasingDao.GetEmployeeLeasingsForEstimateReport(false, true, true), EmployeeLeasings = EmployeeLeasingDao.GetEmployeeLeasingsForEstimateReport(true, true, true), FixedAssets = ReportListDao.GetFixedAssetForEstimateReport(), Buildings = BuildingDao.GetBuildingsForEstimateReport(true), EstimateDetailStatementPartBs = EstimateDetailStatementPartBDao.GetEstimateDetailStatementPartBs(), Mutuals = MutualDao.GetMutualsForEstimate(true), FixedAssetCars = FixedAssetDao.GetFixedAssetsByFixedAssetTMDT(request.YearOfEstimate) }; } else { response.EstimateDetailStatement = new EstimateDetailStatementEntity { Employees = ReportListDao.GetEmployeeForEstimateReport(false), EmployeeOthers = EmployeeLeasingDao.GetEmployeeLeasingsForEstimateReport(false, true, false), EmployeeLeasings = EmployeeLeasingDao.GetEmployeeLeasingsForEstimateReport(true, true, false), FixedAssets = ReportListDao.GetFixedAssetForEstimateReport(), Buildings = BuildingDao.GetBuildingsForEstimateReport(false), EstimateDetailStatementFixedAssets = EstimateDetailStatementFixedAssetDao.GetEstimateDetailStatementFixedAssets(), EstimateDetailStatementPartBs = EstimateDetailStatementPartBDao.GetEstimateDetailStatementPartBs(), Mutuals = MutualDao.GetMutualsForEstimate(true), FixedAssetCars = FixedAssetDao.GetFixedAssetsByFixedAssetTMDT(request.YearOfEstimate) }; } } if (request.LoadOptions.Contains("FundStuation")) //báo cáo tổng hợp tình hình kinh phí { response.FundStuations = ReportListDao.GetFundStuations(request.YearOfEstimate); } if (request.LoadOptions.Contains("F03BCT")) { var lastYear = new DateTime(DateTime.Parse(request.FromDate).Year - 1, 12, 31); var periodDate = new DateTime(DateTime.Parse(request.FromDate).Year, 01, 01); response.ReportF03BCT = ReportListDao.GetReportF03BCTs(request.StoreProdure, (short)request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate), lastYear, periodDate, 0); } if (request.LoadOptions.Contains("B01CII")) { int year = DateTime.Parse(request.FromDate).Year; response.ReportB01CII = ReportListDao.GetReportB01CIIs(request.StoreProdure, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate), year); } if (request.LoadOptions.Contains("B01CII01")) { int year = DateTime.Parse(request.FromDate).Year; response.ReportB01CII01 = ReportListDao.GetReportB01CII01s(request.StoreProdure, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate), year); } if (request.LoadOptions.Contains("B01CI")) { response.ReportB01CI = ReportListDao.GetReportB01CIs(request.StoreProdure, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)); } if (request.LoadOptions.Contains("S104H")) { response.ReportS104H = ReportListDao.GetReportS104Hs(request.StoreProdure, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate), request.CurrencyCode, request.AmounType); } if (request.LoadOptions.Contains("S26H")) { response.FixedAssetS26H = ReportListDao.GetFixedAssetS26H(request.StoreProdure, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate), request.CurrencyCode, request.AmounType, request.DepartmentCode, Convert.ToInt32(request.WhereClause), request.Option); } if (request.LoadOptions.Contains("S24H")) { response.FixedAssetS24H = ReportListDao.GetFixedAssetS24H(request.StoreProdure, request.CurrencyCode, request.AmounType, request.FromDate, request.ToDate, request.DepartmentCode, request.FaCategoryCode, request.StrFixedAssetId); } if (request.LoadOptions.Contains("ReportActivityB02")) { response.ReportActivityB02 = ReportListDao.GetReportActivityB02(request.StoreProdure, request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)); } if (request.LoadOptions.Contains("B04BCTC")) { response.B04BCTC = ReportListDao.GetReportB04BCTC(request.StoreProdure, request.AmounType, request.CurrencyCode, DateTime.Parse(request.FromDate), DateTime.Parse(request.ToDate)); } if (request.LoadOptions.Contains("LedgerAccountingS104H")) { response.LedgerAccountingS104H = ReportListDao.LedgerAccountingS104H(request.StoreProdure, request.FromDate, request.ToDate, request.WhereClause, request.CurrencyCode, request.AmounType); } } return(response); }
/// <summary> /// Lists report records. /// </summary> /// <param name='resourceGroupName'> /// Required. The name of the resource group. /// </param> /// <param name='serviceName'> /// Required. The name of the Api Management service. /// </param> /// <param name='aggregation'> /// Required. Report aggregation. /// </param> /// <param name='query'> /// Optional. /// </param> /// <param name='interval'> /// Optional. By time interval. This value is only applicable to ByTime /// aggregation. Interval must be multiple of 15 minutes and may not /// be zero. The value should be in ISO 8601 format /// (http://en.wikipedia.org/wiki/ISO_8601#Durations).This code can be /// used to convert TimSpan to a valid interval string: /// XmlConvert.ToString(new TimeSpan(hours, minutes, secconds)) /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// List Report records operation response details. /// </returns> public async Task <ReportListResponse> ListAsync(string resourceGroupName, string serviceName, ReportsAggregation aggregation, QueryParameters query, string interval, CancellationToken cancellationToken) { // Validate if (resourceGroupName == null) { throw new ArgumentNullException("resourceGroupName"); } if (serviceName == null) { throw new ArgumentNullException("serviceName"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("aggregation", aggregation); tracingParameters.Add("query", query); tracingParameters.Add("interval", interval); TracingAdapter.Enter(invocationId, this, "ListAsync", tracingParameters); } // Construct URL string url = ""; url = url + "/subscriptions/"; if (this.Client.Credentials.SubscriptionId != null) { url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId); } url = url + "/resourceGroups/"; url = url + Uri.EscapeDataString(resourceGroupName); url = url + "/providers/"; url = url + "Microsoft.ApiManagement"; url = url + "/service/"; url = url + Uri.EscapeDataString(serviceName); url = url + "/reports/"; url = url + Uri.EscapeDataString(ApiManagementClient.ReportsAggregationToString(aggregation)); List <string> queryParameters = new List <string>(); queryParameters.Add("api-version=2016-10-10"); List <string> odataFilter = new List <string>(); if (query != null && query.Filter != null) { odataFilter.Add(Uri.EscapeDataString(query.Filter)); } if (odataFilter.Count > 0) { queryParameters.Add("$filter=" + string.Join(null, odataFilter)); } if (query != null && query.Top != null) { queryParameters.Add("$top=" + Uri.EscapeDataString(query.Top.Value.ToString())); } if (query != null && query.Skip != null) { queryParameters.Add("$skip=" + Uri.EscapeDataString(query.Skip.Value.ToString())); } if (interval != null) { queryParameters.Add("interval=" + Uri.EscapeDataString(interval)); } if (queryParameters.Count > 0) { url = url + "?" + string.Join("&", queryParameters); } string baseUrl = this.Client.BaseUri.AbsoluteUri; // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl[baseUrl.Length - 1] == '/') { baseUrl = baseUrl.Substring(0, baseUrl.Length - 1); } if (url[0] == '/') { url = url.Substring(1); } url = baseUrl + "/" + url; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result ReportListResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new ReportListResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { ReportPaged resultInstance = new ReportPaged(); result.Result = resultInstance; JToken valueArray = responseDoc["value"]; if (valueArray != null && valueArray.Type != JTokenType.Null) { foreach (JToken valueValue in ((JArray)valueArray)) { ReportRecordContract reportRecordContractInstance = new ReportRecordContract(); resultInstance.Values.Add(reportRecordContractInstance); JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); reportRecordContractInstance.Name = nameInstance; } JToken timestampValue = valueValue["timestamp"]; if (timestampValue != null && timestampValue.Type != JTokenType.Null) { DateTime timestampInstance = ((DateTime)timestampValue); reportRecordContractInstance.Timestamp = timestampInstance; } JToken intervalValue = valueValue["interval"]; if (intervalValue != null && intervalValue.Type != JTokenType.Null) { TimeSpan intervalInstance = TimeSpan.Parse(((string)intervalValue), CultureInfo.InvariantCulture); reportRecordContractInstance.Interval = intervalInstance; } JToken countryValue = valueValue["country"]; if (countryValue != null && countryValue.Type != JTokenType.Null) { string countryInstance = ((string)countryValue); reportRecordContractInstance.Country = countryInstance; } JToken regionValue = valueValue["region"]; if (regionValue != null && regionValue.Type != JTokenType.Null) { string regionInstance = ((string)regionValue); reportRecordContractInstance.Region = regionInstance; } JToken zipValue = valueValue["zip"]; if (zipValue != null && zipValue.Type != JTokenType.Null) { string zipInstance = ((string)zipValue); reportRecordContractInstance.Zip = zipInstance; } JToken userIdValue = valueValue["userId"]; if (userIdValue != null && userIdValue.Type != JTokenType.Null) { string userIdInstance = ((string)userIdValue); reportRecordContractInstance.UserIdPath = userIdInstance; } JToken productIdValue = valueValue["productId"]; if (productIdValue != null && productIdValue.Type != JTokenType.Null) { string productIdInstance = ((string)productIdValue); reportRecordContractInstance.ProductIdPath = productIdInstance; } JToken apiIdValue = valueValue["apiId"]; if (apiIdValue != null && apiIdValue.Type != JTokenType.Null) { string apiIdInstance = ((string)apiIdValue); reportRecordContractInstance.ApiIdPath = apiIdInstance; } JToken operationIdValue = valueValue["operationId"]; if (operationIdValue != null && operationIdValue.Type != JTokenType.Null) { string operationIdInstance = ((string)operationIdValue); reportRecordContractInstance.OperationIdPath = operationIdInstance; } JToken apiRegionValue = valueValue["apiRegion"]; if (apiRegionValue != null && apiRegionValue.Type != JTokenType.Null) { string apiRegionInstance = ((string)apiRegionValue); reportRecordContractInstance.ApiRegion = apiRegionInstance; } JToken subscriptionIdValue = valueValue["subscriptionId"]; if (subscriptionIdValue != null && subscriptionIdValue.Type != JTokenType.Null) { string subscriptionIdInstance = ((string)subscriptionIdValue); reportRecordContractInstance.SubscriptionIdPath = subscriptionIdInstance; } JToken callCountSuccessValue = valueValue["callCountSuccess"]; if (callCountSuccessValue != null && callCountSuccessValue.Type != JTokenType.Null) { int callCountSuccessInstance = ((int)callCountSuccessValue); reportRecordContractInstance.CallCountSuccess = callCountSuccessInstance; } JToken callCountBlockedValue = valueValue["callCountBlocked"]; if (callCountBlockedValue != null && callCountBlockedValue.Type != JTokenType.Null) { int callCountBlockedInstance = ((int)callCountBlockedValue); reportRecordContractInstance.CallCountBlocked = callCountBlockedInstance; } JToken callCountFailedValue = valueValue["callCountFailed"]; if (callCountFailedValue != null && callCountFailedValue.Type != JTokenType.Null) { int callCountFailedInstance = ((int)callCountFailedValue); reportRecordContractInstance.CallCountFailed = callCountFailedInstance; } JToken callCountOtherValue = valueValue["callCountOther"]; if (callCountOtherValue != null && callCountOtherValue.Type != JTokenType.Null) { int callCountOtherInstance = ((int)callCountOtherValue); reportRecordContractInstance.CallCountOther = callCountOtherInstance; } JToken callCountTotalValue = valueValue["callCountTotal"]; if (callCountTotalValue != null && callCountTotalValue.Type != JTokenType.Null) { int callCountTotalInstance = ((int)callCountTotalValue); reportRecordContractInstance.CallCountTotal = callCountTotalInstance; } JToken bandwidthValue = valueValue["bandwidth"]; if (bandwidthValue != null && bandwidthValue.Type != JTokenType.Null) { long bandwidthInstance = ((long)bandwidthValue); reportRecordContractInstance.Bandwidth = bandwidthInstance; } JToken cacheHitCountValue = valueValue["cacheHitCount"]; if (cacheHitCountValue != null && cacheHitCountValue.Type != JTokenType.Null) { int cacheHitCountInstance = ((int)cacheHitCountValue); reportRecordContractInstance.CacheHitCount = cacheHitCountInstance; } JToken cacheMissCountValue = valueValue["cacheMissCount"]; if (cacheMissCountValue != null && cacheMissCountValue.Type != JTokenType.Null) { int cacheMissCountInstance = ((int)cacheMissCountValue); reportRecordContractInstance.CacheMissCount = cacheMissCountInstance; } JToken apiTimeAvgValue = valueValue["apiTimeAvg"]; if (apiTimeAvgValue != null && apiTimeAvgValue.Type != JTokenType.Null) { double apiTimeAvgInstance = ((double)apiTimeAvgValue); reportRecordContractInstance.ApiTimeAvg = apiTimeAvgInstance; } JToken apiTimeMinValue = valueValue["apiTimeMin"]; if (apiTimeMinValue != null && apiTimeMinValue.Type != JTokenType.Null) { double apiTimeMinInstance = ((double)apiTimeMinValue); reportRecordContractInstance.ApiTimeMin = apiTimeMinInstance; } JToken apiTimeMaxValue = valueValue["apiTimeMax"]; if (apiTimeMaxValue != null && apiTimeMaxValue.Type != JTokenType.Null) { double apiTimeMaxInstance = ((double)apiTimeMaxValue); reportRecordContractInstance.ApiTimeMax = apiTimeMaxInstance; } JToken serviceTimeAvgValue = valueValue["serviceTimeAvg"]; if (serviceTimeAvgValue != null && serviceTimeAvgValue.Type != JTokenType.Null) { double serviceTimeAvgInstance = ((double)serviceTimeAvgValue); reportRecordContractInstance.ServiceTimeAvg = serviceTimeAvgInstance; } JToken serviceTimeMinValue = valueValue["serviceTimeMin"]; if (serviceTimeMinValue != null && serviceTimeMinValue.Type != JTokenType.Null) { double serviceTimeMinInstance = ((double)serviceTimeMinValue); reportRecordContractInstance.ServiceTimeMin = serviceTimeMinInstance; } JToken serviceTimeMaxValue = valueValue["serviceTimeMax"]; if (serviceTimeMaxValue != null && serviceTimeMaxValue.Type != JTokenType.Null) { double serviceTimeMaxInstance = ((double)serviceTimeMaxValue); reportRecordContractInstance.ServiceTimeMax = serviceTimeMaxInstance; } } } JToken countValue = responseDoc["count"]; if (countValue != null && countValue.Type != JTokenType.Null) { long countInstance = ((long)countValue); resultInstance.TotalCount = countInstance; } JToken nextLinkValue = responseDoc["nextLink"]; if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) { string nextLinkInstance = ((string)nextLinkValue); resultInstance.NextLink = nextLinkInstance; } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return(result); } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } }
/// <summary> /// List report records. /// </summary> /// <param name='nextLink'> /// Required. NextLink from the previous successful call to List /// operation. /// </param> /// <param name='cancellationToken'> /// Cancellation token. /// </param> /// <returns> /// List Report records operation response details. /// </returns> public async Task <ReportListResponse> ListNextAsync(string nextLink, CancellationToken cancellationToken) { // Validate if (nextLink == null) { throw new ArgumentNullException("nextLink"); } // Tracing bool shouldTrace = TracingAdapter.IsEnabled; string invocationId = null; if (shouldTrace) { invocationId = TracingAdapter.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("nextLink", nextLink); TracingAdapter.Enter(invocationId, this, "ListNextAsync", tracingParameters); } // Construct URL string url = ""; url = url + nextLink; url = url.Replace(" ", "%20"); // Create HTTP transport objects HttpRequestMessage httpRequest = null; try { httpRequest = new HttpRequestMessage(); httpRequest.Method = HttpMethod.Get; httpRequest.RequestUri = new Uri(url); // Set Headers // Set Credentials cancellationToken.ThrowIfCancellationRequested(); await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false); // Send Request HttpResponseMessage httpResponse = null; try { if (shouldTrace) { TracingAdapter.SendRequest(invocationId, httpRequest); } cancellationToken.ThrowIfCancellationRequested(); httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false); if (shouldTrace) { TracingAdapter.ReceiveResponse(invocationId, httpResponse); } HttpStatusCode statusCode = httpResponse.StatusCode; if (statusCode != HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false)); if (shouldTrace) { TracingAdapter.Error(invocationId, ex); } throw ex; } // Create Result ReportListResponse result = null; // Deserialize Response if (statusCode == HttpStatusCode.OK) { cancellationToken.ThrowIfCancellationRequested(); string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); result = new ReportListResponse(); JToken responseDoc = null; if (string.IsNullOrEmpty(responseContent) == false) { responseDoc = JToken.Parse(responseContent); } if (responseDoc != null && responseDoc.Type != JTokenType.Null) { ReportPaged resultInstance = new ReportPaged(); result.Result = resultInstance; JToken valueArray = responseDoc["value"]; if (valueArray != null && valueArray.Type != JTokenType.Null) { foreach (JToken valueValue in ((JArray)valueArray)) { ReportRecordContract reportRecordContractInstance = new ReportRecordContract(); resultInstance.Values.Add(reportRecordContractInstance); JToken nameValue = valueValue["name"]; if (nameValue != null && nameValue.Type != JTokenType.Null) { string nameInstance = ((string)nameValue); reportRecordContractInstance.Name = nameInstance; } JToken timestampValue = valueValue["timestamp"]; if (timestampValue != null && timestampValue.Type != JTokenType.Null) { DateTime timestampInstance = ((DateTime)timestampValue); reportRecordContractInstance.Timestamp = timestampInstance; } JToken intervalValue = valueValue["interval"]; if (intervalValue != null && intervalValue.Type != JTokenType.Null) { TimeSpan intervalInstance = TimeSpan.Parse(((string)intervalValue), CultureInfo.InvariantCulture); reportRecordContractInstance.Interval = intervalInstance; } JToken countryValue = valueValue["country"]; if (countryValue != null && countryValue.Type != JTokenType.Null) { string countryInstance = ((string)countryValue); reportRecordContractInstance.Country = countryInstance; } JToken regionValue = valueValue["region"]; if (regionValue != null && regionValue.Type != JTokenType.Null) { string regionInstance = ((string)regionValue); reportRecordContractInstance.Region = regionInstance; } JToken zipValue = valueValue["zip"]; if (zipValue != null && zipValue.Type != JTokenType.Null) { string zipInstance = ((string)zipValue); reportRecordContractInstance.Zip = zipInstance; } JToken userIdValue = valueValue["userId"]; if (userIdValue != null && userIdValue.Type != JTokenType.Null) { string userIdInstance = ((string)userIdValue); reportRecordContractInstance.UserIdPath = userIdInstance; } JToken productIdValue = valueValue["productId"]; if (productIdValue != null && productIdValue.Type != JTokenType.Null) { string productIdInstance = ((string)productIdValue); reportRecordContractInstance.ProductIdPath = productIdInstance; } JToken apiIdValue = valueValue["apiId"]; if (apiIdValue != null && apiIdValue.Type != JTokenType.Null) { string apiIdInstance = ((string)apiIdValue); reportRecordContractInstance.ApiIdPath = apiIdInstance; } JToken operationIdValue = valueValue["operationId"]; if (operationIdValue != null && operationIdValue.Type != JTokenType.Null) { string operationIdInstance = ((string)operationIdValue); reportRecordContractInstance.OperationIdPath = operationIdInstance; } JToken apiRegionValue = valueValue["apiRegion"]; if (apiRegionValue != null && apiRegionValue.Type != JTokenType.Null) { string apiRegionInstance = ((string)apiRegionValue); reportRecordContractInstance.ApiRegion = apiRegionInstance; } JToken subscriptionIdValue = valueValue["subscriptionId"]; if (subscriptionIdValue != null && subscriptionIdValue.Type != JTokenType.Null) { string subscriptionIdInstance = ((string)subscriptionIdValue); reportRecordContractInstance.SubscriptionIdPath = subscriptionIdInstance; } JToken callCountSuccessValue = valueValue["callCountSuccess"]; if (callCountSuccessValue != null && callCountSuccessValue.Type != JTokenType.Null) { int callCountSuccessInstance = ((int)callCountSuccessValue); reportRecordContractInstance.CallCountSuccess = callCountSuccessInstance; } JToken callCountBlockedValue = valueValue["callCountBlocked"]; if (callCountBlockedValue != null && callCountBlockedValue.Type != JTokenType.Null) { int callCountBlockedInstance = ((int)callCountBlockedValue); reportRecordContractInstance.CallCountBlocked = callCountBlockedInstance; } JToken callCountFailedValue = valueValue["callCountFailed"]; if (callCountFailedValue != null && callCountFailedValue.Type != JTokenType.Null) { int callCountFailedInstance = ((int)callCountFailedValue); reportRecordContractInstance.CallCountFailed = callCountFailedInstance; } JToken callCountOtherValue = valueValue["callCountOther"]; if (callCountOtherValue != null && callCountOtherValue.Type != JTokenType.Null) { int callCountOtherInstance = ((int)callCountOtherValue); reportRecordContractInstance.CallCountOther = callCountOtherInstance; } JToken callCountTotalValue = valueValue["callCountTotal"]; if (callCountTotalValue != null && callCountTotalValue.Type != JTokenType.Null) { int callCountTotalInstance = ((int)callCountTotalValue); reportRecordContractInstance.CallCountTotal = callCountTotalInstance; } JToken bandwidthValue = valueValue["bandwidth"]; if (bandwidthValue != null && bandwidthValue.Type != JTokenType.Null) { long bandwidthInstance = ((long)bandwidthValue); reportRecordContractInstance.Bandwidth = bandwidthInstance; } JToken cacheHitCountValue = valueValue["cacheHitCount"]; if (cacheHitCountValue != null && cacheHitCountValue.Type != JTokenType.Null) { int cacheHitCountInstance = ((int)cacheHitCountValue); reportRecordContractInstance.CacheHitCount = cacheHitCountInstance; } JToken cacheMissCountValue = valueValue["cacheMissCount"]; if (cacheMissCountValue != null && cacheMissCountValue.Type != JTokenType.Null) { int cacheMissCountInstance = ((int)cacheMissCountValue); reportRecordContractInstance.CacheMissCount = cacheMissCountInstance; } JToken apiTimeAvgValue = valueValue["apiTimeAvg"]; if (apiTimeAvgValue != null && apiTimeAvgValue.Type != JTokenType.Null) { double apiTimeAvgInstance = ((double)apiTimeAvgValue); reportRecordContractInstance.ApiTimeAvg = apiTimeAvgInstance; } JToken apiTimeMinValue = valueValue["apiTimeMin"]; if (apiTimeMinValue != null && apiTimeMinValue.Type != JTokenType.Null) { double apiTimeMinInstance = ((double)apiTimeMinValue); reportRecordContractInstance.ApiTimeMin = apiTimeMinInstance; } JToken apiTimeMaxValue = valueValue["apiTimeMax"]; if (apiTimeMaxValue != null && apiTimeMaxValue.Type != JTokenType.Null) { double apiTimeMaxInstance = ((double)apiTimeMaxValue); reportRecordContractInstance.ApiTimeMax = apiTimeMaxInstance; } JToken serviceTimeAvgValue = valueValue["serviceTimeAvg"]; if (serviceTimeAvgValue != null && serviceTimeAvgValue.Type != JTokenType.Null) { double serviceTimeAvgInstance = ((double)serviceTimeAvgValue); reportRecordContractInstance.ServiceTimeAvg = serviceTimeAvgInstance; } JToken serviceTimeMinValue = valueValue["serviceTimeMin"]; if (serviceTimeMinValue != null && serviceTimeMinValue.Type != JTokenType.Null) { double serviceTimeMinInstance = ((double)serviceTimeMinValue); reportRecordContractInstance.ServiceTimeMin = serviceTimeMinInstance; } JToken serviceTimeMaxValue = valueValue["serviceTimeMax"]; if (serviceTimeMaxValue != null && serviceTimeMaxValue.Type != JTokenType.Null) { double serviceTimeMaxInstance = ((double)serviceTimeMaxValue); reportRecordContractInstance.ServiceTimeMax = serviceTimeMaxInstance; } } } JToken countValue = responseDoc["count"]; if (countValue != null && countValue.Type != JTokenType.Null) { long countInstance = ((long)countValue); resultInstance.TotalCount = countInstance; } JToken nextLinkValue = responseDoc["nextLink"]; if (nextLinkValue != null && nextLinkValue.Type != JTokenType.Null) { string nextLinkInstance = ((string)nextLinkValue); resultInstance.NextLink = nextLinkInstance; } } } result.StatusCode = statusCode; if (httpResponse.Headers.Contains("x-ms-request-id")) { result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } if (shouldTrace) { TracingAdapter.Exit(invocationId, result); } return(result); } finally { if (httpResponse != null) { httpResponse.Dispose(); } } } finally { if (httpRequest != null) { httpRequest.Dispose(); } } }