Example #1
0
        private void LoadServerFile()
        {
            Login.MasterPage.Loading(true, this);

            ReportDS dsReport = new ReportDS();
            object[] objParam = new object[2];

            objParam[0] = "CwpID="+Lib.CWPDataSource.selectedCWP;
            objParam[1] = "ScheduleWorkItemID= " + Lib.ScheduleDataSource.selectedSchedule;
            dsReport.Params = objParam;

            dsReport.ToolBarUseYn = "N";
            try
            {
                if (ozViewer != null)
                {
                    ozViewer.Dispose();
                }
                dsReport.ServerYn = "Y";
                dsReport.ProjectCode = "LedCore";

                dsReport.ReportName = "/TureTaskManPower.ozr";
                dsReport.OdiName = "TrueTaskManPower";
                string strParam = ReportUtil.MakeParameterForOnline(dsReport);

                ozViewer = ReportUtil.RunReport(brdViewer, strParam);
            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
            Login.MasterPage.Loading(false, this);
        }
Example #2
0
        /// <summary>
        /// MakeParameterForOffLine : Make Parameter For Reports on Device
        /// </summary>
        /// <param name="rdsParams">Data Object</param>
        /// <returns>Parameter String</returns>
        public static async Task<string> MakeParameterForOffLine(ReportDS rdsParams)
        {
            string strOzdPath = string.Empty;
            string strFinalPath = string.Empty;

            try
            {
                FileOpenPicker foPicker = new FileOpenPicker();

                foPicker.ViewMode = PickerViewMode.List;
                foPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
                foPicker.FileTypeFilter.Add(".ozd");

                StorageFile sfiFile = await foPicker.PickSingleFileAsync();
                StorageFolder sfoFolder = ApplicationData.Current.LocalFolder;

                if (sfiFile != null)
                {
                    // await sfiFile.CopyAsync(sfoFolder, sfiFile.Name, NameCollisionOption.ReplaceExisting);
                    await sfiFile.CopyAsync(sfoFolder, "insert.ozd", NameCollisionOption.ReplaceExisting);

                    //strOzdPath = ApplicationData.Current.LocalFolder.Path + "\\" + sfiFile.Name;
                    strOzdPath = ApplicationData.Current.LocalFolder.Path + "\\insert.ozd";
                    StorageFile sfoTmpFile = await StorageFile.GetFileFromPathAsync(strOzdPath);

                    rdsParams.OzdName = strOzdPath;
                    rdsParams.OdiName = "";
                    rdsParams.ReportName = "";
                    rdsParams.ServerYn = "N";
                    rdsParams.ProjectCode = "";
                    rdsParams.Params = null;

                    strFinalPath = MakeParameterString(rdsParams);
                }
            }
            catch (Exception ex)
            {
                strFinalPath = "";
            }

            return strFinalPath;
        }
Example #3
0
 /// <summary>
 /// MakeParameterForOnline : Make Parameter For Reports on Server
 /// </summary>
 /// <param name="rdsParams">Data Object</param>
 /// <returns>Parameter String</returns>
 public static string MakeParameterForOnline(ReportDS rdsParams)
 {
     return MakeParameterString(rdsParams);
 }
Example #4
0
        /// <summary>
        /// MakeParameterString : Make Parameter For Reports
        /// </summary>
        /// <param name="rdsParams">Data Object</param>
        /// <returns>Parameter String</returns>
        public static string MakeParameterString(ReportDS rdsParams)
        {
            string strParam = string.Empty;
            string strProjectCd = string.Empty;
            string strTempText = string.Empty;

            // Our Server : DEFAULT_SEVERPATH ( http://dev.elementindustrial.com/oz60/server.aspx\n )
            // Nothing for Local Files
            if (!string.IsNullOrEmpty(rdsParams.ServerPath))
            {
                strParam = strParam + "connection.servlet=" + rdsParams.ServerPath + "\n";
            }
            else
            {
                if (!string.IsNullOrEmpty(rdsParams.ServerYn))
                {
                    if (rdsParams.ServerYn.ToUpper().Equals("Y"))
                    {
                        strParam = strParam + "connection.servlet=" + DEFAULT_SEVERPATH;
                    }
                }
            }

            if (!string.IsNullOrEmpty(rdsParams.ProjectCode))
            {
                strProjectCd = "/" + rdsParams.ProjectCode;
            }

            // Only Online
            if (!string.IsNullOrEmpty(rdsParams.ReportName))
            {
                strParam = strParam + "connection.reportname=" + strProjectCd + rdsParams.ReportName + "\n";
            }

            // Only Online
            if (!string.IsNullOrEmpty(rdsParams.OdiName))
            {
                // Odi File Check
                strTempText = rdsParams.OdiName.EndsWith(".odi") ? rdsParams.OdiName.Substring(0, rdsParams.OdiName.Length - 4) : rdsParams.OdiName;
                strParam = strParam + "odi.odinames=" + strTempText + "\n";

                // Parameter Check
                if (rdsParams.Params != null)
                {
                    if (rdsParams.Params.Count() > 0)
                    {
                        int intTempCnt = 0;
                        strParam = strParam + "odi." + strTempText + ".pcount=" + rdsParams.Params.Count().ToString() + "\n";

                        foreach (object ojbParam in rdsParams.Params)
                        {
                            intTempCnt++;
                            strParam = strParam + "odi." + strTempText + ".args" + intTempCnt.ToString() + "=" + ojbParam.ToString() + "\n";
                        }
                    }
                }
            }

            // For Local Files
            if (!string.IsNullOrEmpty(rdsParams.OzdName))
            {
                strParam = strParam + "connection.openfile=" + rdsParams.OzdName + "\n";
            }

            #region // When it needs more function of OZ.dll

            //// For Local Files
            //if (!string.IsNullOrEmpty(rdsParams.ViewMode))
            //{
            //    string strTemp = string.Empty;
            //    string strModeText = string.Empty;

            //    strTemp = rdsParams.ViewMode.ToLower().IndexOf("print") > -1 ? "print/" : "";
            //    strModeText = strModeText + strTemp;
            //    strTemp = rdsParams.ViewMode.ToLower().IndexOf("export") > -1 ? "export/" : "";
            //    strModeText = strModeText + strTemp;
            //    strTemp = rdsParams.ViewMode.ToLower().IndexOf("preview") > -1 ? "preview/" : "";
            //    strModeText = strModeText + strTemp;
            //    strModeText = strModeText.Substring(0, strModeText.Length - 1);

            //    strParam = strParam + "viewer.mode=" + strModeText + "\n";
            //    //strParam = strParam + "viewer.mode=preview/export\n";
            //}

            #endregion

            // Language Setting
            strTempText = !string.IsNullOrEmpty(rdsParams.Language) ? rdsParams.Language : DEFAULT_LANG;
            strParam = strParam + "nglobal.language=" + strTempText + "\n";

            // When we Sign
            if (!rdsParams.IsNoSignZoom)
            {
                strParam = strParam + "eform.signpad_type=zoom\n";
            }

            #region // When we use Tool Bar

            string strToolbarUseYn = "Y";

            if (!string.IsNullOrEmpty(rdsParams.ToolBarUseYn))
            {
                strToolbarUseYn = rdsParams.ToolBarUseYn.ToUpper();
            }

            if (strToolbarUseYn.Equals("N"))
            {
                strParam = strParam + "viewer.usetoolbar=false\n";
            }
            else
            {
                // if UserMenuUseYn is not "N", we can suggest the following causes.
                // Save button in Viewer Menu
                if (!string.IsNullOrEmpty(rdsParams.ToolBarSaveYn))
                {
                    if (rdsParams.ToolBarSaveYn.ToUpper().Equals("N"))
                    {
                        strParam = strParam + "toolbar.save=false\n";
                    }
                }
                // Print in Viewer Menu
                if (!string.IsNullOrEmpty(rdsParams.ToolBarPrintYn))
                {
                    if (rdsParams.ToolBarPrintYn.ToUpper().Equals("N"))
                    {
                        strParam = strParam + "toolbar.print=false\n";
                    }
                }
                // Data Save in Viewer Menu
                if (!string.IsNullOrEmpty(rdsParams.ToolBarDataSaveYn))
                {
                    if (rdsParams.ToolBarDataSaveYn.ToUpper().Equals("N"))
                    {
                        strParam = strParam + "toolbar.option=false\n";
                    }
                }
                // Page Selection in Viewer Menu
                if (!string.IsNullOrEmpty(rdsParams.ToolBarPageMoveYn))
                {
                    if (rdsParams.ToolBarPageMoveYn.ToUpper().Equals("N"))
                    {
                        strParam = strParam + "toolbar.pageselection=false\n";
                        strParam = strParam + "toolbar.page=false\n";
                    }
                }
                // Zoom in & out in Viewer Menu
                if (!string.IsNullOrEmpty(rdsParams.ToolBarZoomYn))
                {
                    if (rdsParams.ToolBarZoomYn.ToUpper().Equals("N"))
                    {
                        strParam = strParam + "toolbar.zoom=false\n";
                    }
                }
                // Page Controls in Viewer Menu
                if (!string.IsNullOrEmpty(rdsParams.ToolBarPageControlYn))
                {
                    if (rdsParams.ToolBarPageControlYn.ToUpper().Equals("N"))
                    {
                        strParam = strParam + "toolbar.pagecontrol=false\n";
                    }
                }
                // Page width in Viewer Menu
                if (!string.IsNullOrEmpty(rdsParams.ToolBarWithControlYn))
                {
                    if (rdsParams.ToolBarWithControlYn.ToUpper().Equals("N"))
                    {
                        strParam = strParam + "toolbar.singlepage_fittoframe=false\n";
                        strParam = strParam + "toolbar.singlepagecontinuous_fittowidth=false\n";
                    }
                }
                // Find in Viewer Menu
                if (!string.IsNullOrEmpty(rdsParams.ToolBarFindYn))
                {
                    if (rdsParams.ToolBarFindYn.ToUpper().Equals("N"))
                    {
                        strParam = strParam + "toolbar.finds=false\n";
                    }
                }
                // Other Menus in Viewer Menu
                if (!string.IsNullOrEmpty(rdsParams.ToolBarOtherMenuYn))
                {
                    if (rdsParams.ToolBarOtherMenuYn.ToUpper().Equals("N"))
                    {
                        strParam = strParam + "toolbar.etc=false\n";
                    }
                }
            }

            #endregion

            strParam = strParam + "comment.all=true";
            strParam = strParam + "?ozurltype=url\n";

            return strParam;
        }
Example #5
0
        private async void LoadReport()
        {
            Login.MasterPage.Loading(true, this);

            ReportDS dsReport = new ReportDS();

            //ozd 파일 get
            ReportList = await (new Lib.ServiceModel.ProjectModel()).GetIwpDocumentByIwpProjectFileType(_fiwpid, _projectid, FileType, "Y", DataLibrary.Utilities.FileCategory.REPORT, "0");

            if (ReportList != null)
            {
                foreach (DataLibrary.DocumentDTO _dto in ReportList.OrderByDescending(x => x.DocumentID).ToList())
                {
                    if (_dto.FileExtension.ToLower().Equals("ozd"))
                    {
                        _filePath = _dto.LocationURL;
                        _fileStoreID = _dto.FileStoreId;
                        break;
                    }
                }
            }

            //1. ozd 파일 있으면 ozd 로딩 
            if (!string.IsNullOrEmpty(_filePath))
            {
                //IIS 세팅 시 마임타입 추가(ozd : text/ozd)
                //_filePath = "http://localhost/SigmaStorage/SigmaDoc/Yellow/PJTname/FILE_TYPE_SUMMARY/IWPSummary/1/IWPSummary.ozd";

                try
                {
                    Uri pathCheckUri = new Uri(_filePath);
                    var client = new HttpClient();
                    //파일 있는지 확인
                    string page = await client.GetStringAsync(pathCheckUri);
                    
                    strParam = "connection.openfile=" + _filePath + "\nviewer.usetoolbar=false\nviewer.errorcommand=false";
                }
                catch (Exception ex)
                {   
                    strParam = "";
                }

            }
            else
            {
                //2. 처음 작성 시 ozr 파일 로딩
                DataLibrary.rptProjectCwaIwpDTO dto = await (new Lib.ServiceModel.ProjectModel()).JsonGetProjectCwaIwpByIwp(Lib.IWPDataSource.selectedIWP.ToString());

                object[] objParam = new object[13];

                objParam[0] = "FIWPNM=" + dto.FiwpName; //107-10-21-01";
                objParam[1] = "ScheduleID=" + dto.ProjectScheduleName;//TBO";
                objParam[2] = "Title=" + dto.Description;// CWA 107 Cut and Cap Piles - Tank 3A-T-113";
                objParam[3] = "ClientNM=" + dto.ClientCompanyName;// Meg Energy Corp.";
                objParam[4] = "ProjectNM=" + dto.ClientProjectName;// CLRP - Phase 3A";
                objParam[5] = "LedcorProject=" + dto.ProjectName;// 3615465";
                objParam[6] = "CWARef=" + dto.CwaName;// 1100-10-S-01-107";
                objParam[7] = "ReleasedNM=" + Login.UserAccount.UserName;
                objParam[8] = "AssignedNM=" + dto.LeaderName;
                objParam[9] = "Manhour=" + dto.TotalManhours;
                objParam[10] = "ScheduleDT=" + dto.StartDate.ToString("d/M/yyyy") + "-" + dto.EndDate.ToString("d/M/yyyy");
                objParam[11] = "ReleasedDT=test";
                objParam[12] = "AssignedDT=test";
                dsReport.Params = objParam;

                dsReport.ServerYn = "Y";
                dsReport.ProjectCode = "Element";// "LedCore";
                dsReport.ReportName = "/" + FileName + ".ozr";
                dsReport.OdiName = OdiName;
                dsReport.ToolBarUseYn = "N";
                dsReport.ToolBarOtherMenuYn = "N";

                strParam = ReportUtil.MakeParameterForOnline(dsReport);
            }

            try
            {
                if (ozViewer != null)
                {
                    ozViewer.Dispose();
                }

                if (strParam != "")
                    ozViewer = ReportUtil.RunReport(brdViewer, strParam);
                else
                    WinAppLibrary.Utilities.Helper.SimpleMessage("There is a problem loading the " + FileName + " - Please try again later", "Loading Error");
            }
            catch (Exception ex)
            {
                (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(ex, "Load " + FileName, "There is a problem loading the " + FileName + " - Please try again later", "Loading Error");
            }

            Login.MasterPage.Loading(false, this);
        }