Пример #1
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            if (null != Request.QueryString["userid"])
            {
                string userid = Request.QueryString["userid"].ToString();

                List<UserRolesOR> listUR = new List<UserRolesOR>();
                foreach (ListItem li in cblRoseList.Items)
                {
                    if (li.Selected)
                    {
                        UserRolesOR tur = new UserRolesOR();
                        tur.UserGuid = userid;
                        tur.RoleGuid = li.Value;
                        listUR.Add(tur);
                    }
                }
                if (listUR.Count == 0)
                {
                    base.Alert("请选择角色。");
                }
                UserRolesDA rs = new UserRolesDA();
                if (rs.AddUserRoles(listUR))
                {

                    base.Close(true);
                }
                else
                {
                    base.Alert("授权失败!");
                }
            }
            else
            {
                base.Alert("获取用户ID失败!");
            }
        }
Пример #2
0
 public UserRolesOR selectARowDate(string m_id)
 {
     string sql = string.Format("select * from T_SYS_USER_ROLES where string strUserGuid='{0}'", m_id);
     DataTable dt = null;
     try
     {
         dt = db.ExecuteQueryDataSet(sql).Tables[0];
     }
     catch (Exception ex)
     {
         throw ex;
     }
     if (dt == null)
         return null;
     if (dt.Rows.Count == 0)
         return null;
     DataRow dr = dt.Rows[0];
     UserRolesOR m_User = new UserRolesOR(dr);
     return m_User;
 }