Esempio n. 1
0
        /// <summary>
        /// 绑定分组数据
        /// </summary>
        protected void BindGroups()
        {
            BLL.BASE_GROUP Groupbll = new BLL.BASE_GROUP();
            DataSet        ds       = Groupbll.GetGroupList("GroupType=1", "order by GroupOrder asc");

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string s = ds.Tables[0].Rows[i]["GroupName"].ToString();

                GroupList.Items.Add(new ListItem(s, ds.Tables[0].Rows[i]["GroupID"].ToString()));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 数据绑定到表格
        /// </summary>
        protected void RolesLists_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)//判定当前的行是否属于datarow类型的行
            {
                BLL.BASE_GROUP Groupbll = new BLL.BASE_GROUP();
                DataSet        Groups1  = Groupbll.GetGroupList("GroupType=1", "order by GroupOrder asc");
                //当鼠标放上去的时候 先保存当前行的背景颜色 并给附一颜色
                e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#ffffcd',this.style.fontWeight='';");
                //当鼠标离开的时候 将背景颜色还原的以前的颜色
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");

                LinkButton btnDel      = ((LinkButton)e.Row.FindControl("btn_del"));
                Label      Lab_GroupID = ((Label)e.Row.FindControl("Lab_GroupID"));
                Label      hid_GroupID = ((Label)e.Row.FindControl("hid_GroupID"));
                for (int i = 0; i < Groups1.Tables[0].Rows.Count; i++)
                {
                    if (Groups1.Tables[0].Rows[i]["GroupID"].ToString() == hid_GroupID.Text)
                    {
                        Lab_GroupID.Text = Groups1.Tables[0].Rows[i]["GroupName"].ToString();
                    }
                }

                btnDel.Attributes.Add("onclick", "return confirm('您确认要删除该记录吗?')");

                if (!Code.UserHandle.ValidationHandle(Code.Tag.Edit))//是否有编辑权限
                {
                    RolesLists.Columns[5].Visible = false;
                }
                if (!Code.UserHandle.ValidationHandle(Code.Tag.Delete))//是否有删除权限
                {
                    RolesLists.Columns[6].Visible = false;
                }
            }

            if ((e.Row.RowState & DataControlRowState.Edit) != 0)
            {
                BLL.BASE_GROUP Groupbll = new BLL.BASE_GROUP();
                DataSet        Groups2  = Groupbll.GetGroupList("GroupType=1", "order by GroupOrder asc");

                Label        hid_GroupID = ((Label)e.Row.FindControl("hid_GroupID"));
                DropDownList GroupID     = ((DropDownList)e.Row.FindControl("GroupID"));

                for (int i = 0; i < Groups2.Tables[0].Rows.Count; i++)
                {
                    string s = Groups2.Tables[0].Rows[i]["GroupName"].ToString();

                    GroupID.Items.Add(new ListItem(s, Groups2.Tables[0].Rows[i]["GroupID"].ToString()));
                }

                GroupID.SelectedValue = hid_GroupID.Text;
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Msg", "window.parent.changewin();", true);
            strinfo.InnerHtml = "";
            strinfo.Visible   = false;
            if (!IsPostBack)
            {
                if (!Code.SessionBox.CheckUserSession())
                {
                    Response.Redirect("~/Login.aspx");
                }
                else
                {
                    //初始化模块权限
                    Code.UserHandle.InitModule("admin_RolesPage");
                    //是否有浏览权限
                    if (Code.UserHandle.ValidationHandle(Code.Tag.Browse))
                    {
                        if (!Code.UserHandle.ValidationHandle(Code.Tag.Add))
                        {
                            addpanel.Visible = false;
                        }

                        btn_add.Attributes.Add("onclick", "return CheckAdd()");//加入验证
                        //绑定组信息
                        BLL.BASE_GROUP Groupbll = new BLL.BASE_GROUP();
                        GroupList.DataSource     = Groupbll.GetGroupList("GroupType=1", "order by GroupOrder asc");
                        GroupList.DataTextField  = "GroupName";
                        GroupList.DataValueField = "GroupID";
                        GroupList.DataBind();
                        GroupList.Items.Insert(0, new ListItem("全部", "all"));

                        BindOrder();
                    }
                }
            }
        }