コード例 #1
0
ファイル: DBAdapter.cs プロジェクト: wurlinc/rhodes
 public void onBeforeDelete(String tableName, IDBResult rows2Delete)
 {
     try
     {
         processDelete(tableName, rows2Delete, null);
     }catch (Exception exc)
     {
         LOG.ERROR("onAfterInsert failed.", exc);
     }
 }
コード例 #2
0
ファイル: DBAdapter.cs プロジェクト: wurlinc/rhodes
            public void toFile(String strFilePath)
            {
                String strFullVer = m_strRhoVer + ";" + m_strAppVer +
                                    ";" + (m_bEncrypted ? "encrypted":"") +
                                    ";" + (m_bSqlite ? "sqlite" : "");

                try{
                    CRhoFile.writeStringToFile(strFilePath, strFullVer);
                }catch (Exception e) {
                    LOG.ERROR("writeDBVersion failed.", e);
                    throw e;
                }
            }
コード例 #3
0
ファイル: DBAdapter.cs プロジェクト: wurlinc/rhodes
            private void processBlobDelete(int nSrcID, String attrib, String value)
            {
                if (value == null || value.length() == 0)
                {
                    return;
                }

                try{
                    String strFilePath = RHODESAPP().resolveDBFilesPath(value);
                    CRhoFile.deleteFile(strFilePath);
                }catch (Exception exc) {
                    LOG.ERROR("DBCallback.OnDeleteFromTable: Error delete file: " + value, exc);
                }
            }
コード例 #4
0
ファイル: HttpServer.cs プロジェクト: ycaihua/rhodes
            public void execute()
            {
                String      strUrl = "";
                IDictionary result = null;

                if (m_nCommand == scDispatch)
                {
                    result = m_Parent.processDispatch(m_route, m_method, m_uri, m_headers, m_query, m_body);
                    strUrl = result[RESPONSE_BODY_FILEPATH].ToString();

                    if (isAjaxRequest() && result[RESPONSE_STATUS].ToString().equals(HTTP_REDIRECT_CODE))
                    {
                        IDictionary headers = new Dictionary <String, String>();
                        headers["X-Requested-With"] = "XMLHttpRequest";
                        if (!RHODESAPP().HttpServer.processBrowserRequest(
                                "GET",
                                new Uri(strUrl, UriKind.Relative),
                                headers,
                                new Dictionary <String, String>(),
                                m_strAjaxContext,
                                m_iTabIndex
                                ))
                        {
                            LOG.ERROR("Ajax request redirection failed.");
                        }
                        return;
                    }
                }
                else if (m_nCommand == scIndex)
                {
                    result = m_Parent.processIndex(m_route, m_method, m_uri, m_headers, m_query, m_body);
                    strUrl = result[RESPONSE_BODY_FILEPATH].ToString();
                }

                if (!isAjaxRequest())
                {
                    RHODESAPP().processWebNavigate(strUrl, -1);
                }
                else
                {
                    String res = CRhoFile.isResourceFileExist(strUrl) ? CRhoFile.readStringFromResourceFile(strUrl) : CRhoFile.readFileToString(strUrl);


                    IDictionary   headers     = new Dictionary <String, String>();
                    StringBuilder jsonHeaders = new StringBuilder();
                    foreach (object key in result.Keys)
                    {
                        if (
                            key.ToString().startsWith(PARAM_PREFIX_REQ) ||
                            key.ToString().startsWith(PARAM_PREFIX_RESP) ||
                            key.ToString().equals(RESPONSE_STATUS_MESSAGE) ||
                            key.ToString().equals(RESPONSE_STATUS)
                            )
                        {
                            continue;
                        }
                        headers[key.ToString()] = result[key].ToString();
                        jsonHeaders.AppendFormat("{0}\"{1}\": \"{2}\"",
                                                 (0 < jsonHeaders.Length) ? ", " : "",
                                                 key.ToString(), result[key].ToString());
                    }

                    String[] args = new String[5];
                    args[0] = m_strAjaxContext;
                    args[1] = res;
                    args[2] = "{" + jsonHeaders + "}";
                    args[3] = result[RESPONSE_STATUS_MESSAGE] != null ? result[RESPONSE_STATUS_MESSAGE].ToString() : "";
                    args[4] = result[RESPONSE_STATUS] != null ? result[RESPONSE_STATUS].ToString() : "";

                    RHODESAPP().processInvokeScriptArgs(AJAX_CALLBACK_FUNCNAME, args, m_iTabIndex);
                }
            }