using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using AIAHTML5.ADMIN.API.Models; using System.Web.Http.Cors; using System.Web.Cors; using AIAHTML5.Server.Constants; using log4net; using System.Text; using AIAHTML5.ADMIN.API.Entity; namespace AIAHTML5.ADMIN.API.Controllers { //[EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")] [RoutePrefix("Report")] public class ReportController : ApiController { AIADatabaseV5Entities dbContext = new AIADatabaseV5Entities(); [Route("GetUsageReport")] [HttpGet] public IHttpActionResult GetUsageReport(string sFromDate, string sToDate, string sAccoutNumber, string sZip, int iState, int iCountry) { var lstUsageReport = dbContext.GetUsageReport(sFromDate, sToDate, sAccoutNumber, sZip, iState, iCountry).ToList(); return Ok(lstUsageReport); } [Route("GetCustomerSummeryReport")] [HttpGet] public IHttpActionResult GetCustomerSummeryReport(string sAccoutNumber, string sLicenseeFullName, Nullable iStartPrice, Nullable iEndPrice, int iLicenseType, int iAccountType, string sZip, int iState, int iCountry) { var lstCustomerSummeryReport = dbContext.GetCustomerSummary(sAccoutNumber, sLicenseeFullName, iStartPrice, iEndPrice, (byte)iLicenseType, (byte)iAccountType, sZip, iState, iCountry).ToList(); return Ok(lstCustomerSummeryReport); } [Route("GetExpiringSubscriptionReport")] [HttpGet] public IHttpActionResult GetExpiringSubscriptionReport(string sFromDate, string sToDate, Nullable iStartPrice, Nullable iEndPrice, int iLicenseTypeId, int iAccountTypeId, string sZip, int iStateId, int iCountryId) { var lstExpiringSubscriptionReport = dbContext.GetExpiringLicenses(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId).ToList(); return Ok(lstExpiringSubscriptionReport); } [Route("GetSubscriptionReport")] [HttpGet] public IHttpActionResult GetSubscriptionReport(string sFromDate, string sToDate, decimal icStartPrice, decimal icEndPrice, int iLicenseTypeId, int iAccountTypeId, string sZip, int iStateId, int iCountryId) { var lstExpiringSubscriptionReport = dbContext.GetSubscribedLicenses(sFromDate, sToDate, icStartPrice, icEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId).ToList(); return Ok(lstExpiringSubscriptionReport); } [Route("GetSubscriptionCancellationReport")] [HttpGet] public IHttpActionResult GetSubscriptionCancellationReport(string sFromDate, string sToDate, decimal icStartPrice, decimal icEndPrice, int iLicenseTypeId, int iAccountTypeId, string sZip, int iStateId, int iCountryId) { var lstExpiringSubscriptionReport = dbContext.GetCancelledLicenses(sFromDate, sToDate, icStartPrice, icEndPrice, (byte)iLicenseTypeId, (byte)iAccountTypeId, sZip, iStateId, iCountryId).ToList(); return Ok(lstExpiringSubscriptionReport); } [Route("GetNetAdSummaryReport")] [HttpGet] public IHttpActionResult GetNetAdSummaryReport(string sFromDate, string sToDate, decimal iStartPrice, decimal iEndPrice, int iLicenseTypeId) { try { var lstNetAdSummaryReport = dbContext.GetNetAdSummaryReport(sFromDate, sToDate, iStartPrice, iEndPrice, (byte)iLicenseTypeId).ToList(); return Ok(lstNetAdSummaryReport); } catch (Exception ex) { return Ok(ex.Message.ToString()); } } [Route("GetSiteLicenseUsageReport")] [HttpGet] public IHttpActionResult GetSiteLicenseUsageReport(string sFromDate, string sToDate, string sAccountNumber, int iEdition) { try { var lstSiteLicenseUsageReport = dbContext.GetSiteLicenseUsageReport(sFromDate, sToDate, sAccountNumber, (byte)iEdition).ToList(); return Ok(lstSiteLicenseUsageReport); } catch (Exception ex) { return Ok(ex.Message.ToString()); } } [Route("GetDiscountReport")] [HttpGet] public IHttpActionResult GetDiscountReport(string sFromDate, string sToDate, int iDiscountCode, string sAccountNumber) { try { var lstDiscountReport = dbContext.GetDiscountReport(sFromDate, sToDate, iDiscountCode, sAccountNumber).ToList(); return Ok(lstDiscountReport); } catch (Exception ex) { return Ok(ex.Message.ToString()); } } [Route("GetImageExportReport")] [HttpGet] public IHttpActionResult GetImageExportReport(string sFromDate, string sToDate, string sAccountNumber) { try { if (sAccountNumber == null) sAccountNumber = string.Empty; var lstImageExportReport = dbContext.GetExportedImageDetails(sFromDate, sToDate, sAccountNumber).ToList(); return Ok(lstImageExportReport); } catch (Exception ex) { return Ok(ex.Message.ToString()); } } } }