Example #1
0
        protected void GV_Users_Roles_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string[]       mKey = e.CommandArgument.ToString().Split('+');
            User_Role_Info info = new User_Role_Info(mKey[0], mKey[1]);

            //Session["UserKey"] = mKey[0];
            if (e.CommandName == "Read")
            {
                if (info.Read)
                {
                    info.Read = false;
                }
                else
                {
                    info.Read = true;
                }
                info.Update();
                LoadData();
            }
            if (e.CommandName == "Add")
            {
                if (info.Add)
                {
                    info.Add = false;
                }
                else
                {
                    info.Add = true;
                }
                info.Update();
                LoadData();
            }
            if (e.CommandName == "Del")
            {
                if (info.Del)
                {
                    info.Del = false;
                }
                else
                {
                    info.Del = true;
                }
                info.Update();
                LoadData();
            }
            if (e.CommandName == "Sua")
            {
                if (info.Edit)
                {
                    info.Edit = false;
                }
                else
                {
                    info.Edit = true;
                }
                info.Update();
                LoadData();
            }
        }
        protected void SaveInfo()
        {
            User_Role_Info info;

            if (txtKey.Text != "0")
            {
                info         = new User_Role_Info(new Guid().ToString());
                info.UserKey = DDLUsers.SelectedValue;
                info.Key     = DDLRoles.SelectedValue;
                info.Update();
            }
            else
            {
                info         = new User_Role_Info(txtKey.Text);
                info.UserKey = DDLUsers.SelectedValue;
                info.Key     = DDLRoles.SelectedValue;
                info.Create();
            }
        }