Exemple #1
0
        private void GetList()
        {
            string strSql = @"select
            api_items_on.*,
            api_items.apipars,
            api_items.apinote,
            api_items.apiscript
            from api_items_on
            left join api_items on (api_items.apiname =api_items_on.apiname)
            order by api_items_on.apiname asc";

            //构建一个哈希表,把参数依次压入
            Hashtable parames = new Hashtable();

            try
            {
                EohiDataRemoteObject.RemotingSQLHelper remotingSQLHelper = (EohiDataRemoteObject.RemotingSQLHelper)Activator.GetObject(
                    typeof(EohiDataRemoteObject.RemotingSQLHelper), RemotingConfig.RetmotingSqlAddress);

                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.getDataTable(strSql, parames);
                if (result.Code > 0)
                {
                    MessageBox.Show(result.Msg);
                }
                else
                {
                    //
                    this.apiItemList.Clear();
                    //
                    for (int i = 0; i < result.DataTable.Rows.Count; i++)
                    {
                        ApiItem apiItem = new ApiItem();
                        apiItem.apiname   = result.DataTable.Rows[i]["apiname"].ToString();
                        apiItem.apiscript = result.DataTable.Rows[i]["apiscript"].ToString();

                        this.apiItemList.Add(apiItem);
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Exemple #2
0
        void ApiHelper_ApiRequsetSendedEvent(EohiDataRemoteObject.ApiHelper apiHelper, Hashtable hashtable)
        {
            try
            {
                //MessageBox.Show(hashtable.Count.ToString());

                string method = hashtable["method"].ToString();

                EohiDataRemoteObject.ApiResult result = new EohiDataRemoteObject.ApiResult();

                ApiHost apihost = new ApiHost();
                apihost.apiResult    = result;
                apihost.requestParas = hashtable;


                //执行查询;
                ApiItem apiItem = this.apiItemList.Find(x => x.apiname == method);
                if (apiItem == null)
                {
                    result.Code           = 1;
                    result.ResultDataType = 2;
                    result.Msg            = "未找到名为" + method + "的方法,该api可能不存在未处于在线服务状态";
                    result.ResultDataType = 4;
                }
                else
                {
                    //执行脚本;
                    IronPythonManager.ScriptExec(apihost, apiItem.apiscript);
                }


                //将查询结果返回;
                apiHelper._reslut = result;

                PrintLog("> " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + method + ",执行完成", true);
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
                PrintLog("> Error:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " " + ex.ToString(), false);
            }
        }
Exemple #3
0
        private void GetList()
        {
            string strSql = @"select
            api_items_on.*,
            api_items.apipars,
            api_items.apinote,
            api_items.apiscript
            from api_items_on
            left join api_items on (api_items.apiname =api_items_on.apiname)
            order by api_items_on.apiname asc";

            SqlParameter[] pars = new SqlParameter[]
            {
                new SqlParameter("@keyword", "%" + this.textEdit_apiexec_port.Text + "%")
            };
            //string strSql = @"select * from u3d_project  order by id asc";
            //SqlParameter[] pars = new SqlParameter[]
            //{
            //    new SqlParameter("@keyword","%"+this.textEdit_keyword.Text+"%")
            //};

            //DataTable dt = Common.DBHelper.SqlCmd.getDataTable(strSql, pars);
            //this.gridControl_report.DataSource = dt;

            //构建一个哈希表,把参数依次压入
            Hashtable parames = new Hashtable();

            parames.Add("@keyword", this.textEdit_apiexec_port.Text);
            try
            {
                EohiDataRemoteObject.RemotingSQLHelper remotingSQLHelper = (EohiDataRemoteObject.RemotingSQLHelper)Activator.GetObject(
                    typeof(EohiDataRemoteObject.RemotingSQLHelper), RemotingConfig.RetmotingSqlAddress);

                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.getDataTable(strSql, parames);
                if (result.Code > 0)
                {
                    MessageBox.Show(result.Msg);
                }
                else
                {
                    this.gridControl_report.DataSource = result.DataTable;


                    //
                    this.apiItemList.Clear();
                    //
                    for (int i = 0; i < result.DataTable.Rows.Count; i++)
                    {
                        ApiItem apiItem = new ApiItem();
                        apiItem.apiname   = result.DataTable.Rows[i]["apiname"].ToString();
                        apiItem.apiscript = result.DataTable.Rows[i]["apiscript"].ToString();

                        this.apiItemList.Add(apiItem);
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }