示例#1
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			this.AuthenticatePage(new string[] {Globals.PermissionLevels.EditUsers, Globals.PermissionLevels.AddUsers, Globals.PermissionLevels.ViewUsers});
			if (this.CarrielUser.RolePermission(Globals.PermissionLevels.AddUsers) != 2)
			{
				btnAddUser.Visible = false;
			}

			// Put user code to initialize the page here
			if (IsNewSession)
			{
				AddToListIfAdmin();
				IsNewSession = false;
			}

			if (!Page.IsPostBack)
			{
				BPGroups bp = new BPGroups();
				dsGroups = bp.SelectAllAdminGroups();
				lstGroups.DataBind();
				lstGroups.Items.Insert(0, new ListItem("(All Permission Groups)", "-1"));

				dgUsers.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
				BindDSUsers();
			}		
		}
示例#2
0
		protected void BindGroupsList()
		{
			BPGroups groups = new BPGroups();

			dsGroups = groups.SelectAllAdminGroups();

			dgGroups.DataBind();
		}
		private void dgPermissions_UpdateCommand(object source, DataGridCommandEventArgs e)
		{
			//Cell Index is the index of permissionID
			int permissionID = Convert.ToInt32( e.Item.Cells[0].Text);

			BPGroups bp = new BPGroups();
			DSGroups = bp.SelectGroupPermissionsByGroupID(GroupID);

			BEGroups.tbl_GroupPermissionsRow groupPermission = DSGroups.tbl_GroupPermissions.FindByGroupIDPermissionID(GroupID, permissionID);

			DropDownList lstPermValues = (DropDownList) e.Item.FindControl("lstPermValues");
			groupPermission.GroupPermissionValue = Convert.ToInt16(lstPermValues.SelectedValue);

			bp.UpdateGroupPermissions(DSGroups);

			DSGroups = bp.SelectGroupPermissionsByGroupID(GroupID);

			dgPermissions.EditItemIndex = -1;
			dgPermissions.SelectedIndex = -1;
			dgPermissions.DataBind();
		}
		private void dgPermissions_CancelCommand(object source, DataGridCommandEventArgs e)
		{
			BPGroups bp = new BPGroups();
			DSGroups = bp.SelectGroupPermissionsByGroupID(GroupID);

			dgPermissions.EditItemIndex = -1;
			dgPermissions.SelectedIndex = -1;
			dgPermissions.DataBind();
		}
		private void dgPermissions_ItemCommand(object source, DataGridCommandEventArgs e)
		{
			//if (this.CarrielUser.RolePermission(Globals.PermissionLevels.ManageAdministratorGroups) > 1)
			//{
				BPGroups bp = new BPGroups();
				DSGroups = bp.SelectGroupPermissionsByGroupID(GroupID);
			
				if (e.Item.Cells[0].Text != string.Empty)
				{
					int permissionID = Convert.ToInt32( e.Item.Cells[0].Text);
					if (dgPermissions.EditItemIndex == e.Item.ItemIndex)
					{
						dgPermissions.EditItemIndex = -1;
					}
					else
					{
						dgPermissions.EditItemIndex = e.Item.ItemIndex;
						DSGroups.tbl_PermissionValues.DefaultView.RowFilter = string.Format("PermissionID = {0}", permissionID);
					}
				}

				dgPermissions.DataBind();
			//}
		}
		private void btnDone_Click(object sender, EventArgs e)
		{
			if (_HasChangedUsers )
			{
				BPGroups bpGroups = new BPGroups();
			
				if (_HasChangedUsers )
				{
					DSGroups = bpGroups.SelectGroupPermissionsByGroupID(GroupID);
					ArrayList perms = new ArrayList(PermList);
					perms.Sort();

					//Remove Duplicates
					if (perms.Count > 1)
					{
						int iLast,iCurrent;
						iLast = (int) perms[0];
						for (int i=1; i<perms.Count; i++)
						{
							iCurrent = (int) perms[i];

							if (iCurrent == iLast)
							{
								perms.RemoveAt(i);
							}
							iLast = iCurrent;
						}
					}

					int SearchIndex;
					foreach (BEGroups.tbl_GroupPermissionsRow groupPerm in DSGroups.tbl_GroupPermissions)
					{
						SearchIndex = perms.BinarySearch(groupPerm.PermissionID);
						if (SearchIndex < 0)
							//if (Array.BinarySearch(groupPerm.PermissionID))
						{
							//Not Found
							groupPerm.Delete();
						}
						else
						{
							perms.RemoveAt(SearchIndex);
						}
					}

					foreach (int i in perms)
					{
						BEGroups.tbl_GroupPermissionsRow groupPerm;
						groupPerm = DSGroups.tbl_GroupPermissions.FindByGroupIDPermissionID(GroupID, i);
						if(groupPerm == null)
						{
							groupPerm = DSGroups.tbl_GroupPermissions.Newtbl_GroupPermissionsRow();
							groupPerm.GroupID = GroupID;
							groupPerm.PermissionID = i;
							groupPerm.GroupPermissionValue = 2;
							DSGroups.tbl_GroupPermissions.Addtbl_GroupPermissionsRow(groupPerm);
						}

						//The first value for a permission should always be 1.
						groupPerm.GroupPermissionValue = 2;
					}
				}

				bpGroups.UpdateGroupPermissions(DSGroups);
				DSGroups = bpGroups.SelectGroupPermissionsByGroupID(GroupID);
				dgPermissions.DataBind();
			}
			pnlAssign.Visible = false;
			pnlPermissions.Visible = true;

			tab1.Attributes["class"] = "";
			tab2.Attributes["class"] = "current";
		}
示例#7
0
 public virtual int Update(BEGroups.tbl_SystemAreasDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
示例#8
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     BEGroups ds = new BEGroups();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
		private void ShowGroupUsers()
		{
			pnlUsers.Visible = true;

			if (_HasChangedUsers)
			{
				BPGroups groups = new BPGroups();
				BEGroups.tbl_GroupsRow group;
			
				DSGroups = groups.SelectByIDWithUserGroups(GroupID);
				group = DSGroups.tbl_Groups.FindByGroupID(GroupID);

				groups.Update(DSGroups);
				if (_HasChangedUsers)
				{
					groups.UpdateUsers(group.GroupID, UserGroupsList);
				}
			}
				
			BPUsers bp = new BPUsers();
			DSUsers = bp.SelectByGroupID(GroupID);
			dgUsers.DataBind();
		}
示例#10
0
		protected void BindUserGroups()
		{
			if (UserID > 0)
			{
				BPGroups bp = new BPGroups();
				DSGroups = bp.SelectGroupsByUserID(UserID);
				dgUserGroups.DataBind();
			}	
		}
示例#11
0
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.btnChangePass.Click += new System.EventHandler(this.btnChangePass_Click);
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
			this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);

			this.DSGroups = new BEGroups();
			this.DSUsers = new BEUsers();

			this.DSGroups.DataSetName = "DSGroups";
			this.DSGroups.Locale = new System.Globalization.CultureInfo("en-US");

			this.DSUsers.DataSetName = "DSUsers";
			this.DSUsers.Locale = new System.Globalization.CultureInfo("en-US");

			this.Load += new System.EventHandler(this.Page_Load);

		}
示例#12
0
 public virtual int Update(BEGroups dataSet) {
     return this.Adapter.Update(dataSet, "tbl_GroupPermissions");
 }
示例#13
0
 public virtual int Update(BEGroups.tbl_GroupPermissionsDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
示例#14
0
 public virtual int Fill(BEGroups.tbl_GroupPermissionsDataTable dataTable) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
示例#15
0
 public virtual int Update(BEGroups dataSet) {
     return this.Adapter.Update(dataSet, "tbl_SystemAreas");
 }
		private void btnDelete_Click(object sender, EventArgs e)
		{
			BPGroups bp = new BPGroups();
			BEGroups.tbl_GroupsRow group;
			
			DSGroups = bp.SelectByIDWithUserGroups(GroupID);
			group = DSGroups.tbl_Groups.FindByGroupID(GroupID);

			group.Delete();
			bp.Update(DSGroups);

			//delete any relationships between users and this Group
			BPGroups bpUserGroups = new BPGroups();
			bpUserGroups.DeleteByGroupID(GroupID);

			Response.Redirect("BrowsePermissionGroups.aspx");
		}
		private void Page_Load(object sender, EventArgs e)
		{
			this.AuthenticatePage(new string[] {PermissionLevels.EditPermissionGroups, PermissionLevels.AddPermissionGroups, PermissionLevels.ViewPermissionGroups});
			if (GroupID > 0)
			{
				if (this.CarrielUser.RolePermission(PermissionLevels.EditPermissionGroups) != 2)
				{
					btnSubmit.Visible = false;
					btnDelete.Visible = false;
					lnkAssign.Enabled = false;
					lnkAddUsers.Enabled = false;
				}
			}
			else
			{
				if (this.CarrielUser.RolePermission(PermissionLevels.AddPermissionGroups) != 2)
				{
					btnSubmit.Visible = false;
					btnDelete.Visible = false;
					lnkAssign.Enabled = false;
					lnkAddUsers.Enabled = false;
				}
			}

			if (IsNewSession)
			{
				AddToListIfAdmin();
				IsNewSession = false;
			}
			
			if (!Page.IsPostBack)
			{
				BPGroups bp = new BPGroups();

				if (GroupID != 0)
				{
					//BEGroups.tbl_GroupsRow group;

					DSGroups = bp.SelectByIDWithUserGroups(GroupID);
					//group = DSGroups.tbl_Groups.FindByGroupID(GroupID);
					
					txtGroupName.DataBind();
					txtGroupDescription.DataBind();
					chkActive.DataBind();

					DSGroups = bp.SelectGroupPermissionsByGroupID(GroupID);

					dgPermissions.DataBind();

					ShowAssignPerms();

					ShowGroupUsers();
				}
				else
				{
					lblTitle.Text = "Add Administrator Group";
					btnDelete.Visible = false;
					btnSubmit.Text = "Next >";
					pnlAreaTabs.Visible = false;
					pnlUserTabs.Visible = false;
				}
			}
		}
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.DSGroups = new BEGroups();
			this.DSUsers = new BEUsers();
			//this.DSOwners = new BE_Carriel.BEOwners();
			this.DSGroups.BeginInit();
			this.DSUsers.BeginInit();
			//((System.ComponentModel.ISupportInitialize)(this.DSOwners)).BeginInit();
			this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
			this.btnDelete.Click += new EventHandler(this.btnDelete_Click);
			this.btnSubmit.Click += new EventHandler(this.btnSubmit_Click);
			//this.lnkAssignOwners.Click += new System.EventHandler(this.lnkAssignOwners_Click);
			//this.lnkOwners.Click += new System.EventHandler(this.lnkOwners_Click);
			//this.imgOwnersAllRight.Click += new System.Web.UI.ImageClickEventHandler(this.imgOwnersAllRight_Click);
			//this.imgOwnersRight.Click += new System.Web.UI.ImageClickEventHandler(this.imgOwnersRight_Click);
			//this.imgOwnersLeft.Click += new System.Web.UI.ImageClickEventHandler(this.imgOwnersLeft_Click);
			//this.imgOwnersAllLeft.Click += new System.Web.UI.ImageClickEventHandler(this.imgOwnersAllLeft_Click);
			//this.btnUpdateOwners.Click += new System.EventHandler(this.btnUpdateOwners_Click);
			this.lnkAssign.Click += new EventHandler(this.lnkAssign_Click);
			this.lnkPermissions.Click += new EventHandler(this.lnkPermissions_Click);
			this.dgPermissions.ItemCommand += new DataGridCommandEventHandler(this.dgPermissions_ItemCommand);
			this.dgPermissions.CancelCommand += new DataGridCommandEventHandler(this.dgPermissions_CancelCommand);
			this.dgPermissions.UpdateCommand += new DataGridCommandEventHandler(this.dgPermissions_UpdateCommand);
			this.dgPermissions.ItemDataBound += new DataGridItemEventHandler(this.dgPermissions_ItemDataBound);
			this.btnMoveAllRight.Click += new ImageClickEventHandler(this.btnMoveAllRight_Click);
			this.btnMoveRight.Click += new ImageClickEventHandler(this.btnMoveRight_Click);
			this.btnMoveLeft.Click += new ImageClickEventHandler(this.btnMoveLeft_Click);
			this.btnMoveAllLeft.Click += new ImageClickEventHandler(this.btnMoveAllLeft_Click);
			this.btnDone.Click += new EventHandler(this.btnDone_Click);
			this.lnkAddUsers.Click += new EventHandler(this.lnkAddUsers_Click);
			this.lnkViewUsers.Click += new EventHandler(this.lnkViewUsers_Click);
			this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
			this.btnMoveAllRight2.Click += new ImageClickEventHandler(this.btnMoveAllRight2_Click);
			this.btnMoveRight2.Click += new ImageClickEventHandler(this.btnMoveRight2_Click);
			this.btnMoveLeft2.Click += new ImageClickEventHandler(this.btnMoveLeft2_Click);
			this.btnMoveAllLeft2.Click += new ImageClickEventHandler(this.btnMoveAllLeft2_Click);
			this.btnUpdateUsers.Click += new EventHandler(this.btnUpdateUsers_Click);
			// 
			// DSGroups
			// 
			this.DSGroups.DataSetName = "DSGroups";
			this.DSGroups.Locale = new CultureInfo("en-US");
			// 
			// DSUsers
			// 
			this.DSUsers.DataSetName = "DSUsers";
			this.DSUsers.Locale = new CultureInfo("en-US");
			// 
			// DSOwners
			// 
			//this.DSOwners.DataSetName = "BEOwners";
			//this.DSOwners.Locale = new System.Globalization.CultureInfo("en-US");
			this.Load += new EventHandler(this.Page_Load);
			this.DSGroups.EndInit();
			this.DSUsers.EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.DSOwners)).EndInit();

		}
示例#19
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     BEGroups ds = new BEGroups();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "tbl_GroupsDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
		private void lnkPermissions_Click(object sender, EventArgs e)
		{
			pnlAssign.Visible = false;
			pnlPermissions.Visible = true;

			tab1.Attributes["class"] = "";
			tab2.Attributes["class"] = "current";

			BPGroups bp = new BPGroups();
			DSGroups = bp.SelectByIDWithUserGroups(GroupID);
			DSGroups = bp.SelectGroupPermissionsByGroupID(GroupID);

			dgPermissions.DataBind();
		}
		private void btnSubmit_Click(object sender, EventArgs e)
		{
			BPGroups groups = new BPGroups();
			BEGroups.tbl_GroupsRow group;
			
			DSGroups = groups.SelectByIDWithUserGroups(GroupID);
			group = DSGroups.tbl_Groups.FindByGroupID(GroupID);
			if (GroupID == 0)
			{
				group = DSGroups.tbl_Groups.Newtbl_GroupsRow();
				group.DateCreated = DateTime.Now;
				group.ModifiedByAdminID = 1;
			}
			group.GroupName_ReadOnly = false;
			group.GroupName = txtGroupName.Text;
			group.GroupDescription = txtGroupDescription.Text;
			group.GroupActive = chkActive.Checked;
			group.DateModified = DateTime.Now;

			if(GroupID == 0)
			{
				DSGroups.tbl_Groups.Addtbl_GroupsRow(group);
			}

			groups.Update(DSGroups);
			if (_HasChangedUsers )
			{
				groups.UpdateUsers(group.GroupID, UserGroupsList);
			}
			
			//Cache.Remove("dsAdmins");

			if (GroupID != group.GroupID)
			{
				Response.Redirect("EditPermissionGroups.aspx?GroupID=" + group.GroupID);
			}
			else
			{
				Response.Redirect("BrowsePermissionGroups.aspx");
			}
		}
示例#22
0
 public virtual int Update(BEGroups dataSet) {
     return this.Adapter.Update(dataSet, "tbl_GroupUsers");
 }