Пример #1
0
        private String pGetFileImageInTMP(byte[] bytes)
        {
            String fileName = "~csrptImage";
            fileName = cUtil.getValidPath(System.IO.Path.GetTempPath()) + fileName;

            CSKernelFile.cFileEx fileEx = null;
            fileEx = new CSKernelFile.cFileEx();
            if (!fileEx.fileDelete(fileName)) { return ""; }

            CSKernelFile.cFile file = new CSKernelFile.cFile();
            if (!file.open(fileName, eFileMode.eBinaryWrite, true, true, eFileAccess.eLockWrite, false, false))
            {
                return "";
            }

            if (!file.binaryWrite(bytes))
            {
                return "";
            }

            file.close();

            return fileName;
        }
Пример #2
0
        private bool resumeDBAccessMissing(String connectString, bool saveInReport, CSDataBase.cDataBase cn)
        { // TODO: Use of ByRef founded Private Function ResumeDBAccessMissing(ByVal StrConnect As String, ByVal SaveInReport As Boolean, ByRef cn As cDataBase) As Boolean
            try
            {
                // if the database is not access we do nothing
                //
                if (connectString.ToLower().IndexOf("PROVIDER=Microsoft.Jet.OLEDB.4.0;".ToLower()) == 0)
                {
                    return false;
                }

                // get the datasource's name
                //
                String fileName = "";
                fileName = cUtil.getToken(connectString, "Data Source");

                // ask to the user if he wan to search for the database file
                //
                CommonDialog commDialog = null;
                if (FindAccessFile != null)
                {
                    FindAccessFileEventArgs e = new FindAccessFileEventArgs(fileName);
                    FindAccessFile(this, e);
                    if (e.cancel)
                    {
                        return false;
                    }
                    commDialog = e.commonDialog;
                }

                CSKernelFile.cFile file = new CSKernelFile.cFile();

                file.filter = "Access files|*.mdb";
                file.init("ResumeDBAccessMissing", C_MODULE, commDialog);

                if (!file.open(m_pathDefault + Path.DirectorySeparatorChar + file,
                                CSKernelClient.eFileMode.eRead,
                                false,
                                false,
                                eFileAccess.eShared,
                                true,
                                true))
                {
                    return false;
                }

                fileName = file.fullName;

                file.close();

                connectString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName;

                if (!cn.initDb(connectString))
                {
                    return false;
                }

                // save the new location 
                //
                if (saveInReport)
                {
                    m_connect.setStrConnect(connectString);
                }
                return true;

            }
            catch (Exception ex)
            {
                cError.mngError(ex, "ResumeDBAccessMissing", C_MODULE, "");
                return false;
            }
        }
Пример #3
0
        public bool loadSilent(String fileName)
        {

            try
            {
                CSXml.cXml docXml = null;
                docXml = new CSXml.cXml();

                CSKernelFile.cFile f = null;
                f = new CSKernelFile.cFile();

                m_path = cFile.getPath(fileName);
                m_name = cFile.getFileName(fileName);

                docXml.init(null);
                docXml.setFilter(C_FILEEX);
                docXml.setName(m_name);
                docXml.setPath(m_path);

                if (!docXml.openXml())
                {
                    return false;
                }

                m_path = docXml.getPath();
                m_name = docXml.getName();
                CSXml.cXmlProperty property = docXml.getNodeProperty(docXml.getRootNode(), "ReportDisconnected");
                m_reportDisconnected = property.getValueBool(eTypes.eBoolean);

                return nLoad(docXml);
            }
            catch (Exception ex)
            {
                cError.mngError(ex, "LoadSilent", C_MODULE, "");
                return false;
            }
        }