private void GetFunctionsIDs() { SqlDataReader reader = FunctionConnection.GetFunctionsIds(this.roleId); if (reader.HasRows) { while (reader.Read()) { this.functions.Add(reader.GetInt32(0)); } } reader.Close(); }
public FormAMRole(RoleDAO oneRole, bool isSignUp, Boolean available) { InitializeComponent(); addedFunctions.Clear(); removedFunctions.Clear(); role = oneRole; txt_name.Text = role.Name; txt_name.Enabled = false; if (isSignUp) { chk_enabled.Visible = false; List <FunctionDAO> functions = FunctionConnection.GetFunctions(); foreach (FunctionDAO item in functions) { removedFunctions.Add(item); } lst_functions_not_added.DataSource = removedFunctions; lst_functions_not_added.DisplayMember = "Nombre"; lst_functions_added.DataSource = addedFunctions; lst_functions_added.DisplayMember = "Nombre"; } else { if (available) { chk_enabled.Checked = true; } else { chk_enabled.Checked = false; } List <FunctionDAO> fadd = FunctionConnection.GetFunctionsForRole(role.Id); foreach (FunctionDAO item in fadd) { addedFunctions.Add(item); } lst_functions_added.DataSource = addedFunctions; lst_functions_added.DisplayMember = "Nombre"; List <FunctionDAO> fNotadd = FunctionConnection.GetFunctionsNotAssignedForRole(role.Id); foreach (FunctionDAO item in fNotadd) { removedFunctions.Add(item); } lst_functions_not_added.DataSource = removedFunctions; lst_functions_not_added.DisplayMember = "Nombre"; } }