Beispiel #1
0
		public BEUsers SelectByID(int UserID)
		{
			DAUsers da = new DAUsers();
			BEUsers ds = new BEUsers();

			da.SelectByID(UserID.ToString(),ds.tbl_Users);

			return ds;
		}
Beispiel #2
0
		public BEUsers SelectByLastName(string SearchString)
		{
			DAUsers da = new DAUsers();
			BEUsers ds = new BEUsers();

			da.SelectByLastName(SearchString, ds.tbl_Users);

			return ds;
		}
Beispiel #3
0
		public BEUsers SelectByGroupID(int GroupID)
		{
			DAUsers da = new DAUsers();
			BEUsers ds = new BEUsers();

			da.SelectByGroupID(GroupID, ds.tbl_Users);

			return ds;
		}
Beispiel #4
0
		public BEUsers SelectAllAdministrators()
		{
			DAUsers da = new DAUsers();
			BEUsers ds = new BEUsers();

			ds.EnforceConstraints = false;
			da.SelectAllAdministrators(ds.tbl_Users);

			return ds;
		}
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			// Put user code to initialize the page here
			//this.AuthenticatePage(Globals.PermissionLevels.ManageAdministrators);
			//if (this.CimsUser.RolePermission(Globals.PermissionLevels.ManageAdministrators) < 2)
			//{
				
			//}

			if (IsNewSession)
			{
				AddToListIfAdmin();
				IsNewSession = false;
			}

			if (!Page.IsPostBack)
			{
				BPUsers bp = new BPUsers();
				DSUsers = bp.SelectByID(UserID);

				DataBind();
			}
		}
Beispiel #6
0
		private void btnSubmit_Click(object sender, System.EventArgs e)
		{
			BPUsers bpUsers = new BPUsers();
			BEUsers.tbl_UsersRow user;
			if (UserID == 0)
			{
				// Add a user
				user = DSUsers.tbl_Users.Newtbl_UsersRow();
			}
			else
			{
				// Edit a user
				DSUsers = bpUsers.SelectByID(UserID);
				user = DSUsers.tbl_Users.FindByUserID(UserID);				
			}

			this.Save(user);

			DSUsers.EnforceConstraints = false;
			user.UserActive = chkActive.Checked;
			
			if (UserID == 0)
			{
				user.DateCreated = DateTime.Now;
				user.DateModified = DateTime.Now;
				user.ModifiedByAdminID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID);
				
				DSUsers.tbl_Users.Addtbl_UsersRow(user);
			}
			else
			{
				user.DateModified = DateTime.Now;
				user.ModifiedByAdminID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID);
			}

			bpUsers.Update(DSUsers);
		
			Response.Redirect("BrowseUsers.aspx");
		}
Beispiel #7
0
		public void Save(BEUsers.tbl_UsersRow saveUser)
		{
			TextInfo ti = new CultureInfo("en-US", false).TextInfo;
//
			saveUser.UserFirstName = ti.ToTitleCase(txtFirstName.Text);
			saveUser.UserLastName = ti.ToTitleCase(txtLastName.Text);
			saveUser.UserActive = chkActive.Checked;
			saveUser.UserEmail = txtEmail.Text;
		
			if(UserID == 0)
			{
				//TODO: Create GetLoginID()
				saveUser.Password = "";
				saveUser.LoginID = saveUser.UserFirstName.Substring(0, 1) + saveUser.UserLastName;
			}
		}
Beispiel #8
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);

		}
Beispiel #9
0
		public BEUsers SelectByIDWithUserGroups(int UserID)
		{
			DAUsers da = new DAUsers();
			DAUserGroups daUserGroups = new DAUserGroups();
			DAGroups daGroups = new DAGroups();

			BEUsers ds = new BEUsers();

			da.SelectByID(UserID.ToString(),ds.tbl_Users);
			daGroups.SelectGroupsByUserID(UserID, ds.tbl_Groups);
			daUserGroups.SelectByID(UserID.ToString(), ds.tbl_UserGroups);

			return ds;
		}
		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();
		}
Beispiel #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.DSUsers = new Oryx_BE.BEUsers();
			((System.ComponentModel.ISupportInitialize)(this.DSUsers)).BeginInit();
			this.btnAddUser.Click += new System.EventHandler(this.btnAddUser_Click);
			this.lstGroups.SelectedIndexChanged += new System.EventHandler(this.lstGroups_SelectedIndexChanged);
			this.dgUsers.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgUsers_ItemCommand);
			// 
			// DSUsers
			// 
			this.DSUsers.DataSetName = "DSUsers";
			this.DSUsers.Locale = new System.Globalization.CultureInfo("en-US");
			this.Load += new System.EventHandler(this.Page_Load);
			((System.ComponentModel.ISupportInitialize)(this.DSUsers)).EndInit();

		}
Beispiel #12
0
		public void Update(BEUsers dsUsers)
		{
			DAUsers da = new DAUsers();

			da.Update(dsUsers.tbl_Users);
		}
		private void btnSearch_Click(object sender, EventArgs e)
		{		
			BPUsers users = new BPUsers();
			if(ddlSearchBy.SelectedValue == "firstNames")
			{
				DSUsers = users.SelectByFirstName(txtSearch.Text);
			}
			else //if (ddlSearchBy.SelectedValue == "lastNames")
			{
				DSUsers = users.SelectByLastName(txtSearch.Text);
			}

			FillSearchResults(DSUsers);
		}
		/// <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_Oryx.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();

		}
		private void GetSelectedItems()
		{
			lstSelectedUserItems.Items.Clear();

			if (GroupID != 0)
			{
				MyListViewItem listItem;

				BPUsers bp = new BPUsers();
				BEUsers ds = new BEUsers();
				ds = bp.SelectByGroupID(GroupID);

				foreach (BEUsers.tbl_UsersRow user in ds.tbl_Users)
				{
					listItem = lstSelectedUserItems.Items.Add();
					listItem.CheckBox = true;
					listItem.ItemValue = user.UserID.ToString();
					listItem.Text = user.UserFullName;
				}
			}
		}
		private void FillSearchResults(BEUsers ds)
		{
			lstSearchUserResults.Items.Clear();
			MyListViewItem listItem;

			int count = 0;

			lblErr.Text = string.Empty;
			foreach (BEUsers.tbl_UsersRow user in ds.tbl_Users)
			{
				listItem = lstSearchUserResults.Items.Add();
				listItem.CheckBox = true;
				listItem.ItemValue = user.UserID.ToString();
				listItem.Text = user.UserFullName;

				count++;
				if (count > 100)
				{
					lblErr.Text = "Sorry, list can only hold 100 users, please refine your Search.";
					break;
				}
			}
		}
Beispiel #17
0
		private void btnDelete_Click(object sender, System.EventArgs e)
		{
			BPUsers bp = new BPUsers();
			BEUsers.tbl_UsersRow User;
			
			DSUsers = bp.SelectByID(UserID);
			User = DSUsers.tbl_Users.FindByUserID(UserID);

			User.Delete();
			bp.Update(DSUsers);

			Response.Redirect("BrowseUsers.aspx");
		}
Beispiel #18
0
		private void Page_Load(object sender, System.EventArgs e)
		{
			this.AuthenticatePage(new string[] {Globals.PermissionLevels.EditUsers, Globals.PermissionLevels.AddUsers, Globals.PermissionLevels.ViewUsers});
			if (UserID > 0)
			{
				if (this.OryxUser.RolePermission(Globals.PermissionLevels.EditUsers) != 2)
				{
					btnSubmit.Visible = false;
					btnDelete.Visible = false;
					btnChangePass.Visible = false;
				}
			}
			else
			{
				if (this.OryxUser.RolePermission(Globals.PermissionLevels.AddUsers) != 2)
				{
					btnSubmit.Visible = false;
					btnChangePass.Visible = false;
				}
			}

			if (IsNewSession)
			{
				AddToListIfAdmin();
				IsNewSession = false;
			}
			
			if (!Page.IsPostBack)
			{
				BPUsers bpUsers = new BPUsers();
				if (UserID != 0)
				{
					//edit administrator

					DSUsers = bpUsers.SelectByID(UserID);
					user = DSUsers.tbl_Users.FindByUserID(UserID);

					txtFirstName.Text = user.UserFirstName;
					txtLastName.Text = user.UserLastName;
					chkActive.Checked = user.UserActive;
					txtEmail.Text = user.UserEmail;
					//lblLoginID.Text = user.LoginID;

					lblTitle.Text = "Edit User";

				}
				else
				{
					//add administrator
					btnChangePass.Visible = false;

					lblTitle.Text = "Add User";
				}

				BindUserGroups();
			}
		}
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.DSUsers = new BEUsers();
			((System.ComponentModel.ISupportInitialize)(this.DSUsers)).BeginInit();
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
			// 
			// DSUsers
			// 
			this.DSUsers.DataSetName = "DSUsers";
			this.DSUsers.Locale = new System.Globalization.CultureInfo("en-US");
			this.Load += new System.EventHandler(this.Page_Load);
			((System.ComponentModel.ISupportInitialize)(this.DSUsers)).EndInit();

		}
Beispiel #20
0
		private void BindDSUsers()
		{
			BPUsers bpUsers = new BPUsers();
			if (lstGroups.SelectedValue == "-1")
			{
				DSUsers = bpUsers.SelectAllAdministrators();
			}
			else
			{
				DSUsers = bpUsers.SelectByGroupID(Convert.ToInt32(lstGroups.SelectedValue));
			}

			DSUsers.tbl_Users.DefaultView.RowFilter = RowFilter("UserFullName", "UserActive");

			letters_Bind();
			dgUsers.DataBind();

			SetPagerButtons();
			if (DSUsers.tbl_Users.DefaultView.Count ==  0)
			{
				lblError.Visible = true;
				lblError.Text = "0 Records found.";
			}

			else
			{
				lblError.Visible = false;
				lblError.Text = "";
			}
		}
		private void btnSubmit_Click(object sender, System.EventArgs e)
		{
			BPUsers bp = new BPUsers();
			DSUsers = bp.SelectByID(UserID);

			BEUsers.tbl_UsersRow user = DSUsers.tbl_Users.FindByUserID(UserID);
			user.LoginID = txtLoginName.Text;
			user.Password = txtPassword.Text;

			int testUserID = bp.Login(txtLoginName.Text, txtPassword.Text);

			if (testUserID == 0 || testUserID == UserID)
			{
				bp.Update(DSUsers);
				lblErr.Text = "";
				Response.Redirect(HttpUtility.UrlDecode( Request.QueryString["ReturnUrl"]));
			}
			else
			{
				lblErr.Text = "Sorry username and password taken.";
			}
		}