Beispiel #1
0
        private string Create(HttpContext context)
        {
            T_RoleRight model = new T_RoleRight();
            int         error = 0;
            int         succ  = 0;

            model.AdminUserId = int.Parse(context.Request.QueryString["AdminUserId"]);

            model.IfAdd  = int.Parse(context.Request.QueryString["IfAdd"]);
            model.IfUp   = int.Parse(context.Request.QueryString["IfUp"]);
            model.IfDel  = int.Parse(context.Request.QueryString["IfDel"]);
            model.IfSel  = int.Parse(context.Request.QueryString["IfSel"]);
            model.Editor = admin.AdminLogName;
            string[] sysFun = context.Request.QueryString["Role"].ToString().Split(',');
            dal.Delete(model.AdminUserId);
            for (int i = 0; i < sysFun.Length; i++)
            {
                if (sysFun[i] != "0")
                {
                    model.SysFunId = int.Parse(sysFun[i]);
                    if (dal.Create(model))
                    {
                        succ++;
                    }
                    else
                    {
                        error++;
                    }
                }
            }
            return("共获取到授权权限[" + (sysFun.Length - 1) + "]条,成功了[" + succ + "]条,失败了[" + error + "]条。");
        }
Beispiel #2
0
 /// <summary>
 /// 添加权限
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Create(T_RoleRight model)
 {
     try
     {
         object[] obj    = { model.AdminUserId, model.SysFunId, model.IfAdd, model.IfUp, model.IfDel, model.IfSel, model.Editor, model.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") };
         string   strSql = string.Format("insert into T_RoleRight (AdminUserId,SysFunId,IfAdd,IfUp,IfDel,IfSel,Editor,CreateDate) values ({0},{1},{2},{3},{4},{5},'{6}','{7}')", obj);
         if (DbHelper.Factory().ExecuteNonQuery(strSql) > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch { return(false); }
 }