示例#1
0
        /// <summary>删除一条数据
        ///
        /// </summary>
        public bool Delete(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from Bse_DataDictionary ");
            strSql.Append(" where id=@id ");
            MSSQLHelper h = new MSSQLHelper(GlobalHelp.ConfigConn);

            h.CreateCommand(strSql.ToString());
            h.AddParameter("@id", id);
            return(h.ExecuteNonQuery());
        }
示例#2
0
        /// <summary>根据条件删除数据
        ///
        /// </summary>
        public bool DeleteByCond(string cond)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from Bse_DataDictionary ");
            if (!string.IsNullOrEmpty(cond))
            {
                strSql.Append(" where " + cond);
            }
            MSSQLHelper h = new MSSQLHelper(GlobalHelp.ConfigConn);

            h.CreateCommand(strSql.ToString());
            return(h.ExecuteNonQuery());
        }
示例#3
0
        /// <summary>更新一条数据
        ///
        /// </summary>
        public bool Update(Nikita.Assist.DBManager.Model.Bse_DataDictionary model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Bse_DataDictionary set ");
            strSql.Append("ServerName=@ServerName, DatabaseName=@DatabaseName, TableName=@TableName, TableHistoryName=@TableHistoryName, TableRemark=@TableRemark, ColumnName=@ColumnName, ColumnIdentity=@ColumnIdentity, ColumnPK=@ColumnPK, ColumnType=@ColumnType, ColumnSpace=@ColumnSpace, ColumnLength=@ColumnLength, ColumnScale=@ColumnScale, ColumnAllowNull=@ColumnAllowNull, ColumnDefaultValue=@ColumnDefaultValue, ColumnRemark=@ColumnRemark, ColumnHistory=@ColumnHistory, DbType=@DbType, OperationType=@OperationType, CreateUser=@CreateUser, CreateTime=@CreateTime, LastEditUser=@LastEditUser, LastEditTime=@LastEditTime, Status=@Status  ");
            strSql.Append(" where id=@id ");
            MSSQLHelper h = new MSSQLHelper(GlobalHelp.ConfigConn);

            h.CreateCommand(strSql.ToString());
            if (model.id == null)
            {
                h.AddParameter("@id", DBNull.Value);
            }
            else
            {
                h.AddParameter("@id", model.id);
            }
            if (model.ServerName == null)
            {
                h.AddParameter("@ServerName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ServerName", model.ServerName);
            }
            if (model.DatabaseName == null)
            {
                h.AddParameter("@DatabaseName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@DatabaseName", model.DatabaseName);
            }
            if (model.TableName == null)
            {
                h.AddParameter("@TableName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@TableName", model.TableName);
            }
            if (model.TableHistoryName == null)
            {
                h.AddParameter("@TableHistoryName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@TableHistoryName", model.TableHistoryName);
            }
            if (model.TableRemark == null)
            {
                h.AddParameter("@TableRemark", DBNull.Value);
            }
            else
            {
                h.AddParameter("@TableRemark", model.TableRemark);
            }
            if (model.ColumnName == null)
            {
                h.AddParameter("@ColumnName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnName", model.ColumnName);
            }
            if (model.ColumnIdentity == null)
            {
                h.AddParameter("@ColumnIdentity", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnIdentity", model.ColumnIdentity);
            }
            if (model.ColumnPK == null)
            {
                h.AddParameter("@ColumnPK", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnPK", model.ColumnPK);
            }
            if (model.ColumnType == null)
            {
                h.AddParameter("@ColumnType", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnType", model.ColumnType);
            }
            if (model.ColumnSpace == null)
            {
                h.AddParameter("@ColumnSpace", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnSpace", model.ColumnSpace);
            }
            if (model.ColumnLength == null)
            {
                h.AddParameter("@ColumnLength", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnLength", model.ColumnLength);
            }
            if (model.ColumnScale == null)
            {
                h.AddParameter("@ColumnScale", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnScale", model.ColumnScale);
            }
            if (model.ColumnAllowNull == null)
            {
                h.AddParameter("@ColumnAllowNull", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnAllowNull", model.ColumnAllowNull);
            }
            if (model.ColumnDefaultValue == null)
            {
                h.AddParameter("@ColumnDefaultValue", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnDefaultValue", model.ColumnDefaultValue);
            }
            if (model.ColumnRemark == null)
            {
                h.AddParameter("@ColumnRemark", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnRemark", model.ColumnRemark);
            }
            if (model.ColumnHistory == null)
            {
                h.AddParameter("@ColumnHistory", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ColumnHistory", model.ColumnHistory);
            }
            if (model.DbType == null)
            {
                h.AddParameter("@DbType", DBNull.Value);
            }
            else
            {
                h.AddParameter("@DbType", model.DbType);
            }
            if (model.OperationType == null)
            {
                h.AddParameter("@OperationType", DBNull.Value);
            }
            else
            {
                h.AddParameter("@OperationType", model.OperationType);
            }
            if (model.CreateUser == null)
            {
                h.AddParameter("@CreateUser", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateUser", model.CreateUser);
            }
            if (model.CreateTime == null)
            {
                h.AddParameter("@CreateTime", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateTime", model.CreateTime);
            }
            if (model.LastEditUser == null)
            {
                h.AddParameter("@LastEditUser", DBNull.Value);
            }
            else
            {
                h.AddParameter("@LastEditUser", model.LastEditUser);
            }
            if (model.LastEditTime == null)
            {
                h.AddParameter("@LastEditTime", DBNull.Value);
            }
            else
            {
                h.AddParameter("@LastEditTime", model.LastEditTime);
            }
            if (model.Status == null)
            {
                h.AddParameter("@Status", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Status", model.Status);
            }

            return(h.ExecuteNonQuery());
        }
示例#4
0
        /// <summary>更新一条数据
        ///
        /// </summary>
        public bool Update(Nikita.Assist.DBManager.Model.Bse_ExcuteAnalyze model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Bse_ExcuteAnalyze set ");
            strSql.Append("ExcuteName=@ExcuteName, ExcuteSql=@ExcuteSql, ExcuteType=@ExcuteType, DbType=@DbType, Remark=@Remark, CreateDate=@CreateDate  ");
            strSql.Append(" where id=@id ");
            MSSQLHelper h = new MSSQLHelper(GlobalHelp.ConfigConn);

            h.CreateCommand(strSql.ToString());
            if (model.id == null)
            {
                h.AddParameter("@id", DBNull.Value);
            }
            else
            {
                h.AddParameter("@id", model.id);
            }
            if (model.ExcuteName == null)
            {
                h.AddParameter("@ExcuteName", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ExcuteName", model.ExcuteName);
            }
            if (model.ExcuteSql == null)
            {
                h.AddParameter("@ExcuteSql", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ExcuteSql", model.ExcuteSql);
            }
            if (model.ExcuteType == null)
            {
                h.AddParameter("@ExcuteType", DBNull.Value);
            }
            else
            {
                h.AddParameter("@ExcuteType", model.ExcuteType);
            }
            if (model.DbType == null)
            {
                h.AddParameter("@DbType", DBNull.Value);
            }
            else
            {
                h.AddParameter("@DbType", model.DbType);
            }
            if (model.Remark == null)
            {
                h.AddParameter("@Remark", DBNull.Value);
            }
            else
            {
                h.AddParameter("@Remark", model.Remark);
            }
            if (model.CreateDate == null)
            {
                h.AddParameter("@CreateDate", DBNull.Value);
            }
            else
            {
                h.AddParameter("@CreateDate", model.CreateDate);
            }

            return(h.ExecuteNonQuery());
        }