Beispiel #1
0
        protected void ToggleInRole_Click(object sender, EventArgs e)
        {
            // Grab text from button and parse, not so elegant, but gets the job done
            Button bt         = (Button)sender;
            string buttonText = bt.Text;

            char[] seps = new char[1];
            seps[0] = ' ';
            string[] buttonTextArray = buttonText.Split(seps);
            string   roleName        = buttonTextArray[5];
            string   userName        = buttonTextArray[2];
            string   whatToDo        = buttonTextArray[0];

            string[] userNameArray = new string[1];
            userNameArray[0] = userName;  // Need to do this because RemoveUserFromRole requires string array.

            if (whatToDo.StartsWith("Qu"))
            {
                // need to remove assignment of this role to this user
                Roles.RemoveUsersFromRole(userNameArray, roleName);
            }
            else
            {
                Roles.AddUserToRole(userName, roleName);
            }
            GridViewRole.DataBind();
        }
Beispiel #2
0
 protected void ButtonCreateNewRole_Click(object sender, EventArgs e)
 {
     if (TextBoxCreateNewRole.Text.Length > 0)
     {
         ObjectDataSourceRoleObject.InsertParameters["RoleName"].DefaultValue = TextBoxCreateNewRole.Text;;
         ObjectDataSourceRoleObject.Insert();
         GridViewRole.DataBind();
         TextBoxCreateNewRole.Text = "";
     }
 }
Beispiel #3
0
        protected void GridViewMembershipUser_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridView gv = (GridView)sender;

            // cover case where there is no current user
            if (Membership.GetUser() != null)
            {
                ObjectDataSourceRoleObject.SelectParameters["UserName"].DefaultValue = Membership.GetUser().UserName;
                ObjectDataSourceRoleObject.SelectParameters["ShowOnlyAssignedRolls"].DefaultValue = "true";
            }

            GridViewRole.DataBind();
        }
Beispiel #4
0
    public void ButtonAddRole_Click(object sender, EventArgs e)
    {
        String roleId     = LabelRoleId.Text;
        String peopleName = DPLPeople.SelectedValue;
        String peopleid   = People.getByName(peopleName).id;
        String roleName   = DPLRole.SelectedValue;
        String sqlstr     = String.Format("INSERT INTO role(id, movie_id, people_id, role) VALUES ('{0:s}', '{1:s}', '{2:s}', '{3:s}')",
                                          roleId, getMovieId(), peopleid, roleName);

        SqlData.getInstance().ExecuteSQL(sqlstr);
        int id = SqlData.getInstance().getMaxId("role") + 1;

        LabelRoleId.Text = id.ToString();
        GridViewRole.DataBind();
    }
Beispiel #5
0
    private void SearchSubmit()
    {
        try
        {
            string               User_ID    = HttpContext.Current.Request.Cookies["User_ID"].Value;
            dbo_UserClass        user_class = dbo_UserDataClass.Select_Record(User_ID);
            List <dbo_RoleClass> item       = new List <dbo_RoleClass>();
            if (user_class.User_Group_ID == "Agent")
            {
                item = dbo_RoleDataClass.Search(string.Empty, string.Empty, "Agent");
            }
            else
            {
                item = dbo_RoleDataClass.Search(string.Empty, string.Empty, string.Empty);
            }

            //List<dbo_RoleClass> item = new List<dbo_RoleClass>();
            //if (ddlRoleType.SelectedIndex == 0)
            //{
            //    item = dbo_RoleDataClass.Search(string.Empty, string.Empty, string.Empty);

            //}
            //else
            //{
            //    item = dbo_RoleDataClass.Search(string.Empty, string.Empty, ddlRoleType.Text);
            //}

            //GridViewRole.ShowFooter = false;

            if (item.Count == 0)
            {
                item.Add(new dbo_RoleClass());
                GridViewRole.DataSource = item;
                GridViewRole.DataBind();
                GridViewRole.Rows[0].Visible = false;
            }
            else
            {
                GridViewRole.DataSource = item;
                GridViewRole.DataBind();
            }
        }
        catch (Exception)
        {
        }
    }
Beispiel #6
0
 protected void GridViewMembership_RowDeleted(object sender, GridViewDeletedEventArgs e)
 {
     FindFirstUserName();     // Current user is deleted so need to select a new user as current
     GridViewRole.DataBind(); // update roll lists to reflect new counts
 }