public ActionResult IVS220_DownloadPreparedPO() { try { IVS220_ScreenParameter prm = GetScreenObject <IVS220_ScreenParameter>(); if (prm.PreparedDownloadPO == null) { return(HttpNotFound()); } doDocumentDownloadLog doDownloadLog = new doDocumentDownloadLog() { DocumentNo = prm.PreparedDownloadPO.DocumentNo, DocumentCode = prm.PreparedDownloadPO.DocumentCode, DocumentOCC = prm.PreparedDownloadPO.DocumentOCC, DownloadDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime, DownloadBy = CommonUtil.dsTransData.dtUserData.EmpNo }; ILogHandler handlerLog = ServiceContainer.GetService <ILogHandler>() as ILogHandler; int isSuccess = handlerLog.WriteDocumentDownloadLog(doDownloadLog); IDocumentHandler handlerDoc = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler; Stream reportStream = handlerDoc.GetDocumentReportFileStream(prm.PreparedDownloadPO.FilePath); prm.PreparedDownloadPO = null; return(File(reportStream, "application/pdf")); } catch (Exception ex) { return(HttpNotFound()); } }
/// <summary> /// Checking user's permission. /// </summary> /// <param name="param">Screen's parameter.</param> /// <returns>Return ActionResult of the screen.</returns> public ActionResult IVS220_Authority(IVS220_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { ICommonHandler srvCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; //if (srvCommon.IsSystemSuspending()) //{ // res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; // res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); // return Json(res); //} if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_INQUIRE_IN_OUT, FunctionID.C_FUNC_ID_OPERATE)) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(InitialScreenEnvironment <IVS220_ScreenParameter>("IVS220", param, res)); }
public ActionResult IVS220_PrepareDownloadPO(string strPurchaseOrderNo, string strReportID) { ObjectResultData res = new ObjectResultData(); try { IVS220_ScreenParameter prm = GetScreenObject <IVS220_ScreenParameter>(); var srvCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; var lstDocs = srvCommon.GetTbt_DocumentList(strPurchaseOrderNo, strReportID).OrderByDescending(d => d.DocumentOCC).FirstOrDefault(); if (lstDocs == null) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0112); res.ResultData = false; } else { string path = PathUtil.GetPathValue(PathUtil.PathName.GeneratedReportPath, lstDocs.FilePath); //ReportUtil.GetGeneratedReportPath(lstDocs.FilePath); if (System.IO.File.Exists(path) == true) { prm.PreparedDownloadPO = lstDocs; res.ResultData = true; } else { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0112); res.ResultData = false; } } return(Json(res)); } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); return(Json(res)); } }