Ejemplo n.º 1
0
 //1。更改key字段在GridView中的哪一行,默认都是第5行,第一二列为button 第三列为checkBox 第四列为edit字段,第五列 关键字列
 //2。通过关键字获取单条记录。
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     int index = -1;
     if (e.CommandName == "select")
     {
         index = Convert.ToInt32(e.CommandArgument);
         string DataSourceID = GridView1.DataKeys[index].Value.ToString();
         Workflow_DataSourceEntity _Workflow_DataSourceEntity = new Workflow_DataSourceEntity();
         _Workflow_DataSourceEntity = DbHelper.GetInstance().GetDataSourceByID(Convert.ToInt32(DataSourceID));
         string strButtonSelectScript = "btnSelectClick('" + _Workflow_DataSourceEntity.DataSourceID + "','" + _Workflow_DataSourceEntity.DataSourceName + "');";
         System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "strButtonSelectScript", strButtonSelectScript, true);
     }
 }
Ejemplo n.º 2
0
 private Workflow_DataSourceEntity GetWorkflow_DataSourceFromIDataReader(DbDataReader dr)
 {
     Workflow_DataSourceEntity dt = new Workflow_DataSourceEntity();
     if (dr.FieldCount > 0)
     {
         if (dr["DataSourceID"].ToString() != "" || dr["DataSourceID"] != null) dt.DataSourceID = Int32.Parse(dr["DataSourceID"].ToString());
         dt.DataSourceName = dr["DataSourceName"].ToString();
         dt.DataSourceDBType = dr["DataSourceDBType"].ToString();
         dt.ConnectString = dr["ConnectString"].ToString();
         dr.Close();
         return dt;
     }
     dr.Close();
     return null;
 }
Ejemplo n.º 3
0
        /// <summary>    测试通过,将数据源资料更新到资料库中    </summary>
        /// <param name="_DataSourceEntity"> </param>
        /// <returns></returns>
        public int UpdateWorkflow_DataSource(Workflow_DataSourceEntity _DataSourceEntity)
        {
            DbParameter[] parms ={
                                     MakeInParam("@DataSourceName",(DbType)SqlDbType.VarChar,200,_DataSourceEntity.DataSourceName),
                                     MakeInParam("@DataSourceDBType",(DbType)SqlDbType.VarChar,50,_DataSourceEntity.DataSourceDBType ),
                                     MakeInParam("@ConnectString",(DbType)SqlDbType.VarChar,400,_DataSourceEntity.ConnectString ),
                                     MakeInParam("@DataSourceID",(DbType)SqlDbType.Int ,4,_DataSourceEntity.DataSourceID ),
                                  };

            StringBuilder strb = new StringBuilder();
            strb.Append(" UPDATE [dbo].[Workflow_DataSource] ");
            strb.Append(" SET [DataSourceName]=@DataSourceName ,[DataSourceDBType]=@DataSourceDBType ,[ConnectString]=@ConnectString ");
            strb.Append(" WHERE DataSourceID=@DataSourceID");
            return ExecuteNonQuery(CommandType.Text, strb.ToString(), parms);
        }
Ejemplo n.º 4
0
        /// <summary>    测试通过,将数据源资料插入资料库中     </summary>
        /// <param name="_DataSourceEntity"> </param>
        /// <returns></returns>
        public int AddWorkflow_DataSource(Workflow_DataSourceEntity _DataSourceEntity)
        {
            //做判断 相同的DB,相同的连接字串,返回-1,,插入成功返回DataSourceID
            DbParameter[] parms ={
                                     MakeInParam("@DataSourceName",(DbType)SqlDbType.VarChar,200,_DataSourceEntity.DataSourceName),
                                     MakeInParam("@DataSourceDBType",(DbType)SqlDbType.VarChar,50,_DataSourceEntity.DataSourceDBType ),
                                     MakeInParam("@ConnectString",(DbType)SqlDbType.VarChar,400,_DataSourceEntity.ConnectString )
                                  };
            string strsql = "select  count(*) from [dbo].[Workflow_DataSource] where DataSourceDBType=@DataSourceDBType and ConnectString=@ConnectString";

            if ((int)ExecuteScalar(CommandType.Text, strsql, parms) > 0)
            {
                return -1;
            }
            else
            {
                StringBuilder strb = new StringBuilder();
                strb.Append(" INSERT INTO [dbo].[Workflow_DataSource] ([DataSourceName] ,[DataSourceDBType] ,[ConnectString])");
                strb.Append(" VALUES  (@DataSourceName, @DataSourceDBType,@ConnectString);");
                strb.Append("select @@identity;");
                return Convert.ToInt32(ExecuteScalar(CommandType.Text, strb.ToString(), parms));
            }
        }
Ejemplo n.º 5
0
 //此类要更改,完成赋值工作
 private int SaveData()
 {
     Workflow_DataSourceEntity _Workflow_DataSourceEntity = new Workflow_DataSourceEntity();
     _Workflow_DataSourceEntity.DataSourceID = (txtDSID.Value == null || txtDSID.Value == "") ? 0 : Convert.ToInt32(txtDSID.Value);//Convert.ToInt32(txtDSID.Value );
     _Workflow_DataSourceEntity.DataSourceName = txtDSName.Text;
     _Workflow_DataSourceEntity.DataSourceDBType = ddlDBType.SelectedValue;
     _Workflow_DataSourceEntity.ConnectString = txtConnectString.Text;
     int sResult = -1;
     if (strOperationState == "Add")
         sResult = DbHelper.GetInstance().AddWorkflow_DataSource(_Workflow_DataSourceEntity);
     else if (strOperationState == "Update")
         sResult = DbHelper.GetInstance().UpdateWorkflow_DataSource(_Workflow_DataSourceEntity);
     return sResult;
 }
Ejemplo n.º 6
0
        //1。更改key字段在GridView中的哪一行,默认都是第5行,第一二列为button 第三列为checkBox 第四列为edit字段,第五列 关键字列
        //2。通过关键字获取单条记录。
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int index = -1;
            if (e.CommandName == "select")
            {
                programmaticAddModalPopup.Show();
                strOperationState = "Update";
                index = Convert.ToInt32(e.CommandArgument);   //获取行号

                string keyCol = GridView1.DataKeys[index].Value.ToString();
                //第二处待修改位置
                Workflow_DataSourceEntity _Workflow_DataSourceEntity = new Workflow_DataSourceEntity();
                _Workflow_DataSourceEntity = DbHelper.GetInstance().GetDataSourceByID(Convert.ToInt32(keyCol));
                if (_Workflow_DataSourceEntity != null) //SetPannelData(_Workflow_DataSourceEntity);
                {
                    txtDSID.Value = _Workflow_DataSourceEntity.DataSourceID.ToString();
                    txtDSName.Text = _Workflow_DataSourceEntity.DataSourceName;
                    txtConnectString.Text = _Workflow_DataSourceEntity.ConnectString;
                    ddlDBType.SelectedValue = _Workflow_DataSourceEntity.DataSourceDBType;
                }
            }
        }