Added dialog box for entering and updating detailed user information.

This commit is contained in:
Rich 2013-11-20 23:05:01 +00:00
parent eda9858429
commit 9074918e25
2 changed files with 212 additions and 0 deletions

View File

@ -0,0 +1,116 @@
namespace VEPROMS
{
partial class frmManageUser
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pgUser = new System.Windows.Forms.PropertyGrid();
this.btnSave = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// pgUser
//
this.pgUser.Dock = System.Windows.Forms.DockStyle.Fill;
this.pgUser.Location = new System.Drawing.Point(0, 0);
this.pgUser.Name = "pgUser";
this.pgUser.Size = new System.Drawing.Size(624, 386);
this.pgUser.TabIndex = 0;
//
// btnSave
//
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnSave.Location = new System.Drawing.Point(452, 18);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 23);
this.btnSave.TabIndex = 1;
this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(533, 18);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.pgUser);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.btnCancel);
this.splitContainer1.Panel2.Controls.Add(this.btnSave);
this.splitContainer1.Size = new System.Drawing.Size(624, 444);
this.splitContainer1.SplitterDistance = 386;
this.splitContainer1.TabIndex = 3;
//
// frmManageUser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(624, 444);
this.Controls.Add(this.splitContainer1);
this.Name = "frmManageUser";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "frmManageUser";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PropertyGrid pgUser;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.SplitContainer splitContainer1;
}
}

View File

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace VEPROMS
{
public partial class frmManageUser : Form
{
private User _MyUser;
public User MyUser
{
get { return _MyUser; }
set
{
_MyUser = value;
SimpleUser su = new SimpleUser(_MyUser);
pgUser.SelectedObject = su;
}
}
public frmManageUser()
{
InitializeComponent();
}
private void btnSave_Click(object sender, EventArgs e)
{
//_MyUser = pgUser.SelectedObject as User;
//if(_MyUser.UserID.StartsWith("["))
//{
// MessageBox.Show(string.Format("{0} is an invalid UserID",_MyUser.UserID));
// return;
//}
//_MyUser.Save();
//this.DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
//_MyUser = User.Get(_MyUser.UID);
//this.DialogResult = DialogResult.Cancel;
}
}
internal class SimpleUser
{
private User _MyUser;
[Browsable(false)]
public User MyUser
{
get { return _MyUser; }
}
public SimpleUser(User myUser)
{
_MyUser = myUser;
}
public string CourtesyTitle
{
get { return _MyUser.CourtesyTitle; }
set { _MyUser.CourtesyTitle = value; }
}
public string FirstName
{
get { return _MyUser.FirstName; }
set { _MyUser.FirstName = value; }
}
public string MiddleName
{
get { return _MyUser.MiddleName; }
set { _MyUser.MiddleName = value; }
}
public string LastName
{
get { return _MyUser.LastName; }
set { _MyUser.LastName = value; }
}
public string Suffix
{
get { return _MyUser.Suffix; }
set { _MyUser.Suffix = value; }
}
public string PhoneNumber
{
get { return _MyUser.PhoneNumber; }
set { _MyUser.PhoneNumber = value; }
}
public string UserID
{
get { return _MyUser.UserID; }
set { _MyUser.UserID = value; _MyUser.UsrID = value; }
}
}
}