public AddEmployeeScreen(Screen backScreen) : base("Add Employee", backScreen, 1) { this.Dock = DockStyle.Fill; this.BackColor = Color.White; this.ColumnCount = 2; this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 45F)); this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 55F)); this.RowCount = 7; this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.ParentChanged += AddEmployeeScreen_ParentChanged; Label lblFirstNamePrompt = new Label(); lblFirstNamePrompt.Text = "First Name:"; lblFirstNamePrompt.Dock = DockStyle.None; lblFirstNamePrompt.Anchor = AnchorStyles.Right; lblFirstNamePrompt.TextAlign = ContentAlignment.MiddleRight; lblFirstNamePrompt.AutoSize = true; this.Controls.Add(lblFirstNamePrompt, 0, 1); txtFirstNameInput = new TextBox(); txtFirstNameInput.Anchor = AnchorStyles.Left; txtFirstNameInput.Width = 150; txtFirstNameInput.MaxLength = DBControlHelper.MaximumFirstNameLength; this.Controls.Add(txtFirstNameInput, 1, 1); Label lblLastNamePrompt = new Label(); lblLastNamePrompt.Text = "Last Name:"; lblLastNamePrompt.Dock = DockStyle.None; lblLastNamePrompt.Anchor = AnchorStyles.Right; lblLastNamePrompt.TextAlign = ContentAlignment.MiddleRight; lblLastNamePrompt.AutoSize = true; this.Controls.Add(lblLastNamePrompt, 0, 2); txtLastNameInput = new TextBox(); txtLastNameInput.Anchor = AnchorStyles.Left; txtLastNameInput.Width = 150; txtLastNameInput.MaxLength = DBControlHelper.MaximumLastNameLength; this.Controls.Add(txtLastNameInput, 1, 2); Label lblPhoneNumberPrompt = new Label(); lblPhoneNumberPrompt.Text = "Phone Number:"; lblPhoneNumberPrompt.Dock = DockStyle.None; lblPhoneNumberPrompt.Anchor = AnchorStyles.Right; lblPhoneNumberPrompt.TextAlign = ContentAlignment.MiddleRight; lblPhoneNumberPrompt.AutoSize = true; this.Controls.Add(lblPhoneNumberPrompt, 0, 3); mtxtPhoneNumberInput = new MaskedTextBox(); mtxtPhoneNumberInput.Anchor = AnchorStyles.Left; mtxtPhoneNumberInput.Width = 150; mtxtPhoneNumberInput.Mask = "(000) 000-0000"; mtxtPhoneNumberInput.TabIndex = 5; mtxtPhoneNumberInput.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; this.Controls.Add(mtxtPhoneNumberInput, 1, 3); Label lblRolePrompt = new Label(); lblRolePrompt.Text = "Role:"; lblRolePrompt.Dock = DockStyle.None; lblRolePrompt.Anchor = AnchorStyles.Right; lblRolePrompt.TextAlign = ContentAlignment.MiddleRight; lblRolePrompt.AutoSize = true; this.Controls.Add(lblRolePrompt, 0, 4); cbxRoleInput = new ComboBox(); cbxRoleInput.Anchor = AnchorStyles.Left; cbxRoleInput.Width = 150; cbxRoleInput.DataSource = DBEmployeePosition.GetEmployeePositions(); cbxRoleInput.DisplayMember = "Name"; cbxRoleInput.ValueMember = "ID"; cbxRoleInput.DropDownStyle = ComboBoxStyle.DropDownList; this.Controls.Add(cbxRoleInput, 1, 4); btnAdd = new Button(); btnAdd.Text = "Add"; btnAdd.Dock = DockStyle.None; btnAdd.AutoSize = true; btnAdd.Anchor = AnchorStyles.Left; btnAdd.BackColor = DefaultBackColor; btnAdd.Click += BtnAdd_Click; this.Controls.Add(btnAdd, 1, 5); this.SetFontSizes(this.Controls); }
public UpdateEmployeeScreen(Screen backScreen) : base("Update Employee", backScreen, 1) { //TODO: Consider whether this needs exception handling employeePositions = DBEmployeePosition.GetEmployeePositions(); #region Init Screen this.Dock = DockStyle.Fill; this.BackColor = Color.White; this.ColumnCount = 2; this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 45F)); this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 55F)); this.RowCount = 8; this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.ParentChanged += UpdateEmployeeScreen_ParentChanged; #endregion #region Controls Label lblEmployeeIdPrompt = new Label(); lblEmployeeIdPrompt.Text = "Employee ID:"; lblEmployeeIdPrompt.Dock = DockStyle.None; lblEmployeeIdPrompt.Anchor = AnchorStyles.Right; lblEmployeeIdPrompt.TextAlign = ContentAlignment.MiddleRight; lblEmployeeIdPrompt.AutoSize = true; this.Controls.Add(lblEmployeeIdPrompt, 0, 1); nudEmployeeIdInput = new NumericUpDown(); nudEmployeeIdInput.Anchor = AnchorStyles.Left; nudEmployeeIdInput.Width = 150; nudEmployeeIdInput.ValueChanged += NudEmployeeIdInput_ValueChanged; this.Controls.Add(nudEmployeeIdInput, 1, 1); Label lblFirstNamePrompt = new Label(); lblFirstNamePrompt.Text = "First Name:"; lblFirstNamePrompt.Dock = DockStyle.None; lblFirstNamePrompt.Anchor = AnchorStyles.Right; lblFirstNamePrompt.TextAlign = ContentAlignment.MiddleRight; lblFirstNamePrompt.AutoSize = true; this.Controls.Add(lblFirstNamePrompt, 0, 2); txtFirstNameInput = new TextBox(); txtFirstNameInput.Anchor = AnchorStyles.Left; txtFirstNameInput.Width = 150; txtFirstNameInput.MaxLength = DBControlHelper.MaximumFirstNameLength; this.Controls.Add(txtFirstNameInput, 1, 2); Label lblLastNamePrompt = new Label(); lblLastNamePrompt.Text = "Last Name:"; lblLastNamePrompt.Dock = DockStyle.None; lblLastNamePrompt.Anchor = AnchorStyles.Right; lblLastNamePrompt.TextAlign = ContentAlignment.MiddleRight; lblLastNamePrompt.AutoSize = true; this.Controls.Add(lblLastNamePrompt, 0, 3); txtLastNameInput = new TextBox(); txtLastNameInput.Anchor = AnchorStyles.Left; txtLastNameInput.Width = 150; txtLastNameInput.MaxLength = DBControlHelper.MaximumLastNameLength; this.Controls.Add(txtLastNameInput, 1, 3); Label lblPhoneNumberPrompt = new Label(); lblPhoneNumberPrompt.Text = "Phone Number:"; lblPhoneNumberPrompt.Dock = DockStyle.None; lblPhoneNumberPrompt.Anchor = AnchorStyles.Right; lblPhoneNumberPrompt.TextAlign = ContentAlignment.MiddleRight; lblPhoneNumberPrompt.AutoSize = true; this.Controls.Add(lblPhoneNumberPrompt, 0, 4); mtxtPhoneNumberInput = new MaskedTextBox(); mtxtPhoneNumberInput.Anchor = AnchorStyles.Left; mtxtPhoneNumberInput.Width = 150; mtxtPhoneNumberInput.Mask = "(000) 000-0000"; mtxtPhoneNumberInput.TabIndex = 5; mtxtPhoneNumberInput.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; this.Controls.Add(mtxtPhoneNumberInput, 1, 4); Label lblRolePrompt = new Label(); lblRolePrompt.Text = "Role:"; lblRolePrompt.Dock = DockStyle.None; lblRolePrompt.Anchor = AnchorStyles.Right; lblRolePrompt.TextAlign = ContentAlignment.MiddleRight; lblRolePrompt.AutoSize = true; this.Controls.Add(lblRolePrompt, 0, 5); cbxRoleInput = new ComboBox(); cbxRoleInput.Anchor = AnchorStyles.Left; cbxRoleInput.Width = 150; cbxRoleInput.DataSource = employeePositions; cbxRoleInput.DisplayMember = "Name"; cbxRoleInput.ValueMember = "ID"; cbxRoleInput.DropDownStyle = ComboBoxStyle.DropDownList; this.Controls.Add(cbxRoleInput, 1, 5); btnUpdate = new Button(); btnUpdate.Text = "Update"; btnUpdate.Dock = DockStyle.None; btnUpdate.AutoSize = true; btnUpdate.Anchor = AnchorStyles.Right; btnUpdate.BackColor = DefaultBackColor; btnUpdate.Click += BtnUpdate_Click; this.Controls.Add(btnUpdate, 0, 6); Button btnRemove = new Button(); btnRemove.Text = "Remove from Employee List"; btnRemove.Dock = DockStyle.None; btnRemove.AutoSize = true; btnRemove.Anchor = AnchorStyles.Left; btnRemove.BackColor = DefaultBackColor; btnRemove.Click += BtnRemove_Click; this.Controls.Add(btnRemove, 1, 6); #endregion this.SetFontSizes(this.Controls); }