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

            strSql.Append("update User_Limit set ");
            strSql.Append("RoleID=@RoleID,");
            strSql.Append("FunctionID=@FunctionID");
            strSql.Append(" where UserLimitID=@UserLimitID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RoleID",      SqlDbType.Int, 4),
                new SqlParameter("@FunctionID",  SqlDbType.Int, 4),
                new SqlParameter("@UserLimitID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.RoleID;
            parameters[1].Value = model.FunctionID;
            parameters[2].Value = model.UserLimitID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(User_LimitModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into User_Limit(");
            strSql.Append("RoleID,FunctionID)");
            strSql.Append(" values (");
            strSql.Append("@RoleID,@FunctionID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RoleID",     SqlDbType.Int, 4),
                new SqlParameter("@FunctionID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.RoleID;
            parameters[1].Value = model.FunctionID;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public User_LimitModel DataRowToModel(DataRow row)
        {
            User_LimitModel model = new User_LimitModel();

            if (row != null)
            {
                if (row["UserLimitID"] != null && row["UserLimitID"].ToString() != "")
                {
                    model.UserLimitID = int.Parse(row["UserLimitID"].ToString());
                }
                if (row["RoleID"] != null && row["RoleID"].ToString() != "")
                {
                    model.RoleID = int.Parse(row["RoleID"].ToString());
                }
                if (row["FunctionID"] != null && row["FunctionID"].ToString() != "")
                {
                    model.FunctionID = int.Parse(row["FunctionID"].ToString());
                }
            }
            return(model);
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public User_LimitModel GetModel(int UserLimitID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 UserLimitID,RoleID,FunctionID from User_Limit ");
            strSql.Append(" where UserLimitID=@UserLimitID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserLimitID", SqlDbType.Int, 4)
            };
            parameters[0].Value = UserLimitID;

            User_LimitModel model = new User_LimitModel();
            DataSet         ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(User_LimitModel model)
 {
     return(dal.Update(model));
 }
Example #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(User_LimitModel model)
 {
     return(dal.Add(model));
 }