public bool openDocument(String fileName) { cMouseWait mouse = new cMouseWait(); try { if (!m_report.loadSilent(fileName)) { return false; } m_report.getLaunchInfo().setStrConnect(m_database); Application.DoEvents(); return true; } catch (Exception ex) { return false; } finally { mouse.Dispose(); } }
public bool openDocument(String fileName) { cMouseWait mouse = new cMouseWait(); try { // to avoid reentrancy m_opening = true; if (fileName == "") { pSetInitDir(); // TODO: the original version of this function // made a very dirty use of the return of m_report.load // // the code creates a new document when m_report.load(...) // return false and m_report.getName != "" // // when m_report.load is translated we will // need to rewrite this function // // in the original function there was a goto to // a 'done' label if (!m_report.load(m_fmain.openFileDialog)) { if (m_report.getName() == "") return false; // here the original function has a goto // 'goto done' } } else { if (!m_report.loadSilent(fileName)) { return false; } } reLoadReport(); // here the original function has a 'done' label // /* * Done: With m_fmain.cmDialog Dim FileEx As CSKernelFile.cFileEx Set FileEx = New CSKernelFile.cFileEx .InitDir = FileEx.FileGetPath(.FileName) End With * I don't know wath this code is suposed to do * but it is clear that is very dirty so we * will need to rewrite all this lines */ Application.DoEvents(); cGlobals.setDocActive(this); m_opening = false; return true; } catch (Exception ex) { return false; } finally { mouse.Dispose(); } }
public bool saveDocument(bool saveAs) { cMouseWait mouse = new cMouseWait(); try { bool isNew = false; isNew = m_report.getName() == ""; if (isNew) { m_report.setName(m_name); } if (saveAs) { isNew = true; } setZOrder(); pValidateSectionAspect(); if (!m_report.save(m_fmain.saveFileDialog, isNew)) reLoadReport(); return true; } catch (Exception ex) { cError.mngError(ex, "saveDocument", C_MODULE, ""); return false; } finally { mouse.Dispose(); } }
private void launchReport() { cMouseWait mouse = new cMouseWait(); try { setZOrder(); showProgressDlg(); m_report.getLaunchInfo().getPrinter().setPaperInfo(m_report.getPaperInfo()); m_report.getLaunchInfo().setObjPaint(new CSReportPaint.cReportPrint()); // TODO: remove this m_report.getLaunchInfo().setHwnd(0); m_report.getLaunchInfo().setShowPrintersDialog(true); m_report.launch(); } catch (Exception ex) { cError.mngError(ex, "launchReport", C_MODULE, ""); } finally { mouse.Dispose(); closeProgressDlg(); } }
public bool openDocument(String fileName) { cMouseWait mouse = new cMouseWait(); try { // to avoid reentrancy m_opening = true; if (fileName == "") { pSetInitDir(); if (!m_report.load(m_fmain.openFileDialog)) { if (m_report.getName() == "") return false; } } else { if (!m_report.loadSilent(fileName)) { return false; } } reLoadReport(); Application.DoEvents(); cMainEditor.setDocActive(this); m_opening = false; // Testing // //m_paint.initGrid(m_picReport.CreateGraphics(), m_typeGrid); //var bmp = m_paint.getBitmap(); /* var g = Graphics.FromImage(bmp); var graph = m_picReport.CreateGraphics(); System.Drawing.Rectangle rect = new System.Drawing.Rectangle(0, 0, (int)graph.VisibleClipBounds.Width, (int)graph.VisibleClipBounds.Height + 56); // TODO check why 56 ??? Brush brush = new SolidBrush(Color.Red); g.FillRectangle(brush, rect); brush.Dispose(); var b = new SolidBrush(Color.Black); g.FillRectangle(b, new RectangleF(0,0,10,10)); g.FillRectangle(b, new RectangleF(100,100, 10, 10)); Brush bg = new System.Drawing.Drawing2D.HatchBrush( System.Drawing.Drawing2D.HatchStyle.DottedGrid, Color.FromArgb(0xC0C0C0), Color.White); g.FillRectangle(bg, new RectangleF(200, 100, 100, 100)); b.Dispose(); bg.Dispose(); graph.Dispose(); g.Dispose(); */ //m_picReport.Image = bmp; return true; } catch (Exception ex) { return false; } finally { mouse.Dispose(); } }
public bool saveData(object commDialog, bool withDialog) { // TODO: Use of ByRef founded Public Function SaveData(ByRef CommDialog As Object, Optional ByVal WithDialog As Boolean = True) As Boolean CSXml.cXml docXml = null; docXml = new CSXml.cXml(); docXml.init(commDialog); docXml.setFilter(C_FILEDATAEX); docXml.setName(getFileName(m_name) + "-data.csd"); docXml.setPath(m_path); if (withDialog) { if (!docXml.newXmlWithDialog()) { return false; } } else { if (!docXml.newXml()) { return false; } } Application.DoEvents(); cMouseWait mouse = new cMouseWait(); String dataName = ""; String dataPath = ""; dataName = docXml.getName(); dataPath = docXml.getPath(); CSXml.cXmlProperty xProperty = null; xProperty = new CSXml.cXmlProperty(); xProperty.setName("RptName"); xProperty.setValue(eTypes.eText, dataName); docXml.addProperty(xProperty); // Configuracion de paginas XmlNode nodeObj = null; XmlNode nodeObjAux = null; // Paginas cReportPage page = null; xProperty.setName(C_NODERPTPAGES); xProperty.setValue(eTypes.eText, ""); nodeObj = docXml.addNode(xProperty); for (int _i = 0; _i < m_pages.count(); _i++) { page = m_pages.item(_i); page.save(docXml, nodeObj); if (!saveDataForWeb(page, dataName, dataPath)) { return false; } } if (!docXml.save()) { return false; } if (!docXml.openXml()) { return false; } if (!nLoadData(docXml)) { return false; } mouse.Dispose(); return true; }
private void launchReport() { cMouseWait mouse = new cMouseWait(); try { showProgressDlg(); var li = m_report.getLaunchInfo(); li.getPrinter().setPaperInfo(m_report.getPaperInfo()); m_fPrint = new cReportPrint(); m_fPrint.setHidePreviewWindow(true); li.setObjPaint(m_fPrint); // TODO: remove this li.setHwnd(0); li.setShowPrintersDialog(true); m_report.launch(); } catch (Exception ex) { cError.mngError(ex, "launchReport", C_MODULE, ""); } finally { mouse.Dispose(); closeProgressDlg(); } }
public bool initDbEx(string nameDb, string server, string user, string password, string connect, bool useOleDb) { cMouseWait mouseWait = new cMouseWait(); try { closeDb(); if (m_ocn == null) { m_ocn = createConnection(); } m_originalStrConnect = connect; if (connect == "") { connect = string.Format("Data Source={0};User Id={1};Password={2};Integrated Security=no;", server, user, password); m_serverName = server; m_userName = user; m_password = password; } else { m_serverName = cUtil.getToken(connect, "Data Source="); m_userName = cUtil.getToken(connect, "User="******"Password="******"initDbEx", c_module, ""); return false; } finally { mouseWait.Dispose(); } }
public bool getNewId(string table, string fieldId, out int id, string function, string module, string title, eErrorLevel level) { cMouseWait mouseWait = new cMouseWait(); id = cConstants.C_NO_ID; try { if (pGetNewId(table, fieldId, out id, false, function, module, title, level)) { return true; } else { if (pReconnectTry()) { return pGetNewId(table, fieldId, out id, true, function, module, title, level); } else return false; } } catch (Exception ex) { cError.mngError(ex, "getNewId for " + module + "." + function, c_module, ""); return false; } finally { mouseWait.Dispose(); } }