Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public PermissionSystem.Model.UserGroup DataRowToModel(DataRow row)
 {
     PermissionSystem.Model.UserGroup model=new PermissionSystem.Model.UserGroup();
     if (row != null)
     {
         if(row["user_group_id"]!=null && row["user_group_id"].ToString()!="")
         {
             model.user_group_id=long.Parse(row["user_group_id"].ToString());
         }
         if(row["user_id"]!=null && row["user_id"].ToString()!="")
         {
             model.user_id=long.Parse(row["user_id"].ToString());
         }
         if(row["group_id"]!=null && row["group_id"].ToString()!="")
         {
             model.group_id=long.Parse(row["group_id"].ToString());
         }
     }
     return model;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public PermissionSystem.Model.UserGroup GetModel(long user_group_id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 user_group_id,user_id,group_id from UserGroup ");
            strSql.Append(" where user_group_id=@user_group_id");
            SqlParameter[] parameters = {
                    new SqlParameter("@user_group_id", SqlDbType.BigInt)
            };
            parameters[0].Value = user_group_id;

            PermissionSystem.Model.UserGroup model=new PermissionSystem.Model.UserGroup();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }