Add: Fill gender combo box with enum

Add: Read in child gender from DB using enum
Add: Clear guardian datagridview when guardians are loaded.
This commit is contained in:
kougyokugentou 2021-01-22 20:33:54 -08:00
parent 5b286c4930
commit cffef0547e
2 changed files with 220 additions and 146 deletions

310
frmChildCrud.Designer.cs generated
View File

@ -33,17 +33,21 @@
System.Windows.Forms.Label lastNameLabel; System.Windows.Forms.Label lastNameLabel;
System.Windows.Forms.Label raceLabel; System.Windows.Forms.Label raceLabel;
System.Windows.Forms.Label genderLabel; System.Windows.Forms.Label genderLabel;
System.Windows.Forms.Label addressLabel;
System.Windows.Forms.Label photoLabel; System.Windows.Forms.Label photoLabel;
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmChildCrud)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmChildCrud));
System.Windows.Forms.Label addressLabel;
this.firstNameTextBox = new System.Windows.Forms.TextBox(); this.firstNameTextBox = new System.Windows.Forms.TextBox();
this.childBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.lastNameTextBox = new System.Windows.Forms.TextBox(); this.lastNameTextBox = new System.Windows.Forms.TextBox();
this.raceTextBox = new System.Windows.Forms.TextBox(); this.raceTextBox = new System.Windows.Forms.TextBox();
this.genderComboBox = new System.Windows.Forms.ComboBox(); this.genderComboBox = new System.Windows.Forms.ComboBox();
this.addressTextBox = new System.Windows.Forms.TextBox(); this.addressTextBox = new System.Windows.Forms.TextBox();
this.lblGuardians = new System.Windows.Forms.Label(); this.lblGuardians = new System.Windows.Forms.Label();
this.dgvGuardians = new System.Windows.Forms.DataGridView(); this.dgvGuardians = new System.Windows.Forms.DataGridView();
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.LastName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FirstName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PhoneNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.EmailAddress = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.btnAddGuardian = new System.Windows.Forms.Button(); this.btnAddGuardian = new System.Windows.Forms.Button();
this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.btnEditGuardian = new System.Windows.Forms.Button(); this.btnEditGuardian = new System.Windows.Forms.Button();
@ -54,22 +58,19 @@
this.photoPictureBox = new System.Windows.Forms.PictureBox(); this.photoPictureBox = new System.Windows.Forms.PictureBox();
this.btnCancel = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
this.idNumericUpDown = new System.Windows.Forms.NumericUpDown(); this.idNumericUpDown = new System.Windows.Forms.NumericUpDown();
this.openFileDialogPhotoFromDisk = new System.Windows.Forms.OpenFileDialog();
this.childBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.frmChildCrudBindingSource = new System.Windows.Forms.BindingSource(this.components); this.frmChildCrudBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.LastName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.FirstName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PhoneNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.EmailAddress = new System.Windows.Forms.DataGridViewTextBoxColumn();
firstNameLabel = new System.Windows.Forms.Label(); firstNameLabel = new System.Windows.Forms.Label();
lastNameLabel = new System.Windows.Forms.Label(); lastNameLabel = new System.Windows.Forms.Label();
raceLabel = new System.Windows.Forms.Label(); raceLabel = new System.Windows.Forms.Label();
genderLabel = new System.Windows.Forms.Label(); genderLabel = new System.Windows.Forms.Label();
addressLabel = new System.Windows.Forms.Label();
photoLabel = new System.Windows.Forms.Label(); photoLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.childBindingSource)).BeginInit(); addressLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dgvGuardians)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvGuardians)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.photoPictureBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.photoPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.idNumericUpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.idNumericUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.childBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.frmChildCrudBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.frmChildCrudBindingSource)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -109,19 +110,10 @@
genderLabel.TabIndex = 7; genderLabel.TabIndex = 7;
genderLabel.Text = "gender:"; genderLabel.Text = "gender:";
// //
// addressLabel
//
addressLabel.AutoSize = true;
addressLabel.Location = new System.Drawing.Point(25, 165);
addressLabel.Name = "addressLabel";
addressLabel.Size = new System.Drawing.Size(63, 17);
addressLabel.TabIndex = 9;
addressLabel.Text = "address:";
//
// photoLabel // photoLabel
// //
photoLabel.AutoSize = true; photoLabel.AutoSize = true;
photoLabel.Location = new System.Drawing.Point(545, 19); photoLabel.Location = new System.Drawing.Point(374, 1);
photoLabel.Name = "photoLabel"; photoLabel.Name = "photoLabel";
photoLabel.Size = new System.Drawing.Size(48, 17); photoLabel.Size = new System.Drawing.Size(48, 17);
photoLabel.TabIndex = 21; photoLabel.TabIndex = 21;
@ -135,10 +127,6 @@
this.firstNameTextBox.Size = new System.Drawing.Size(100, 22); this.firstNameTextBox.Size = new System.Drawing.Size(100, 22);
this.firstNameTextBox.TabIndex = 2; this.firstNameTextBox.TabIndex = 2;
// //
// childBindingSource
//
this.childBindingSource.DataSource = typeof(GreatHomeChildcare.Models.Child);
//
// lastNameTextBox // lastNameTextBox
// //
this.lastNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.childBindingSource, "LastName", true)); this.lastNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.childBindingSource, "LastName", true));
@ -176,7 +164,7 @@
// lblGuardians // lblGuardians
// //
this.lblGuardians.AutoSize = true; this.lblGuardians.AutoSize = true;
this.lblGuardians.Location = new System.Drawing.Point(15, 282); this.lblGuardians.Location = new System.Drawing.Point(12, 300);
this.lblGuardians.Name = "lblGuardians"; this.lblGuardians.Name = "lblGuardians";
this.lblGuardians.Size = new System.Drawing.Size(74, 17); this.lblGuardians.Size = new System.Drawing.Size(74, 17);
this.lblGuardians.TabIndex = 11; this.lblGuardians.TabIndex = 11;
@ -193,130 +181,14 @@
this.FirstName, this.FirstName,
this.PhoneNumber, this.PhoneNumber,
this.EmailAddress}); this.EmailAddress});
this.dgvGuardians.Location = new System.Drawing.Point(18, 302); this.dgvGuardians.Location = new System.Drawing.Point(15, 320);
this.dgvGuardians.Name = "dgvGuardians"; this.dgvGuardians.Name = "dgvGuardians";
this.dgvGuardians.ReadOnly = true; this.dgvGuardians.ReadOnly = true;
this.dgvGuardians.RowHeadersWidth = 51; this.dgvGuardians.RowHeadersWidth = 51;
this.dgvGuardians.RowTemplate.Height = 24; this.dgvGuardians.RowTemplate.Height = 24;
this.dgvGuardians.Size = new System.Drawing.Size(450, 106); this.dgvGuardians.Size = new System.Drawing.Size(807, 106);
this.dgvGuardians.TabIndex = 12; this.dgvGuardians.TabIndex = 12;
// //
// btnAddGuardian
//
this.btnAddGuardian.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAddGuardian.ImageKey = "Add_16x.png";
this.btnAddGuardian.ImageList = this.imageList1;
this.btnAddGuardian.Location = new System.Drawing.Point(21, 421);
this.btnAddGuardian.Name = "btnAddGuardian";
this.btnAddGuardian.Size = new System.Drawing.Size(135, 26);
this.btnAddGuardian.TabIndex = 13;
this.btnAddGuardian.Text = "Add Guardian";
this.btnAddGuardian.UseVisualStyleBackColor = true;
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "Add_16x.png");
this.imageList1.Images.SetKeyName(1, "AddButton_16x.png");
this.imageList1.Images.SetKeyName(2, "Address_16x.png");
this.imageList1.Images.SetKeyName(3, "Camera_16x.png");
this.imageList1.Images.SetKeyName(4, "Cancel_16x.png");
this.imageList1.Images.SetKeyName(5, "Close_16x.png");
this.imageList1.Images.SetKeyName(6, "DeleteUser_16x.png");
this.imageList1.Images.SetKeyName(7, "Edit_16x.png");
this.imageList1.Images.SetKeyName(8, "ResultToCSV_16x.png");
this.imageList1.Images.SetKeyName(9, "Save_16x.png");
this.imageList1.Images.SetKeyName(10, "SaveClose_16x.png");
this.imageList1.Images.SetKeyName(11, "SaveFileDialogControl_16x.png");
this.imageList1.Images.SetKeyName(12, "Search_16x.png");
//
// btnEditGuardian
//
this.btnEditGuardian.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnEditGuardian.ImageIndex = 7;
this.btnEditGuardian.ImageList = this.imageList1;
this.btnEditGuardian.Location = new System.Drawing.Point(162, 421);
this.btnEditGuardian.Name = "btnEditGuardian";
this.btnEditGuardian.Size = new System.Drawing.Size(133, 26);
this.btnEditGuardian.TabIndex = 14;
this.btnEditGuardian.Text = "Edit Guardian";
this.btnEditGuardian.UseVisualStyleBackColor = true;
//
// btnDeleteGuardian
//
this.btnDeleteGuardian.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnDeleteGuardian.ImageIndex = 4;
this.btnDeleteGuardian.ImageList = this.imageList1;
this.btnDeleteGuardian.Location = new System.Drawing.Point(323, 421);
this.btnDeleteGuardian.Name = "btnDeleteGuardian";
this.btnDeleteGuardian.Size = new System.Drawing.Size(145, 26);
this.btnDeleteGuardian.TabIndex = 15;
this.btnDeleteGuardian.Text = "Delete Guardian";
this.btnDeleteGuardian.UseVisualStyleBackColor = true;
//
// btnPhotoFromCam
//
this.btnPhotoFromCam.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnPhotoFromCam.Location = new System.Drawing.Point(496, 222);
this.btnPhotoFromCam.Name = "btnPhotoFromCam";
this.btnPhotoFromCam.Size = new System.Drawing.Size(146, 42);
this.btnPhotoFromCam.TabIndex = 18;
this.btnPhotoFromCam.Text = "From Camera";
this.btnPhotoFromCam.UseVisualStyleBackColor = true;
//
// btnPhotoFromDisk
//
this.btnPhotoFromDisk.Location = new System.Drawing.Point(494, 281);
this.btnPhotoFromDisk.Name = "btnPhotoFromDisk";
this.btnPhotoFromDisk.Size = new System.Drawing.Size(147, 41);
this.btnPhotoFromDisk.TabIndex = 19;
this.btnPhotoFromDisk.Text = "From Disk";
this.btnPhotoFromDisk.UseVisualStyleBackColor = true;
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(522, 404);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(100, 43);
this.btnSave.TabIndex = 21;
this.btnSave.Text = "Save && Close";
this.btnSave.UseVisualStyleBackColor = true;
//
// photoPictureBox
//
this.photoPictureBox.DataBindings.Add(new System.Windows.Forms.Binding("Image", this.childBindingSource, "photo", true));
this.photoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("photoPictureBox.Image")));
this.photoPictureBox.Location = new System.Drawing.Point(494, 39);
this.photoPictureBox.Name = "photoPictureBox";
this.photoPictureBox.Size = new System.Drawing.Size(156, 161);
this.photoPictureBox.TabIndex = 22;
this.photoPictureBox.TabStop = false;
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(522, 355);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(100, 43);
this.btnCancel.TabIndex = 23;
this.btnCancel.Text = "Cancel && Close";
this.btnCancel.UseVisualStyleBackColor = true;
//
// idNumericUpDown
//
this.idNumericUpDown.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.childBindingSource, "id", true));
this.idNumericUpDown.Location = new System.Drawing.Point(611, 11);
this.idNumericUpDown.Name = "idNumericUpDown";
this.idNumericUpDown.ReadOnly = true;
this.idNumericUpDown.Size = new System.Drawing.Size(76, 22);
this.idNumericUpDown.TabIndex = 24;
this.idNumericUpDown.TabStop = false;
this.idNumericUpDown.Visible = false;
//
// frmChildCrudBindingSource
//
this.frmChildCrudBindingSource.DataSource = typeof(GreatHomeChildcare.frmChildCrud);
//
// id // id
// //
this.id.HeaderText = "id"; this.id.HeaderText = "id";
@ -358,11 +230,160 @@
this.EmailAddress.ReadOnly = true; this.EmailAddress.ReadOnly = true;
this.EmailAddress.Width = 125; this.EmailAddress.Width = 125;
// //
// btnAddGuardian
//
this.btnAddGuardian.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAddGuardian.ImageKey = "AddButton_16x.png";
this.btnAddGuardian.ImageList = this.imageList1;
this.btnAddGuardian.Location = new System.Drawing.Point(18, 439);
this.btnAddGuardian.Name = "btnAddGuardian";
this.btnAddGuardian.Size = new System.Drawing.Size(168, 26);
this.btnAddGuardian.TabIndex = 13;
this.btnAddGuardian.Text = "Add Guardian";
this.btnAddGuardian.UseVisualStyleBackColor = true;
this.btnAddGuardian.Click += new System.EventHandler(this.btnAddGuardian_Click);
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "AddButton_16x.png");
this.imageList1.Images.SetKeyName(1, "Address_16x.png");
this.imageList1.Images.SetKeyName(2, "Camera_16x.png");
this.imageList1.Images.SetKeyName(3, "Cancel_16x.png");
this.imageList1.Images.SetKeyName(4, "DeleteUser_16x.png");
this.imageList1.Images.SetKeyName(5, "Edit_16x.png");
this.imageList1.Images.SetKeyName(6, "SaveClose_16x.png");
this.imageList1.Images.SetKeyName(7, "OpenfileDialog_16x.png");
//
// btnEditGuardian
//
this.btnEditGuardian.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnEditGuardian.ImageIndex = 5;
this.btnEditGuardian.ImageList = this.imageList1;
this.btnEditGuardian.Location = new System.Drawing.Point(305, 439);
this.btnEditGuardian.Name = "btnEditGuardian";
this.btnEditGuardian.Size = new System.Drawing.Size(185, 26);
this.btnEditGuardian.TabIndex = 14;
this.btnEditGuardian.Text = "Edit Guardian";
this.btnEditGuardian.UseVisualStyleBackColor = true;
this.btnEditGuardian.Click += new System.EventHandler(this.btnEditGuardian_Click);
//
// btnDeleteGuardian
//
this.btnDeleteGuardian.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnDeleteGuardian.ImageIndex = 4;
this.btnDeleteGuardian.ImageList = this.imageList1;
this.btnDeleteGuardian.Location = new System.Drawing.Point(634, 439);
this.btnDeleteGuardian.Name = "btnDeleteGuardian";
this.btnDeleteGuardian.Size = new System.Drawing.Size(175, 26);
this.btnDeleteGuardian.TabIndex = 15;
this.btnDeleteGuardian.Text = "Delete Guardian";
this.btnDeleteGuardian.UseVisualStyleBackColor = true;
this.btnDeleteGuardian.Click += new System.EventHandler(this.btnDeleteGuardian_Click);
//
// btnPhotoFromCam
//
this.btnPhotoFromCam.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnPhotoFromCam.ImageIndex = 2;
this.btnPhotoFromCam.ImageList = this.imageList1;
this.btnPhotoFromCam.Location = new System.Drawing.Point(325, 204);
this.btnPhotoFromCam.Name = "btnPhotoFromCam";
this.btnPhotoFromCam.Size = new System.Drawing.Size(146, 42);
this.btnPhotoFromCam.TabIndex = 18;
this.btnPhotoFromCam.Text = "From Camera";
this.btnPhotoFromCam.UseVisualStyleBackColor = true;
this.btnPhotoFromCam.Click += new System.EventHandler(this.btnPhotoFromCam_Click);
//
// btnPhotoFromDisk
//
this.btnPhotoFromDisk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnPhotoFromDisk.ImageIndex = 7;
this.btnPhotoFromDisk.ImageList = this.imageList1;
this.btnPhotoFromDisk.Location = new System.Drawing.Point(323, 263);
this.btnPhotoFromDisk.Name = "btnPhotoFromDisk";
this.btnPhotoFromDisk.Size = new System.Drawing.Size(147, 41);
this.btnPhotoFromDisk.TabIndex = 19;
this.btnPhotoFromDisk.Text = "From Disk";
this.btnPhotoFromDisk.UseVisualStyleBackColor = true;
this.btnPhotoFromDisk.Click += new System.EventHandler(this.btnPhotoFromDisk_Click);
//
// btnSave
//
this.btnSave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnSave.ImageIndex = 6;
this.btnSave.ImageList = this.imageList1;
this.btnSave.Location = new System.Drawing.Point(675, 61);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(147, 43);
this.btnSave.TabIndex = 21;
this.btnSave.Text = "Save && Close";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// photoPictureBox
//
this.photoPictureBox.DataBindings.Add(new System.Windows.Forms.Binding("Image", this.childBindingSource, "photo", true));
this.photoPictureBox.Image = global::GreatHomeChildcare.Properties.Resources.child;
this.photoPictureBox.Location = new System.Drawing.Point(323, 21);
this.photoPictureBox.Name = "photoPictureBox";
this.photoPictureBox.Size = new System.Drawing.Size(156, 161);
this.photoPictureBox.TabIndex = 22;
this.photoPictureBox.TabStop = false;
//
// btnCancel
//
this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnCancel.ImageIndex = 3;
this.btnCancel.ImageList = this.imageList1;
this.btnCancel.Location = new System.Drawing.Point(675, 12);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(147, 43);
this.btnCancel.TabIndex = 23;
this.btnCancel.Text = "Cancel && Close";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// idNumericUpDown
//
this.idNumericUpDown.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.childBindingSource, "id", true));
this.idNumericUpDown.Location = new System.Drawing.Point(733, 126);
this.idNumericUpDown.Name = "idNumericUpDown";
this.idNumericUpDown.ReadOnly = true;
this.idNumericUpDown.Size = new System.Drawing.Size(76, 22);
this.idNumericUpDown.TabIndex = 24;
this.idNumericUpDown.TabStop = false;
this.idNumericUpDown.Visible = false;
//
// addressLabel
//
addressLabel.AutoSize = true;
addressLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
addressLabel.ImageIndex = 1;
addressLabel.ImageList = this.imageList1;
addressLabel.Location = new System.Drawing.Point(12, 165);
addressLabel.Name = "addressLabel";
addressLabel.Size = new System.Drawing.Size(84, 17);
addressLabel.TabIndex = 9;
addressLabel.Text = " Address:";
//
// openFileDialogPhotoFromDisk
//
this.openFileDialogPhotoFromDisk.FileName = "openFileDialog1";
//
// childBindingSource
//
this.childBindingSource.DataSource = typeof(GreatHomeChildcare.Models.Child);
//
// frmChildCrudBindingSource
//
this.frmChildCrudBindingSource.DataSource = typeof(GreatHomeChildcare.frmChildCrud);
//
// frmChildCrud // frmChildCrud
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(687, 493); this.ClientSize = new System.Drawing.Size(834, 608);
this.Controls.Add(this.idNumericUpDown); this.Controls.Add(this.idNumericUpDown);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
this.Controls.Add(photoLabel); this.Controls.Add(photoLabel);
@ -388,10 +409,10 @@
this.Name = "frmChildCrud"; this.Name = "frmChildCrud";
this.Text = "Child Management : Great Home Childcare"; this.Text = "Child Management : Great Home Childcare";
this.Load += new System.EventHandler(this.frmChildCrud_Load); this.Load += new System.EventHandler(this.frmChildCrud_Load);
((System.ComponentModel.ISupportInitialize)(this.childBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvGuardians)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvGuardians)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.photoPictureBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.photoPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.idNumericUpDown)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.idNumericUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.childBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.frmChildCrudBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.frmChildCrudBindingSource)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -424,5 +445,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn FirstName; private System.Windows.Forms.DataGridViewTextBoxColumn FirstName;
private System.Windows.Forms.DataGridViewTextBoxColumn PhoneNumber; private System.Windows.Forms.DataGridViewTextBoxColumn PhoneNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn EmailAddress; private System.Windows.Forms.DataGridViewTextBoxColumn EmailAddress;
private System.Windows.Forms.OpenFileDialog openFileDialogPhotoFromDisk;
} }
} }

View File

@ -38,6 +38,8 @@ namespace GreatHomeChildcare
*/ */
private void frmChildCrud_Load(object sender, EventArgs e) private void frmChildCrud_Load(object sender, EventArgs e)
{ {
FillGenderComboBox();
int child_id = frmAdminForm.child_id; int child_id = frmAdminForm.child_id;
//If the update button was selected. //If the update button was selected.
@ -47,6 +49,12 @@ namespace GreatHomeChildcare
} }
} }
private void FillGenderComboBox()
{
genderComboBox.Items.Add(Gender.Female);
genderComboBox.Items.Add(Gender.Male);
}
/* Load an existing child onto the form for update/delete operations. /* Load an existing child onto the form for update/delete operations.
* INPUT: integer child_id * INPUT: integer child_id
* OUTPUT: data to screen * OUTPUT: data to screen
@ -54,7 +62,8 @@ namespace GreatHomeChildcare
private void LoadChild(int child_id_in) private void LoadChild(int child_id_in)
{ {
Child child = SqliteDataAccess.GetChildByID(child_id_in); Child child = SqliteDataAccess.GetChildByID(child_id_in);
Gender genderOut;
// sanity check, though it shouldn't be needed... // sanity check, though it shouldn't be needed...
if (child == null) if (child == null)
return; return;
@ -63,7 +72,13 @@ namespace GreatHomeChildcare
idNumericUpDown.Value = child.id; idNumericUpDown.Value = child.id;
firstNameTextBox.Text = child.FirstName; firstNameTextBox.Text = child.FirstName;
lastNameTextBox.Text = child.LastName; lastNameTextBox.Text = child.LastName;
//TODO: Gender via enum raceTextBox.Text = child.race;
//Load the gender combo box based from enum value.
//ref: chuck costarella
Enum.TryParse<Gender>(child.gender, out genderOut);
genderComboBox.SelectedItem = genderOut;
addressTextBox.Text = child.address; addressTextBox.Text = child.address;
photoPictureBox.Image = (child.photo != null) ? ImageWrangler.ByteArrayToImage(child.photo) : Properties.Resources.child; photoPictureBox.Image = (child.photo != null) ? ImageWrangler.ByteArrayToImage(child.photo) : Properties.Resources.child;
LoadGuardiansForChild(child); LoadGuardiansForChild(child);
@ -71,6 +86,8 @@ namespace GreatHomeChildcare
private void LoadGuardiansForChild(Child child_in) private void LoadGuardiansForChild(Child child_in)
{ {
dgvGuardians.Rows.Clear();
List<Guardian> guardians = SqliteDataAccess.GetGuardiansByChild(child_in); List<Guardian> guardians = SqliteDataAccess.GetGuardiansByChild(child_in);
foreach (Guardian g in guardians) foreach (Guardian g in guardians)
@ -78,5 +95,40 @@ namespace GreatHomeChildcare
dgvGuardians.Rows.Add(g.id, g.LastName, g.FirstName, g.PhoneNumber, g.EmailAddress); dgvGuardians.Rows.Add(g.id, g.LastName, g.FirstName, g.PhoneNumber, g.EmailAddress);
} }
} }
private void btnCancel_Click(object sender, EventArgs e)
{
Close();
}
private void btnPhotoFromCam_Click(object sender, EventArgs e)
{
MessageBox.Show("From cam");
}
private void btnPhotoFromDisk_Click(object sender, EventArgs e)
{
MessageBox.Show("From disk");
}
private void btnAddGuardian_Click(object sender, EventArgs e)
{
MessageBox.Show("Add guardian");
}
private void btnEditGuardian_Click(object sender, EventArgs e)
{
MessageBox.Show("Edit Guardian");
}
private void btnDeleteGuardian_Click(object sender, EventArgs e)
{
MessageBox.Show("Delete Guardian");
}
private void btnSave_Click(object sender, EventArgs e)
{
MessageBox.Show("Save and close");
}
} }
} }