Exemple #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tz888.Model.dp.SysPermissionTab> DataTableToList(DataTable dt)
        {
            List <Tz888.Model.dp.SysPermissionTab> modelList = new List <Tz888.Model.dp.SysPermissionTab>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tz888.Model.dp.SysPermissionTab model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Tz888.Model.dp.SysPermissionTab();
                    if (dt.Rows[n]["SPID"].ToString() != "")
                    {
                        model.SPID = int.Parse(dt.Rows[n]["SPID"].ToString());
                    }
                    if (dt.Rows[n]["RoleID"].ToString() != "")
                    {
                        model.RoleID = int.Parse(dt.Rows[n]["RoleID"].ToString());
                    }
                    if (dt.Rows[n]["SysID"].ToString() != "")
                    {
                        model.SysID = int.Parse(dt.Rows[n]["SysID"].ToString());
                    }
                    model.SPCode = dt.Rows[n]["SPCode"].ToString();
                    if (dt.Rows[n]["SPDate"].ToString() != "")
                    {
                        model.SPDate = DateTime.Parse(dt.Rows[n]["SPDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
    protected string GetIFCheck(object SId)
    {
        string check = "";

        modelpER = sysBll.GetModel1(int.Parse(Request.QueryString["SRoleID"].ToString()));//获取角色的权限ID
        if (modelpER != null)
        {
            string   funcstr = modelpER.SPCode.ToString();
            string[] fun     = funcstr.Split(',');
            for (int i = 0; i < fun.Length; i++)
            {
                if (SId.ToString().Equals(fun[i]))
                {
                    check = "checked='checked'";
                    break;
                }
            }
        }
        return(check);
    }
Exemple #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Tz888.Model.dp.SysPermissionTab model)
 {
     return(dal.Update(model));
 }
Exemple #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tz888.Model.dp.SysPermissionTab model)
 {
     return(dal.Add(model));
 }
Exemple #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["SRoleID"] != "" && Request.QueryString["SRoleID"] != null)
         {
             roleID           = Convert.ToInt32(Request.QueryString["SRoleID"].ToString());
             roleModel        = roleBll.GetModel(roleID);
             lblUserPriv.Text = roleModel.SRName.ToString();
             DataSet ds1 = new DataSet();
             ds1       = GetDataList();
             MenuCount = ds1.Tables[0].Rows.Count;
             //int SParentCode = 0;
             //MenuCount = bll.GetList().Count;
             DataRow[] dr1 = ds1.Tables[0].Select("SParentCode=0");
             DataSet   ds2 = new DataSet();
             ds2 = ds1.Clone();
             ds2.Merge(dr1);
             //rptMain.DataSource = bll.GetList(SParentCode, "desc");//第一级菜单
             rptMain.DataSource = ds2;
             rptMain.DataBind();
             ds2.Dispose();
             ds2 = null;
             ds1.Dispose();
             ds1 = null;
         }
         else
         {
             Response.Redirect("Role.aspx");
         }
     }
     else
     {
         string funstr = lblFuncIdStr.Value;
         string fun    = "";
         if (funstr.EndsWith(","))
         {
             fun = funstr.Substring(0, funstr.Length - 1);
         }
         else
         {
             fun = funstr;
         }
         modelpER = sysBll.GetModel1(int.Parse(Request.QueryString["SRoleID"].ToString()));
         if (modelpER != null)
         {
             modelpER.SPCode = fun;
             if (sysBll.Update(modelpER))
             {
                 Response.Write("<script>alert('权限编辑成功');location.href='Role.aspx';</script>");
             }
         }
         else
         {
             Tz888.Model.dp.SysPermissionTab modelpER1 = new Tz888.Model.dp.SysPermissionTab();
             int roleid = int.Parse(Request.QueryString["SRoleID"].ToString());
             modelpER1.RoleID = roleid;
             modelpER1.SPCode = fun;
             modelpER1.SPDate = DateTime.Now;
             if (sysBll.Add(modelpER1) > 0)
             {
                 Response.Write("<script>alert('权限编辑成功');location.href='Role.aspx';</script>");
             }
         }
     }
 }