コード例 #1
0
ファイル: EditUsers.aspx.cs プロジェクト: alexan1/marketweb
		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.CarrielUser.RolePermission(Globals.PermissionLevels.EditUsers) != 2)
				{
					btnSubmit.Visible = false;
					btnDelete.Visible = false;
					btnChangePass.Visible = false;
				}
			}
			else
			{
				if (this.CarrielUser.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();
			}
		}
コード例 #2
0
ファイル: EditUsers.aspx.cs プロジェクト: alexan1/marketweb
		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(CarrielUser.CarrielIdentity.MemberID);
				
				DSUsers.tbl_Users.Addtbl_UsersRow(user);
			}
			else
			{
				user.DateModified = DateTime.Now;
				user.ModifiedByAdminID = Convert.ToInt32(CarrielUser.CarrielIdentity.MemberID);
			}

			bpUsers.Update(DSUsers);
		
			Response.Redirect("BrowseUsers.aspx");
		}