Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TF.RunSafty.Entry.nav model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Tab_Nav set ");
            strSql.Append("typeName=@typeName,");
            strSql.Append("NavUrl=@NavUrl,");
            strSql.Append("StrSort=@StrSort,");
            strSql.Append("TrNavUrl=@TrNavUrl");
            strSql.Append(" where TypeID=@TypeID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@typeName", SqlDbType.NVarChar,  50),
                new SqlParameter("@NavUrl",   SqlDbType.NVarChar, 100),
                new SqlParameter("@TypeID",   SqlDbType.VarChar,   50),
                new SqlParameter("@StrSort",  SqlDbType.Int,        4),
                new SqlParameter("@TrNavUrl", SqlDbType.NVarChar, 100)
            };
            parameters[0].Value = model.typeName;
            parameters[1].Value = model.NavUrl;
            parameters[2].Value = model.TypeID;
            parameters[3].Value = model.StrSort;
            parameters[4].Value = model.TrNavUrl;
            int rows = SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="nid"></param>
        /// <returns></returns>
        public int Delete(int id)
        {
            string strSql = "delete tab_Roles where Id= @id";

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("id", id)
            };
            return(SqlHelps.ExecuteNonQuery(SqlHelps.SQLConnString, CommandType.Text, strSql, sqlParameter));
        }
Example #3
0
        /// <summary>
        /// 删除项目
        /// </summary>
        /// <param name="nid"></param>
        /// <returns></returns>
        public int Delete(string id)
        {
            string strSql = "delete Tab_Diary where Id= @id";

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("id", id)
            };
            return(SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql, sqlParameter));
        }
Example #4
0
        /// <summary>
        /// 修改角色名称
        /// </summary>
        /// <returns></returns>
        public bool UpdatePowers(TF.RunSafty.Entry.Roles model)
        {
            string strSql = @"update tab_Roles set RolesPowers=@RolesPowers where Id=@id";

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("id",          model.Id),
                new SqlParameter("RolesPowers", model.RolesPowers)
            };
            return(SqlHelps.ExecuteNonQuery(SqlHelps.SQLConnString, CommandType.Text, strSql, sqlParameter) > 0);
        }
Example #5
0
        /// <summary>
        /// 修改用户名称
        /// </summary>
        /// <returns></returns>
        public bool UpdatePassWord(TF.RunSafty.Entry.Users model)
        {
            string strSql = @"update Tab_User set passWord=@passWord where Id=@id";

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("id",        model.id),
                new SqlParameter("@passWord", model.passWord)
            };
            return(SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql, sqlParameter) > 0);
        }
Example #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(TF.RunSafty.Entry.Diary model)
        {
            string strSql = @"update Tab_Diary set AddTime=@AddTime,DiaryContent=@DiaryContent,UserId=@UserId where Id=@id";

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("id",           model.Id),
                new SqlParameter("AddTime",      model.AddTime),
                new SqlParameter("DiaryContent", model.DiaryContent),
                new SqlParameter("UserId",       model.UserId)
            };
            return(SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql, sqlParameter));
        }
Example #7
0
        /// <summary>
        /// 修改用户名称
        /// </summary>
        /// <returns></returns>
        public bool Update(TF.RunSafty.Entry.Users model)
        {
            string strSql = @"update Tab_User set userNumber=@userNumber,userName=@userName,roseId=@roseId where Id=@id";

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("id",          model.id),
                new SqlParameter("@userNumber", model.userNumber),
                new SqlParameter("@userName",   model.userName),
                new SqlParameter("@roseId",     model.roseId)
            };
            return(SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql, sqlParameter) > 0);
        }
Example #8
0
        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public int Add(TF.RunSafty.Entry.Roles model)
        {
            string strSql = @"insert into tab_Roles (RolesName) values 
                            (@RolesName)";

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("RolesName", model.RolesName)
            };
            object obj = SqlHelps.ExecuteNonQuery(SqlHelps.SQLConnString, CommandType.Text, strSql, sqlParameter);

            if (DBNull.Value.Equals(obj))
            {
                return(0);
            }
            return(Convert.ToInt32(obj));
        }
Example #9
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TF.RunSafty.Entry.Diary model)
        {
            string strSql = @"insert into Tab_Diary (AddTime,DiaryContent,UserId) values 
                            (@AddTime,@DiaryContent,@UserId)";

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("AddTime",      model.AddTime),
                new SqlParameter("DiaryContent", model.DiaryContent),
                new SqlParameter("UserId",       model.UserId)
            };
            object obj = SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql, sqlParameter);

            if (DBNull.Value.Equals(obj))
            {
                return(0);
            }
            return(Convert.ToInt32(obj));
        }
Example #10
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string typeID)
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from Tab_Nav ");
            strSql.Append(" where TypeID=@typeID");
            SqlParameter param = new SqlParameter("@typeID", typeID);

            int rows = SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql.ToString(), param);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #11
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public int Add(TF.RunSafty.Entry.Users model)
        {
            string strSql = @"insert into Tab_User (userNumber,userName,passWord,roseId) values 
                            (@userNumber,@userName,@passWord,@roseId)";

            SqlParameter[] sqlParameter =
            {
                new SqlParameter("@userNumber", model.userNumber),
                new SqlParameter("@userName",   model.userName),
                new SqlParameter("@passWord",   model.passWord),
                new SqlParameter("@roseId",     model.roseId)
            };
            object obj = SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql, sqlParameter);

            if (DBNull.Value.Equals(obj))
            {
                return(0);
            }
            return(Convert.ToInt32(obj));
        }
Example #12
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(TF.RunSafty.Entry.nav model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Tab_Nav(");
            strSql.Append("TypeID,TypeParentID,typeName,NavUrl,StrSort,TrNavUrl)");
            strSql.Append(" values (");
            strSql.Append("@TypeID,@TypeParentID,@typeName,@NavUrl,@StrSort,@TrNavUrl)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TypeID",       SqlDbType.VarChar,   50),
                new SqlParameter("@TypeParentID", SqlDbType.VarChar,   50),
                new SqlParameter("@typeName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@NavUrl",       SqlDbType.NVarChar, 100),
                new SqlParameter("@StrSort",      SqlDbType.Int,        4),
                new SqlParameter("@TrNavUrl",     SqlDbType.NVarChar, 100)
            };
            parameters[0].Value = model.TypeID;
            parameters[1].Value = model.TypeParentID;
            parameters[2].Value = model.typeName;
            parameters[3].Value = model.NavUrl;
            parameters[4].Value = model.StrSort;
            parameters[5].Value = model.TrNavUrl;


            int rows = SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }