/// <summary>
        /// 连接检查
        /// </summary>
        /// <returns></returns>
        private static bool ConnCheck(string RemotingSqlAddress)
        {
            try
            {
                string strSql = @"select getdate()";

                Hashtable parames = new Hashtable();
                EohiDataRemoteObject.RemotingSQLHelper remotingSQLHelper = (EohiDataRemoteObject.RemotingSQLHelper)Activator.GetObject(
                    typeof(EohiDataRemoteObject.RemotingSQLHelper), RemotingSqlAddress);

                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.getDataTable(strSql, parames);
                if (result.Code > 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
                return(false);
            }
        }
Пример #2
0
        private void ReadInfo()
        {
            try
            {
                EohiDataRemoteObject.RemotingSQLHelper remotingSQLHelper = (EohiDataRemoteObject.RemotingSQLHelper)Activator.GetObject(
                    typeof(EohiDataRemoteObject.RemotingSQLHelper), RemotingConfig.RetmotingSqlAddress);

                if (remotingSQLHelper == null)
                {
                    MessageBox.Show("连接创建失败!");
                    return;
                }


                string strSql = @"select * from  api_links where id=@id";
                //构建一个哈希表,把参数依次压入
                Hashtable parames = new Hashtable();
                parames.Add("@id", this.id.ToString());
                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.getDataTable(strSql, parames);
                if (result.Code > 0)
                {
                    MessageBox.Show(result.Msg);
                }
                else
                {
                    //this.gridControl_report.DataSource = result.DataTable;

                    DataTable dt = result.DataTable;
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        this.textEdit_id.Text         = dt.Rows[0]["id"].ToString();
                        this.textEdit_linktype.Text   = dt.Rows[0]["linktype"].ToString();
                        this.textEdit_linkname.Text   = dt.Rows[0]["linkname"].ToString();
                        this.memoEdit_linkstring.Text = dt.Rows[0]["linkstring"].ToString();
                    }
                    else
                    {
                        Common.Util.NocsMessageBox.Message("信息获取失败!");
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Пример #3
0
        private void toolStripButton_Delete_Click(object sender, EventArgs e)
        {
            if (this.gridView_report.FocusedRowHandle < 0)
            {
                MessageBox.Show("请选择需要删除的数据!");
                return;
            }

            if (MessageBox.Show("是否删除当前选择的数据[" + this.gridView_report.GetFocusedRowCellValue("apiname").ToString() + "]?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                == DialogResult.No)
            {
                return;
            }

            try
            {
                string strSql = "delete from api_iems where id=@id";

                Hashtable parames = new Hashtable();
                parames.Add("@id", this.gridView_report.GetFocusedRowCellValue("id").ToString());
                EohiDataRemoteObject.RemotingSQLHelper remotingSQLHelper = (EohiDataRemoteObject.RemotingSQLHelper)Activator.GetObject(
                    typeof(EohiDataRemoteObject.RemotingSQLHelper), RemotingConfig.RetmotingSqlAddress);

                if (remotingSQLHelper == null)
                {
                    MessageBox.Show("连接创建失败!");
                    return;
                }

                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.getDataTable(strSql, parames);
                if (result.Code > 0)
                {
                    MessageBox.Show(result.Msg);
                }
                else
                {
                    Common.Util.NocsMessageBox.Message("删除成功!");
                    this.gridView_report.DeleteRow(this.gridView_report.FocusedRowHandle);
                }
            }
            catch (Exception exp)
            {
                Common.Util.NocsMessageBox.Message(exp.Message);
            }
        }
Пример #4
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);
            }
        }
Пример #5
0
        private void GetList()
        {
            //string strSql = @"select * from api_links where (linkname like '%'+@keyword+'%') 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;


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

                if (remotingSQLHelper == null)
                {
                    MessageBox.Show("连接创建失败!");
                    return;
                }


                string strSql = @"select * from api_links where (linkname like '%'+@keyword+'%') order by id asc";
                //构建一个哈希表,把参数依次压入
                Hashtable parames = new Hashtable();
                parames.Add("@keyword", this.textEdit_keyword.Text);
                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.getDataTable(strSql, parames);
                if (result.Code > 0)
                {
                    MessageBox.Show(result.Msg);
                }
                else
                {
                    this.gridControl_report.DataSource = result.DataTable;
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Пример #6
0
        public string GetDataLinkString(string linkname)
        {
            try
            {
                EohiDataRemoteObject.RemotingSQLHelper remotingSQLHelper = (EohiDataRemoteObject.RemotingSQLHelper)Activator.GetObject(
                    typeof(EohiDataRemoteObject.RemotingSQLHelper), RemotingConfig.RetmotingSqlAddress);

                if (remotingSQLHelper == null)
                {
                    return("");
                }


                string strSql = @"select top 1  * from api_links where linkname =@linkname ";
                //构建一个哈希表,把参数依次压入
                Hashtable parames = new Hashtable();
                parames.Add("@linkname", linkname);
                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.getDataTable(strSql, parames);
                if (result.Code > 0)
                {
                    return("");
                }
                else
                {
                    DataTable dt = result.DataTable;
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        return(dt.Rows[0]["linkstring"].ToString());
                    }
                    else
                    {
                        return("");
                    }
                }
            }
            catch (Exception exp)
            {
                return("");
            }
            return("");
        }
Пример #7
0
        private void btn_addapi_on_Click(object sender, EventArgs e)
        {
            From_ApiList_Selector frm = new From_ApiList_Selector();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                //select_apiname

                string apiname = frm.select_apiname;


                string strSql = "insert into api_items_on (apiname) values(@apiname)";


                //构建一个哈希表,把参数依次压入
                Hashtable parames = new Hashtable();
                parames.Add("@apiname", apiname);
                try
                {
                    EohiDataRemoteObject.RemotingSQLHelper remotingSQLHelper = (EohiDataRemoteObject.RemotingSQLHelper)Activator.GetObject(
                        typeof(EohiDataRemoteObject.RemotingSQLHelper), RemotingConfig.RetmotingSqlAddress);

                    EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.ExecuteNonQuery(strSql, parames);
                    if (result.Code > 0)
                    {
                        MessageBox.Show(result.Msg);
                    }
                    else
                    {
                        //刷新;
                        GetList();
                    }
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message);
                }
            }
        }
Пример #8
0
        private void toolStripButton_Delete_Click(object sender, EventArgs e)
        {
            if (this.gridView_report.FocusedRowHandle < 0)
            {
                MessageBox.Show("请选择需要删除的数据!");
                return;
            }

            if (MessageBox.Show("是否删除当前选择的数据[" + this.gridView_report.GetFocusedRowCellValue("linkname").ToString() + "]?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                == DialogResult.No)
            {
                return;
            }

            string strSql = "delete from api_links where id=@id";

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

            if (remotingSQLHelper == null)
            {
                MessageBox.Show("连接创建失败!");
                return;
            }

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

            parames.Add("@id", this.gridView_report.GetFocusedRowCellValue("id").ToString());
            EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.ExecuteNonQuery(strSql, parames);
            if (result.Code > 0)
            {
                Common.Util.NocsMessageBox.Message(result.Msg);
            }

            GetList();
        }
Пример #9
0
        private void GetList()
        {
            string strSql = @"select * from api_websocket";

            //构建一个哈希表,把参数依次压入
            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
                {
                    for (int i = 0; i < result.DataTable.Rows.Count; i++)
                    {
                        pythonScriptTxt     = result.DataTable.Rows[i]["scripttxt"].ToString();
                        pythonLoopScriptTxt = result.DataTable.Rows[i]["loopscripttxt"].ToString();
                    }
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }

            for (int i = 0; i < sessionList.Count; i++)
            {
                sessionList[i].loopScripTxt = this.pythonLoopScriptTxt;
            }
        }
Пример #10
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (this.id > 0)
            {
                string strSql = @"update  api_websocket set 
                   
                    scripttxt=@scripttxt,
                    loopscripttxt=@loopscripttxt
                 
                   where id=@id";

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

                if (remotingSQLHelper == null)
                {
                    MessageBox.Show("连接创建失败!");
                    return;
                }

                Hashtable parames = new Hashtable();
                parames.Add("@id", this.id);
                parames.Add("@scripttxt", this.textEditorControl.Text);
                parames.Add("@loopscripttxt", this.textEditorControl_loop.Text);
                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.getDataTable(strSql, parames);
                if (result.Code > 0)
                {
                    MessageBox.Show(result.Msg);
                }
                else
                {
                    Common.Util.NocsMessageBox.Message("修改成功!");
                }
            }
            else
            {
                string strSql = @"insert into api_websocket (scripttxt,loopscripttxt)
                    values (@scripttxt,@loopscripttxt)";
                EohiDataRemoteObject.RemotingSQLHelper remotingSQLHelper = (EohiDataRemoteObject.RemotingSQLHelper)Activator.GetObject(
                    typeof(EohiDataRemoteObject.RemotingSQLHelper), RemotingConfig.RetmotingSqlAddress);

                if (remotingSQLHelper == null)
                {
                    MessageBox.Show("连接创建失败!");
                    return;
                }

                Hashtable parames = new Hashtable();
                parames.Add("@scripttxt", this.textEditorControl.Text);
                parames.Add("@loopscripttxt", this.textEditorControl_loop.Text);
                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.getDataTable(strSql, parames);
                if (result.Code > 0)
                {
                    MessageBox.Show(result.Msg);
                }
                else
                {
                    Common.Util.NocsMessageBox.Message("添加成功!");
                }
            }
        }
Пример #11
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (this.textEdit_linkname.Text.Trim().Length <= 0)
            {
                Common.Util.NocsMessageBox.Message("请输入模型名称!");
                return;
            }



            if (this.id.Length > 0)
            {
                string strSql = @"update  api_links set 
                    linkname=@linkname,
                    linktype=@linktype,
                    linkstring=@linkstring
                   where id=@id";

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

                if (remotingSQLHelper == null)
                {
                    MessageBox.Show("连接创建失败!");
                    return;
                }

                //构建一个哈希表,把参数依次压入
                Hashtable parames = new Hashtable();
                parames.Add("@id", this.id);
                parames.Add("@linkname", this.textEdit_linkname.Text.Trim());
                parames.Add("@linktype", this.textEdit_linktype.Text.Trim());
                parames.Add("@linkstring", this.memoEdit_linkstring.Text.Trim());
                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.ExecuteNonQuery(strSql, parames);

                if (result.Code > 0)
                {
                    Common.Util.NocsMessageBox.Message(result.Msg);
                    return;
                }
                else
                {
                }
            }
            else
            {
                string strSql = @"insert into api_links (linkname,linktype,linkstring)
                    values (@linkname,@linktype,@linkstring)";
                EohiDataRemoteObject.RemotingSQLHelper remotingSQLHelper = (EohiDataRemoteObject.RemotingSQLHelper)Activator.GetObject(
                    typeof(EohiDataRemoteObject.RemotingSQLHelper), RemotingConfig.RetmotingSqlAddress);

                if (remotingSQLHelper == null)
                {
                    MessageBox.Show("连接创建失败!");
                    return;
                }

                //构建一个哈希表,把参数依次压入
                Hashtable parames = new Hashtable();
                parames.Add("@linkname", this.textEdit_linkname.Text.Trim());
                parames.Add("@linktype", this.textEdit_linktype.Text.Trim());
                parames.Add("@linkstring", this.memoEdit_linkstring.Text.Trim());
                EohiDataRemoteObject.RemotingSQLResult result = remotingSQLHelper.ExecuteNonQuery(strSql, parames);
                if (result.Code > 0)
                {
                    Common.Util.NocsMessageBox.Message(result.Msg);
                    return;
                }
                else
                {
                }
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Пример #12
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);
            }
        }