public IActionResult GetReportAll(string no, string buyerCode, string statusCancel, DateTime?dateFrom, DateTime?dateTo, int page, int size, string Order = "{}") { int offset = Convert.ToInt32(Request.Headers["x-timezone-offset"]); string accept = Request.Headers["Accept"]; try { var data = facades.Read(no, buyerCode, statusCancel, dateFrom, dateTo, page, size, Order, offset); return(Ok(new { apiVersion = apiVersion, data = data.Item1, info = new { total = data.Item2 }, message = Common.OK_MESSAGE, statusCode = Common.OK_STATUS_CODE })); } catch (Exception e) { Dictionary <string, object> Result = new Utilities.ResultFormatter(apiVersion, Common.INTERNAL_ERROR_STATUS_CODE, e.Message) .Fail(); return(StatusCode(Common.INTERNAL_ERROR_STATUS_CODE, Result)); } }
public IActionResult GetXlsAll(string no, string buyerCode, string statusCancel, DateTime?dateFrom, DateTime?dateTo) { try { byte[] xlsInBytes; int offset = Convert.ToInt32(Request.Headers["x-timezone-offset"]); DateTime DateFrom = dateFrom == null ? new DateTime(1970, 1, 1) : Convert.ToDateTime(dateFrom); DateTime DateTo = dateTo == null ? DateTime.Now : Convert.ToDateTime(dateTo); var xls = facades.GenerateExcel(no, buyerCode, statusCancel, dateFrom, dateTo, offset); string filename = String.Format("Laporan Canceled Booking Order - {0}.xlsx", DateTime.UtcNow.ToString("ddMMyyyy")); xlsInBytes = xls.ToArray(); var file = File(xlsInBytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename); return(file); } catch (Exception e) { Dictionary <string, object> Result = new Utilities.ResultFormatter(apiVersion, Common.INTERNAL_ERROR_STATUS_CODE, e.Message) .Fail(); return(StatusCode(Common.INTERNAL_ERROR_STATUS_CODE, Result)); } }
public IActionResult Get(int page = 1, int size = 25, [Bind(Prefix = "Select[]")] List <string> select = null, string order = "{}", string keyword = null, string filter = "{}") { try { ReadResponse <GarmentBookingOrder> read = Facade.ReadExpired(page, size, order, select, keyword, filter); List <GarmentBookingOrderViewModel> DataVM = Mapper.Map <List <GarmentBookingOrderViewModel> >(read.Data); Dictionary <string, object> Result = new Utilities.ResultFormatter(ApiVersion, Common.OK_STATUS_CODE, Common.OK_MESSAGE) .Ok <GarmentBookingOrderViewModel>(Mapper, DataVM, page, size, read.Count, DataVM.Count, read.Order, read.Selected); return(Ok(Result)); } catch (Exception e) { Dictionary <string, object> Result = new Utilities.ResultFormatter(ApiVersion, Common.INTERNAL_ERROR_STATUS_CODE, e.Message) .Fail(); return(StatusCode(Common.INTERNAL_ERROR_STATUS_CODE, Result)); } }