//public ActionResult IVS220_CheckHeadOffice(string strOfficeCode) //{ // ObjectResultData res = new ObjectResultData(); // res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; // // try // { // IOfficeMasterHandler srvOffice = ServiceContainer.GetService<IOfficeMasterHandler>() as IOfficeMasterHandler; // res.ResultData = srvOffice.CheckHeadOffice(strOfficeCode); // } // catch (Exception ex) // { // res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; // res.AddErrorMessage(ex); // } // // return Json(res); //} /// <summary> /// Check exist file before download file /// </summary> /// <param name="strDocumentNo"></param> /// <param name="documentOCC"></param> /// <param name="strDocumentCode"></param> /// <param name="fileName"></param> /// <returns></returns> public ActionResult IVS220_CheckExistFile(string inventorySlipNo) { IDocumentHandler handler = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler; try { //List<dtDocumentData> list = handler.GetDocumentDataList(new doDocumentDataCondition() { DocumentNo = inventorySlipNo }, false); List <dtDocumentData> list = handler.GetDocumentDataListByInventorySlipNo(inventorySlipNo); if (list != null && list.Count > 0) { string path = PathUtil.GetPathValue(PathUtil.PathName.GeneratedReportPath, list[0].FilePath);// ReportUtil.GetGeneratedReportPath(fileName); if (System.IO.File.Exists(path) == true) { return(Json(1)); } else { return(Json(0)); } } else { return(Json(0)); } } catch (Exception ex) { ObjectResultData res = new ObjectResultData(); res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Download document (PDF) /// </summary> /// <param name="inventorySlipNo"></param> /// <returns></returns> public ActionResult IVS220_DownloadInventorySlip(string inventorySlipNo) { ObjectResultData res = new ObjectResultData(); IDocumentHandler handler = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler; try { //List<dtDocumentData> list = handler.GetDocumentDataList(new doDocumentDataCondition() { DocumentNo = inventorySlipNo }); List <dtDocumentData> list = handler.GetDocumentDataListByInventorySlipNo(inventorySlipNo); if (list != null && list.Count > 0) { Stream reportStream = handler.GetDocumentReportFileStream(list[0].FilePath); return(File(reportStream, "application/octet-stream", Path.GetFileName(list[0].FilePath))); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }