public void RemoveTabRoles() { if (CurrentTab.TabRoles.Count > 0) { TabRole[] uroles = new TabRole[CurrentTab.TabRoles.Count]; CurrentTab.TabRoles.CopyTo(uroles, 0); CurrentTab.TabRoles.Clear(); _controller.RemoveListOfObjects <TabRole>(uroles); } }
private void SaveTabRole(TabRole tr, SqlTransaction sqltransaction) { string sql = "INSERT INTO TabRole ([TabId] ,[RoleId],[ViewAllowed]) VALUES(@TabId, @RoleId, @ViewAllowed) SELECT @@identity"; using (SqlCommand cm = new SqlCommand(sql, DefaultConnection, sqltransaction)) { SetTabRole(cm, tr); tr.Id = int.Parse(cm.ExecuteScalar().ToString()); } }
private void ReadTabPermissions(SqlDataReader dr, Tab tab) { while (dr.Read()) { TabRole tr = new TabRole { Id = DatabaseHelper.GetInt32("TabRoleId", dr), TabId = tab.Id, ViewAllowed = DatabaseHelper.GetBoolean("ViewAllowed", dr) }; tr.Role = new Role { Id = DatabaseHelper.GetInt32("role_id", dr), Name = DatabaseHelper.GetString("Name", dr), PermissionLevel = DatabaseHelper.GetInt32("PermissionLevel", dr) }; tab.TabRoles.Add(tr); } }
public void SetRoles(Tab tab) { //_presenter.RemoveTabRoles(); foreach (RepeaterItem ri in rptRoles.Items) { CheckBox chkView = (CheckBox)ri.FindControl("chkViewAllowed"); if (chkView.Checked) { if (!tab.Exists(Convert.ToInt32(ViewState[ri.UniqueID]))) { TabRole tabRole = new TabRole(); tabRole.Tab = tab; tabRole.Role = _presenter.GetRole((int)ViewState[ri.UniqueID]); tabRole.ViewAllowed = chkView.Checked; tab.TabRoles.Add(tabRole); } } } }
public void SetRoles(Tab tab) { _presenter.RemoveTabRoles(); foreach (RepeaterItem ri in rptRoles.Items) { CheckBox chkView = (CheckBox)ri.FindControl("chkViewAllowed"); string text = chkView.Text; if (chkView.Checked) { //if (!tab.Exists(Convert.ToInt32(ViewState[ri.UniqueID]))) //{ TabRole np = new TabRole(); np.Tab = tab; np.Role = _presenter.GetRole((int)ViewState[ri.UniqueID]); np.ViewAllowed = chkView.Checked; tab.TabRoles.Add(np); //} } } }
private void SetTabRole(SqlCommand cm, TabRole tr) { DatabaseHelper.InsertInt32Param("@TabId", cm, tr.TabId); DatabaseHelper.InsertInt32Param("@RoleId", cm, tr.Role.Id); DatabaseHelper.InsertBooleanParam("@ViewAllowed", cm, tr.ViewAllowed); }