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("webappname").ToString() + "]?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                == DialogResult.No)
            {
                return;
            }

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

            SqlParameter[] pars = new SqlParameter[]
            {
                new SqlParameter("@id", this.gridView_report.GetFocusedRowCellValue("id").ToString())
            };

            ClientClass.ApiResult result = Core.RequestXMLSQL_GetDataTable(strSql, pars);
            if (result.code != 1)
            {
                MessageBox.Show(result.msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }



            GetList();
        }
        private void GetList()
        {
            try
            {
                string strSql = @"select id,webappname,webappnote from api_webapp where (webappname like '%'+@keyword+'%') order by id asc";

                SqlParameter[] pars = new SqlParameter[]
                {
                    new SqlParameter("@keyword", this.textEdit_keyword.Text.Trim())
                };

                ClientClass.ApiResult result = Core.RequestXMLSQL_GetDataTable(strSql, pars);
                if (result.code != 1)
                {
                    MessageBox.Show(result.msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                DataTable dt = Core.DeserializeDataTable(result.data.ToString());
                this.gridControl_report.DataSource = dt;
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Пример #3
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (this.textEdit_webappname.Text.Trim().Length <= 0)
            {
                Common.Util.NocsMessageBox.Message("请输入模型名称!");
                return;
            }



            if (this.id.Length > 0)
            {
                string strSql = @"update  api_webapp set 
                    webappname=@webappname,
                    webappnote=@webappnote,
                    webapphtml=@webapphtml,
                    webappscript=@webappscript
                   where id=@id";

                SqlParameter[] pars = new SqlParameter[]
                {
                    new SqlParameter("@id", id.ToString()),
                    new SqlParameter("@webappname", this.textEdit_webappname.Text.Trim()),
                    new SqlParameter("@webappnote", this.textEdit_webappnote.Text.Trim()),
                    new SqlParameter("@webapphtml", this.memoEdit_wenapphtml.Text.Trim()),
                    new SqlParameter("@webappscript", this.memoEdit_script.Text.Trim())
                };

                ClientClass.ApiResult result = Core.RequestXMLSQL_GetDataTable(strSql, pars);
                if (result.code != 1)
                {
                    MessageBox.Show(result.msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                string strSql = @"insert into api_webapp (webappname,webappnote,webapphtml,webappscript)
                    values (@webappname,@webappnote,@webapphtml,@webappscript)";

                SqlParameter[] pars = new SqlParameter[]
                {
                    new SqlParameter("@webappname", this.textEdit_webappname.Text.Trim()),
                    new SqlParameter("@webappnote", this.textEdit_webappnote.Text.Trim()),
                    new SqlParameter("@webapphtml", this.memoEdit_wenapphtml.Text.Trim()),
                    new SqlParameter("@webappscript", this.memoEdit_script.Text.Trim())
                };


                ClientClass.ApiResult result = Core.RequestXMLSQL_GetDataTable(strSql, pars);
                if (result.code != 1)
                {
                    MessageBox.Show(result.msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Пример #4
0
        private void GetList()
        {
            //List<ClientClass.ParmField> list = new List<ClientClass.ParmField>();
            //list.Add(new ClientClass.StringField("sql", "select * from api_items where (apiname like '%'+@keyword+'%') order by apiname asc"));
            string strSql = @"select * from api_items where (apiname like '%'+@keyword+'%') order by apiname asc";

            SqlParameter[] pars = new SqlParameter[]
            {
                new SqlParameter("@keyword", "%" + this.textEdit_keyword.Text + "%")
            };

            ClientClass.ApiResult result = Core.RequestXMLSQL_GetDataTable(strSql, pars);

            //ClientClass.ApiResult result = Core.RequestApi("DB/SQL/GetDataTable", list);
            if (result.code != 1)
            {
                MessageBox.Show(result.msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DataTable dt = Core.DeserializeDataTable(result.data.ToString());

            this.gridControl_report.DataSource = dt;


            //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;

            //构建一个哈希表,把参数依次压入

            try
            {
                //EohiDataRemoteObject.RemotingSQLHelper
                //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
                //{

                //}
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Пример #5
0
        private void ReadInfo()
        {
            try
            {
                string strSql = @"select * from  api_webapp where id=@id";

                SqlParameter[] pars = new SqlParameter[]
                {
                    new SqlParameter("@id", this.id.ToString())
                };

                ClientClass.ApiResult result = Core.RequestXMLSQL_GetDataTable(strSql, pars);
                if (result.code != 1)
                {
                    MessageBox.Show(result.msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }



                DataTable dt = Core.DeserializeDataTable(result.data.ToString());
                if (dt != null && dt.Rows.Count > 0)
                {
                    this.textEdit_id.Text         = dt.Rows[0]["id"].ToString();
                    this.textEdit_webappnote.Text = dt.Rows[0]["webappnote"].ToString();
                    this.textEdit_webappname.Text = dt.Rows[0]["webappname"].ToString();
                    this.memoEdit_wenapphtml.Text = dt.Rows[0]["webapphtml"].ToString();
                    this.memoEdit_script.Text     = dt.Rows[0]["webappscript"].ToString();
                }
                else
                {
                    Common.Util.NocsMessageBox.Message("信息获取失败!");
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Пример #6
0
        private void ReadInfo()
        {
            try
            {
                string strSql = @"select * from  api_websocket ";

                SqlParameter[] pars = new SqlParameter[]
                {
                    new SqlParameter("@id", this.id.ToString())
                };

                ClientClass.ApiResult result = Core.RequestXMLSQL_GetDataTable(strSql, pars);
                if (result.code != 1)
                {
                    MessageBox.Show(result.msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                DataTable dt = Core.DeserializeDataTable(result.data.ToString());
                if (dt != null && dt.Rows.Count > 0)
                {
                    id = Convert.ToInt32(dt.Rows[0]["id"].ToString());
                    this.textEditorControl.Text = dt.Rows[0]["scripttxt"].ToString();

                    this.textEditorControl_loop.Text = dt.Rows[0]["loopscripttxt"].ToString();
                }
                else
                {
                    Common.Util.NocsMessageBox.Message("信息获取失败!");
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
        }
Пример #7
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (this.textEdit_apiname.Text.Trim().Length <= 0)
            {
                Common.Util.NocsMessageBox.Message("请输入api名称!");
                return;
            }

            if (this.id.Length > 0)
            {
                string strSql = @"update  api_items set 
                   
                    apiname=@apiname,
                    apipars=@apipars,
                    apinote=@apinote,
                    apiscript=@apiscript,
                    mod_date=getdate(),
                    mod_man=''
                   where id=@id";

                SqlParameter[] pars = new SqlParameter[]
                {
                    new SqlParameter("@id", this.id),
                    new SqlParameter("@apiname", this.textEdit_apiname.Text.Trim()),
                    new SqlParameter("@apipars", this.memoEdit_apipars.Text.Trim()),
                    new SqlParameter("@apinote", this.memoEdit_apinote.Text.Trim()),
                    new SqlParameter("@apiscript", this.memoEdit_script.Text)
                };

                ClientClass.ApiResult result = Core.RequestXMLSQL_GetDataTable(strSql, pars);
                if (result.code != 1)
                {
                    MessageBox.Show(result.msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    Common.Util.NocsMessageBox.Message("修改成功!");
                }
            }
            else
            {
                string         strSql = @"insert into api_items (apiname,apipars,apinote,apiscript,mod_man,mod_date)
                    values (@apiname,@apipars,@apinote,@apiscript,'',getdate())";
                SqlParameter[] pars   = new SqlParameter[] {
                    new SqlParameter("@apiname", this.textEdit_apiname.Text.Trim()),
                    new SqlParameter("@apipars", this.memoEdit_apipars.Text.Trim()),
                    new SqlParameter("@apinote", this.memoEdit_apinote.Text.Trim()),
                    new SqlParameter("@apiscript", this.memoEdit_script.Text)
                };
                ClientClass.ApiResult result = Core.RequestXMLSQL_GetDataTable(strSql, pars);
                if (result.code != 1)
                {
                    MessageBox.Show(result.msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    Common.Util.NocsMessageBox.Message("添加成功!");
                }
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }