From 90c2b7629fe135ecbd5963de2176e3b7d79c9ed4 Mon Sep 17 00:00:00 2001 From: kougyokugentou <41278462+kougyokugentou@users.noreply.github.com> Date: Tue, 19 May 2020 21:43:38 -0700 Subject: [PATCH] Implement the school editor (actually school adder) --- DBWizard.csproj | 10 + Form1.Designer.cs | 275 ++++++++---------- Form1.cs | 38 ++- Form1.resx | 30 +- .../DBWizard.Models.School.datasource | 10 + SchoolEditor.Designer.cs | 104 +++++++ SchoolEditor.cs | 71 +++++ SchoolEditor.resx | 204 +++++++++++++ 8 files changed, 577 insertions(+), 165 deletions(-) create mode 100644 Properties/DataSources/DBWizard.Models.School.datasource create mode 100644 SchoolEditor.Designer.cs create mode 100644 SchoolEditor.cs create mode 100644 SchoolEditor.resx diff --git a/DBWizard.csproj b/DBWizard.csproj index f14511e..e1f33c8 100644 --- a/DBWizard.csproj +++ b/DBWizard.csproj @@ -127,8 +127,18 @@ + + Form + + + SchoolEditor.cs + + + SchoolEditor.cs + + Form1.cs diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 9927a47..88248cb 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -51,10 +51,12 @@ this.exportAllDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitWithoutSavingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitsavesDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.schoolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.schoolEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.studentDbID = new System.Windows.Forms.NumericUpDown(); this.parentDbID = new System.Windows.Forms.NumericUpDown(); - this.student_pictureBox = new System.Windows.Forms.PictureBox(); this.lastNameTextBox = new System.Windows.Forms.TextBox(); + this.studentBindingSource = new System.Windows.Forms.BindingSource(this.components); this.firstNameTextBox = new System.Windows.Forms.TextBox(); this.student_idTextBox = new System.Windows.Forms.TextBox(); this.dob_dateTimePicker = new System.Windows.Forms.DateTimePicker(); @@ -79,7 +81,7 @@ this.foundStudents_comboBox = new System.Windows.Forms.ComboBox(); this.lblFoundStudents = new System.Windows.Forms.Label(); this.saveFileDialogReport = new System.Windows.Forms.SaveFileDialog(); - this.studentBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.student_pictureBox = new System.Windows.Forms.PictureBox(); lastNameLabel = new System.Windows.Forms.Label(); firstNameLabel = new System.Windows.Forms.Label(); student_idLabel = new System.Windows.Forms.Label(); @@ -97,11 +99,11 @@ this.mainMenuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.studentDbID)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.parentDbID)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.student_pictureBox)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.studentBindingSource)).BeginInit(); this.parent_groupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.phoneNumberNumericUpDown)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.studentBindingSource)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.student_pictureBox)).BeginInit(); this.SuspendLayout(); // // lastNameLabel @@ -110,10 +112,9 @@ lastNameLabel.AutoSize = true; lastNameLabel.BackColor = System.Drawing.Color.Transparent; lastNameLabel.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - lastNameLabel.Location = new System.Drawing.Point(750, 130); - lastNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lastNameLabel.Location = new System.Drawing.Point(562, 104); lastNameLabel.Name = "lastNameLabel"; - lastNameLabel.Size = new System.Drawing.Size(147, 42); + lastNameLabel.Size = new System.Drawing.Size(113, 32); lastNameLabel.TabIndex = 3; lastNameLabel.Text = "Last Name:"; // @@ -123,10 +124,9 @@ firstNameLabel.AutoSize = true; firstNameLabel.BackColor = System.Drawing.Color.Transparent; firstNameLabel.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - firstNameLabel.Location = new System.Drawing.Point(440, 130); - firstNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + firstNameLabel.Location = new System.Drawing.Point(330, 104); firstNameLabel.Name = "firstNameLabel"; - firstNameLabel.Size = new System.Drawing.Size(151, 42); + firstNameLabel.Size = new System.Drawing.Size(117, 32); firstNameLabel.TabIndex = 4; firstNameLabel.Text = "First Name:"; // @@ -136,10 +136,9 @@ student_idLabel.AutoSize = true; student_idLabel.BackColor = System.Drawing.Color.Transparent; student_idLabel.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - student_idLabel.Location = new System.Drawing.Point(118, 400); - student_idLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + student_idLabel.Location = new System.Drawing.Point(88, 320); student_idLabel.Name = "student_idLabel"; - student_idLabel.Size = new System.Drawing.Size(148, 42); + student_idLabel.Size = new System.Drawing.Size(114, 32); student_idLabel.TabIndex = 6; student_idLabel.Text = "Student ID:"; // @@ -149,10 +148,9 @@ dOBLabel.AutoSize = true; dOBLabel.BackColor = System.Drawing.Color.Transparent; dOBLabel.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dOBLabel.Location = new System.Drawing.Point(440, 236); - dOBLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + dOBLabel.Location = new System.Drawing.Point(330, 189); dOBLabel.Name = "dOBLabel"; - dOBLabel.Size = new System.Drawing.Size(78, 42); + dOBLabel.Size = new System.Drawing.Size(61, 32); dOBLabel.TabIndex = 8; dOBLabel.Text = "DOB:"; // @@ -162,10 +160,9 @@ programNameLabel.AutoSize = true; programNameLabel.BackColor = System.Drawing.Color.Transparent; programNameLabel.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - programNameLabel.Location = new System.Drawing.Point(750, 236); - programNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + programNameLabel.Location = new System.Drawing.Point(562, 189); programNameLabel.Name = "programNameLabel"; - programNameLabel.Size = new System.Drawing.Size(126, 42); + programNameLabel.Size = new System.Drawing.Size(95, 32); programNameLabel.TabIndex = 10; programNameLabel.Text = "Program:"; // @@ -175,10 +172,9 @@ addressLabel.AutoSize = true; addressLabel.BackColor = System.Drawing.Color.Transparent; addressLabel.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - addressLabel.Location = new System.Drawing.Point(440, 490); - addressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + addressLabel.Location = new System.Drawing.Point(330, 392); addressLabel.Name = "addressLabel"; - addressLabel.Size = new System.Drawing.Size(115, 42); + addressLabel.Size = new System.Drawing.Size(90, 32); addressLabel.TabIndex = 12; addressLabel.Text = "Address:"; // @@ -188,10 +184,9 @@ schoolLabel.AutoSize = true; schoolLabel.BackColor = System.Drawing.Color.Transparent; schoolLabel.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - schoolLabel.Location = new System.Drawing.Point(750, 358); - schoolLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + schoolLabel.Location = new System.Drawing.Point(562, 286); schoolLabel.Name = "schoolLabel"; - schoolLabel.Size = new System.Drawing.Size(102, 42); + schoolLabel.Size = new System.Drawing.Size(77, 32); schoolLabel.TabIndex = 14; schoolLabel.Text = "School:"; // @@ -201,10 +196,9 @@ genderLabel.AutoSize = true; genderLabel.BackColor = System.Drawing.Color.Transparent; genderLabel.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - genderLabel.Location = new System.Drawing.Point(439, 358); - genderLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + genderLabel.Location = new System.Drawing.Point(329, 286); genderLabel.Name = "genderLabel"; - genderLabel.Size = new System.Drawing.Size(108, 42); + genderLabel.Size = new System.Drawing.Size(84, 32); genderLabel.TabIndex = 16; genderLabel.Text = "Gender:"; // @@ -214,10 +208,9 @@ gradeLevelLabel.AutoSize = true; gradeLevelLabel.BackColor = System.Drawing.Color.Transparent; gradeLevelLabel.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - gradeLevelLabel.Location = new System.Drawing.Point(750, 490); - gradeLevelLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + gradeLevelLabel.Location = new System.Drawing.Point(562, 392); gradeLevelLabel.Name = "gradeLevelLabel"; - gradeLevelLabel.Size = new System.Drawing.Size(159, 42); + gradeLevelLabel.Size = new System.Drawing.Size(122, 32); gradeLevelLabel.TabIndex = 18; gradeLevelLabel.Text = "Grade Level:"; // @@ -225,10 +218,9 @@ // lastNameLabel1.AutoSize = true; lastNameLabel1.BackColor = System.Drawing.Color.Transparent; - lastNameLabel1.Location = new System.Drawing.Point(13, 149); - lastNameLabel1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + lastNameLabel1.Location = new System.Drawing.Point(10, 119); lastNameLabel1.Name = "lastNameLabel1"; - lastNameLabel1.Size = new System.Drawing.Size(147, 42); + lastNameLabel1.Size = new System.Drawing.Size(113, 32); lastNameLabel1.TabIndex = 0; lastNameLabel1.Text = "Last Name:"; // @@ -236,10 +228,9 @@ // firstNameLabel1.AutoSize = true; firstNameLabel1.BackColor = System.Drawing.Color.Transparent; - firstNameLabel1.Location = new System.Drawing.Point(13, 70); - firstNameLabel1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + firstNameLabel1.Location = new System.Drawing.Point(10, 56); firstNameLabel1.Name = "firstNameLabel1"; - firstNameLabel1.Size = new System.Drawing.Size(151, 42); + firstNameLabel1.Size = new System.Drawing.Size(117, 32); firstNameLabel1.TabIndex = 2; firstNameLabel1.Text = "First Name:"; // @@ -247,10 +238,9 @@ // phoneNumberLabel.AutoSize = true; phoneNumberLabel.BackColor = System.Drawing.Color.Transparent; - phoneNumberLabel.Location = new System.Drawing.Point(13, 229); - phoneNumberLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + phoneNumberLabel.Location = new System.Drawing.Point(10, 183); phoneNumberLabel.Name = "phoneNumberLabel"; - phoneNumberLabel.Size = new System.Drawing.Size(198, 42); + phoneNumberLabel.Size = new System.Drawing.Size(149, 32); phoneNumberLabel.TabIndex = 4; phoneNumberLabel.Text = "Phone Number:"; // @@ -258,10 +248,9 @@ // emailAddressLabel.AutoSize = true; emailAddressLabel.BackColor = System.Drawing.Color.Transparent; - emailAddressLabel.Location = new System.Drawing.Point(13, 312); - emailAddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + emailAddressLabel.Location = new System.Drawing.Point(10, 250); emailAddressLabel.Name = "emailAddressLabel"; - emailAddressLabel.Size = new System.Drawing.Size(188, 42); + emailAddressLabel.Size = new System.Drawing.Size(145, 32); emailAddressLabel.TabIndex = 6; emailAddressLabel.Text = "Email Address:"; // @@ -269,18 +258,17 @@ // this.topTableLayoutPanel.ColumnCount = 3; this.topTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.topTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 61F)); - this.topTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 67F)); + this.topTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 46F)); + this.topTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F)); this.topTableLayoutPanel.Controls.Add(this.mainMenuStrip, 0, 0); this.topTableLayoutPanel.Controls.Add(this.studentDbID, 1, 0); this.topTableLayoutPanel.Controls.Add(this.parentDbID, 2, 0); this.topTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Top; this.topTableLayoutPanel.Location = new System.Drawing.Point(0, 0); - this.topTableLayoutPanel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.topTableLayoutPanel.Name = "topTableLayoutPanel"; this.topTableLayoutPanel.RowCount = 1; this.topTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.topTableLayoutPanel.Size = new System.Drawing.Size(1759, 44); + this.topTableLayoutPanel.Size = new System.Drawing.Size(1319, 35); this.topTableLayoutPanel.TabIndex = 0; // // mainMenuStrip @@ -291,11 +279,11 @@ this.mainMenuStrip.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2); this.mainMenuStrip.ImageScalingSize = new System.Drawing.Size(24, 24); this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem}); + this.fileToolStripMenuItem, + this.schoolsToolStripMenuItem}); this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); this.mainMenuStrip.Name = "mainMenuStrip"; - this.mainMenuStrip.Padding = new System.Windows.Forms.Padding(8, 2, 0, 2); - this.mainMenuStrip.Size = new System.Drawing.Size(1631, 40); + this.mainMenuStrip.Size = new System.Drawing.Size(1223, 33); this.mainMenuStrip.TabIndex = 0; this.mainMenuStrip.Text = "mainMenuStrip"; // @@ -308,101 +296,101 @@ this.exitWithoutSavingToolStripMenuItem, this.exitsavesDataToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(72, 36); + this.fileToolStripMenuItem.Size = new System.Drawing.Size(54, 29); this.fileToolStripMenuItem.Text = "&File"; // // newStudentToolStripMenuItem // this.newStudentToolStripMenuItem.Name = "newStudentToolStripMenuItem"; - this.newStudentToolStripMenuItem.Size = new System.Drawing.Size(349, 44); + this.newStudentToolStripMenuItem.Size = new System.Drawing.Size(262, 34); this.newStudentToolStripMenuItem.Text = "&New Student"; this.newStudentToolStripMenuItem.Click += new System.EventHandler(this.clear_button_Click); // // saveStudentToolStripMenuItem // this.saveStudentToolStripMenuItem.Name = "saveStudentToolStripMenuItem"; - this.saveStudentToolStripMenuItem.Size = new System.Drawing.Size(349, 44); + this.saveStudentToolStripMenuItem.Size = new System.Drawing.Size(262, 34); this.saveStudentToolStripMenuItem.Text = "&Save Student"; this.saveStudentToolStripMenuItem.Click += new System.EventHandler(this.save_button_Click); // // exportAllDataToolStripMenuItem // this.exportAllDataToolStripMenuItem.Name = "exportAllDataToolStripMenuItem"; - this.exportAllDataToolStripMenuItem.Size = new System.Drawing.Size(349, 44); + this.exportAllDataToolStripMenuItem.Size = new System.Drawing.Size(262, 34); this.exportAllDataToolStripMenuItem.Text = "Export All Data"; this.exportAllDataToolStripMenuItem.Click += new System.EventHandler(this.exportAllDataToolStripMenuItem_Click); // // exitWithoutSavingToolStripMenuItem // this.exitWithoutSavingToolStripMenuItem.Name = "exitWithoutSavingToolStripMenuItem"; - this.exitWithoutSavingToolStripMenuItem.Size = new System.Drawing.Size(349, 44); + this.exitWithoutSavingToolStripMenuItem.Size = new System.Drawing.Size(262, 34); this.exitWithoutSavingToolStripMenuItem.Text = "Exit without saving"; this.exitWithoutSavingToolStripMenuItem.Click += new System.EventHandler(this.exitWithoutSavingToolStripMenuItem_Click); // // exitsavesDataToolStripMenuItem // this.exitsavesDataToolStripMenuItem.Name = "exitsavesDataToolStripMenuItem"; - this.exitsavesDataToolStripMenuItem.Size = new System.Drawing.Size(349, 44); + this.exitsavesDataToolStripMenuItem.Size = new System.Drawing.Size(262, 34); this.exitsavesDataToolStripMenuItem.Text = "E&xit (saves data)"; this.exitsavesDataToolStripMenuItem.Click += new System.EventHandler(this.exitsavesDataToolStripMenuItem_Click); // + // schoolsToolStripMenuItem + // + this.schoolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.schoolEditorToolStripMenuItem}); + this.schoolsToolStripMenuItem.Name = "schoolsToolStripMenuItem"; + this.schoolsToolStripMenuItem.Size = new System.Drawing.Size(90, 29); + this.schoolsToolStripMenuItem.Text = "Schools"; + // + // schoolEditorToolStripMenuItem + // + this.schoolEditorToolStripMenuItem.Name = "schoolEditorToolStripMenuItem"; + this.schoolEditorToolStripMenuItem.Size = new System.Drawing.Size(220, 34); + this.schoolEditorToolStripMenuItem.Text = "School Editor"; + this.schoolEditorToolStripMenuItem.Click += new System.EventHandler(this.schoolEditorToolStripMenuItem_Click); + // // studentDbID // this.studentDbID.Font = new System.Drawing.Font("Sitka Display", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.studentDbID.Location = new System.Drawing.Point(1635, 4); - this.studentDbID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.studentDbID.Location = new System.Drawing.Point(1226, 3); this.studentDbID.Name = "studentDbID"; - this.studentDbID.Size = new System.Drawing.Size(53, 38); + this.studentDbID.Size = new System.Drawing.Size(40, 30); this.studentDbID.TabIndex = 8; this.studentDbID.TabStop = false; this.studentDbID.Visible = false; // // parentDbID // - this.parentDbID.Location = new System.Drawing.Point(1696, 4); - this.parentDbID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.parentDbID.Location = new System.Drawing.Point(1272, 3); this.parentDbID.Name = "parentDbID"; - this.parentDbID.Size = new System.Drawing.Size(59, 31); + this.parentDbID.Size = new System.Drawing.Size(44, 26); this.parentDbID.TabIndex = 29; this.parentDbID.TabStop = false; this.parentDbID.Visible = false; // - // student_pictureBox - // - this.student_pictureBox.Anchor = System.Windows.Forms.AnchorStyles.None; - this.student_pictureBox.BackColor = System.Drawing.SystemColors.Window; - this.student_pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("student_pictureBox.Image"))); - this.student_pictureBox.Location = new System.Drawing.Point(124, 129); - this.student_pictureBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.student_pictureBox.Name = "student_pictureBox"; - this.student_pictureBox.Size = new System.Drawing.Size(266, 248); - this.student_pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; - this.student_pictureBox.TabIndex = 1; - this.student_pictureBox.TabStop = false; - this.student_pictureBox.Tag = "DefaultImage"; - this.student_pictureBox.DoubleClick += new System.EventHandler(this.student_pictureBox_DoubleClick); - // // lastNameTextBox // this.lastNameTextBox.Anchor = System.Windows.Forms.AnchorStyles.None; this.lastNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.studentBindingSource, "LastName", true)); this.lastNameTextBox.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lastNameTextBox.Location = new System.Drawing.Point(757, 176); - this.lastNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.lastNameTextBox.Location = new System.Drawing.Point(568, 141); this.lastNameTextBox.Name = "lastNameTextBox"; - this.lastNameTextBox.Size = new System.Drawing.Size(221, 44); + this.lastNameTextBox.Size = new System.Drawing.Size(167, 35); this.lastNameTextBox.TabIndex = 1; this.lastNameTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.String_TextBox_Validating); // + // studentBindingSource + // + this.studentBindingSource.DataSource = typeof(DBWizard.Models.Student); + // // firstNameTextBox // this.firstNameTextBox.Anchor = System.Windows.Forms.AnchorStyles.None; this.firstNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.studentBindingSource, "FirstName", true)); this.firstNameTextBox.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.firstNameTextBox.Location = new System.Drawing.Point(446, 176); - this.firstNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.firstNameTextBox.Location = new System.Drawing.Point(334, 141); this.firstNameTextBox.Name = "firstNameTextBox"; - this.firstNameTextBox.Size = new System.Drawing.Size(235, 44); + this.firstNameTextBox.Size = new System.Drawing.Size(177, 35); this.firstNameTextBox.TabIndex = 0; this.firstNameTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.String_TextBox_Validating); // @@ -411,10 +399,9 @@ this.student_idTextBox.Anchor = System.Windows.Forms.AnchorStyles.None; this.student_idTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.studentBindingSource, "student_id", true)); this.student_idTextBox.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.student_idTextBox.Location = new System.Drawing.Point(124, 446); - this.student_idTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.student_idTextBox.Location = new System.Drawing.Point(93, 357); this.student_idTextBox.Name = "student_idTextBox"; - this.student_idTextBox.Size = new System.Drawing.Size(179, 44); + this.student_idTextBox.Size = new System.Drawing.Size(135, 35); this.student_idTextBox.TabIndex = 6; this.student_idTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.student_idTextBox_Validating); // @@ -423,11 +410,10 @@ this.dob_dateTimePicker.Anchor = System.Windows.Forms.AnchorStyles.None; this.dob_dateTimePicker.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.dob_dateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Short; - this.dob_dateTimePicker.Location = new System.Drawing.Point(446, 285); - this.dob_dateTimePicker.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.dob_dateTimePicker.Location = new System.Drawing.Point(334, 228); this.dob_dateTimePicker.MinDate = new System.DateTime(1900, 1, 1, 0, 0, 0, 0); this.dob_dateTimePicker.Name = "dob_dateTimePicker"; - this.dob_dateTimePicker.Size = new System.Drawing.Size(179, 44); + this.dob_dateTimePicker.Size = new System.Drawing.Size(135, 35); this.dob_dateTimePicker.TabIndex = 2; this.dob_dateTimePicker.Validating += new System.ComponentModel.CancelEventHandler(this.dob_dateTimePicker_Validating); // @@ -437,10 +423,9 @@ this.programComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.programComboBox.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.programComboBox.FormattingEnabled = true; - this.programComboBox.Location = new System.Drawing.Point(757, 279); - this.programComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.programComboBox.Location = new System.Drawing.Point(568, 223); this.programComboBox.Name = "programComboBox"; - this.programComboBox.Size = new System.Drawing.Size(235, 50); + this.programComboBox.Size = new System.Drawing.Size(177, 40); this.programComboBox.TabIndex = 3; this.programComboBox.Validating += new System.ComponentModel.CancelEventHandler(this.ComboBox_Validating); // @@ -449,11 +434,10 @@ this.addressTextBox.Anchor = System.Windows.Forms.AnchorStyles.None; this.addressTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.studentBindingSource, "address", true)); this.addressTextBox.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.addressTextBox.Location = new System.Drawing.Point(447, 545); - this.addressTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.addressTextBox.Location = new System.Drawing.Point(335, 436); this.addressTextBox.Multiline = true; this.addressTextBox.Name = "addressTextBox"; - this.addressTextBox.Size = new System.Drawing.Size(221, 82); + this.addressTextBox.Size = new System.Drawing.Size(167, 66); this.addressTextBox.TabIndex = 7; this.addressTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.String_TextBox_Validating); // @@ -464,10 +448,9 @@ this.schoolComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.schoolComboBox.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.schoolComboBox.FormattingEnabled = true; - this.schoolComboBox.Location = new System.Drawing.Point(755, 413); - this.schoolComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.schoolComboBox.Location = new System.Drawing.Point(566, 330); this.schoolComboBox.Name = "schoolComboBox"; - this.schoolComboBox.Size = new System.Drawing.Size(235, 50); + this.schoolComboBox.Size = new System.Drawing.Size(177, 40); this.schoolComboBox.TabIndex = 5; this.schoolComboBox.Validating += new System.ComponentModel.CancelEventHandler(this.ComboBox_Validating); // @@ -481,10 +464,9 @@ this.genderComboBox.Items.AddRange(new object[] { "Male", "Female"}); - this.genderComboBox.Location = new System.Drawing.Point(446, 413); - this.genderComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.genderComboBox.Location = new System.Drawing.Point(334, 330); this.genderComboBox.Name = "genderComboBox"; - this.genderComboBox.Size = new System.Drawing.Size(160, 50); + this.genderComboBox.Size = new System.Drawing.Size(121, 40); this.genderComboBox.TabIndex = 4; this.genderComboBox.Validating += new System.ComponentModel.CancelEventHandler(this.ComboBox_Validating); // @@ -509,10 +491,9 @@ "10", "11", "12"}); - this.gradeLevelComboBox.Location = new System.Drawing.Point(757, 541); - this.gradeLevelComboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.gradeLevelComboBox.Location = new System.Drawing.Point(568, 433); this.gradeLevelComboBox.Name = "gradeLevelComboBox"; - this.gradeLevelComboBox.Size = new System.Drawing.Size(160, 50); + this.gradeLevelComboBox.Size = new System.Drawing.Size(121, 40); this.gradeLevelComboBox.TabIndex = 8; this.gradeLevelComboBox.Validating += new System.ComponentModel.CancelEventHandler(this.ComboBox_Validating); // @@ -521,10 +502,9 @@ this.save_button.Anchor = System.Windows.Forms.AnchorStyles.None; this.save_button.AutoSize = true; this.save_button.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.save_button.Location = new System.Drawing.Point(183, 712); - this.save_button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.save_button.Location = new System.Drawing.Point(137, 570); this.save_button.Name = "save_button"; - this.save_button.Size = new System.Drawing.Size(177, 75); + this.save_button.Size = new System.Drawing.Size(133, 60); this.save_button.TabIndex = 10; this.save_button.Text = "Save"; this.save_button.UseVisualStyleBackColor = true; @@ -545,11 +525,9 @@ this.parent_groupBox.Controls.Add(this.parent_lastNameTextBox); this.parent_groupBox.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.parent_groupBox.ForeColor = System.Drawing.SystemColors.ControlText; - this.parent_groupBox.Location = new System.Drawing.Point(1050, 400); - this.parent_groupBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.parent_groupBox.Location = new System.Drawing.Point(788, 320); this.parent_groupBox.Name = "parent_groupBox"; - this.parent_groupBox.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.parent_groupBox.Size = new System.Drawing.Size(559, 435); + this.parent_groupBox.Size = new System.Drawing.Size(419, 348); this.parent_groupBox.TabIndex = 9; this.parent_groupBox.TabStop = false; this.parent_groupBox.Text = "Parent Information"; @@ -557,10 +535,9 @@ // emailAddressTextBox // this.emailAddressTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.studentBindingSource, "Parent.EmailAddress", true)); - this.emailAddressTextBox.Location = new System.Drawing.Point(251, 312); - this.emailAddressTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.emailAddressTextBox.Location = new System.Drawing.Point(188, 250); this.emailAddressTextBox.Name = "emailAddressTextBox"; - this.emailAddressTextBox.Size = new System.Drawing.Size(228, 44); + this.emailAddressTextBox.Size = new System.Drawing.Size(172, 35); this.emailAddressTextBox.TabIndex = 3; this.toolTips.SetToolTip(this.emailAddressTextBox, "Enter a valid email address with @"); this.emailAddressTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.emailAddressTextBox_Validating); @@ -568,8 +545,7 @@ // phoneNumberNumericUpDown // this.phoneNumberNumericUpDown.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.studentBindingSource, "Parent.PhoneNumber", true)); - this.phoneNumberNumericUpDown.Location = new System.Drawing.Point(250, 227); - this.phoneNumberNumericUpDown.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.phoneNumberNumericUpDown.Location = new System.Drawing.Point(188, 182); this.phoneNumberNumericUpDown.Maximum = new decimal(new int[] { 1410065407, 2, @@ -581,7 +557,7 @@ 0, 0}); this.phoneNumberNumericUpDown.Name = "phoneNumberNumericUpDown"; - this.phoneNumberNumericUpDown.Size = new System.Drawing.Size(229, 44); + this.phoneNumberNumericUpDown.Size = new System.Drawing.Size(172, 35); this.phoneNumberNumericUpDown.TabIndex = 2; this.toolTips.SetToolTip(this.phoneNumberNumericUpDown, "Enter 9 digit phone number with no symbols."); this.phoneNumberNumericUpDown.Value = new decimal(new int[] { @@ -594,20 +570,18 @@ // parent_firstNameTextBox // this.parent_firstNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.studentBindingSource, "Parent.FirstName", true)); - this.parent_firstNameTextBox.Location = new System.Drawing.Point(249, 70); - this.parent_firstNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.parent_firstNameTextBox.Location = new System.Drawing.Point(187, 56); this.parent_firstNameTextBox.Name = "parent_firstNameTextBox"; - this.parent_firstNameTextBox.Size = new System.Drawing.Size(229, 44); + this.parent_firstNameTextBox.Size = new System.Drawing.Size(173, 35); this.parent_firstNameTextBox.TabIndex = 0; this.parent_firstNameTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.String_TextBox_Validating); // // parent_lastNameTextBox // this.parent_lastNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.studentBindingSource, "Parent.LastName", true)); - this.parent_lastNameTextBox.Location = new System.Drawing.Point(249, 146); - this.parent_lastNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.parent_lastNameTextBox.Location = new System.Drawing.Point(187, 117); this.parent_lastNameTextBox.Name = "parent_lastNameTextBox"; - this.parent_lastNameTextBox.Size = new System.Drawing.Size(229, 44); + this.parent_lastNameTextBox.Size = new System.Drawing.Size(173, 35); this.parent_lastNameTextBox.TabIndex = 1; this.parent_lastNameTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.String_TextBox_Validating); // @@ -616,10 +590,9 @@ this.clear_button.Anchor = System.Windows.Forms.AnchorStyles.None; this.clear_button.AutoSize = true; this.clear_button.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.clear_button.Location = new System.Drawing.Point(463, 712); - this.clear_button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.clear_button.Location = new System.Drawing.Point(347, 570); this.clear_button.Name = "clear_button"; - this.clear_button.Size = new System.Drawing.Size(189, 75); + this.clear_button.Size = new System.Drawing.Size(142, 60); this.clear_button.TabIndex = 11; this.clear_button.Text = "Clear form"; this.clear_button.UseVisualStyleBackColor = true; @@ -630,10 +603,9 @@ this.delete_button.Anchor = System.Windows.Forms.AnchorStyles.None; this.delete_button.AutoSize = true; this.delete_button.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.delete_button.Location = new System.Drawing.Point(755, 712); - this.delete_button.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.delete_button.Location = new System.Drawing.Point(566, 570); this.delete_button.Name = "delete_button"; - this.delete_button.Size = new System.Drawing.Size(174, 75); + this.delete_button.Size = new System.Drawing.Size(130, 60); this.delete_button.TabIndex = 12; this.delete_button.Text = "Delete"; this.delete_button.UseVisualStyleBackColor = true; @@ -653,10 +625,9 @@ this.lblSearch.AutoSize = true; this.lblSearch.BackColor = System.Drawing.Color.Transparent; this.lblSearch.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblSearch.Location = new System.Drawing.Point(1074, 130); - this.lblSearch.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblSearch.Location = new System.Drawing.Point(806, 104); this.lblSearch.Name = "lblSearch"; - this.lblSearch.Size = new System.Drawing.Size(360, 42); + this.lblSearch.Size = new System.Drawing.Size(275, 32); this.lblSearch.TabIndex = 24; this.lblSearch.Text = "Search Student by Last Name:"; // @@ -664,10 +635,9 @@ // this.search_textBox.Anchor = System.Windows.Forms.AnchorStyles.None; this.search_textBox.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.search_textBox.Location = new System.Drawing.Point(1079, 176); - this.search_textBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.search_textBox.Location = new System.Drawing.Point(809, 141); this.search_textBox.Name = "search_textBox"; - this.search_textBox.Size = new System.Drawing.Size(377, 44); + this.search_textBox.Size = new System.Drawing.Size(284, 35); this.search_textBox.TabIndex = 13; this.toolTips.SetToolTip(this.search_textBox, "Type last name of student and hit enter"); this.search_textBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.search_textBox_KeyDown); @@ -681,10 +651,9 @@ this.foundStudents_comboBox.Anchor = System.Windows.Forms.AnchorStyles.None; this.foundStudents_comboBox.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.foundStudents_comboBox.FormattingEnabled = true; - this.foundStudents_comboBox.Location = new System.Drawing.Point(1081, 285); - this.foundStudents_comboBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.foundStudents_comboBox.Location = new System.Drawing.Point(811, 228); this.foundStudents_comboBox.Name = "foundStudents_comboBox"; - this.foundStudents_comboBox.Size = new System.Drawing.Size(377, 50); + this.foundStudents_comboBox.Size = new System.Drawing.Size(284, 40); this.foundStudents_comboBox.TabIndex = 14; this.foundStudents_comboBox.SelectionChangeCommitted += new System.EventHandler(this.foundStudents_comboBox_SelectionChangeCommitted); this.foundStudents_comboBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.foundStudents_comboBox_KeyDown); @@ -695,10 +664,9 @@ this.lblFoundStudents.AutoSize = true; this.lblFoundStudents.BackColor = System.Drawing.Color.Transparent; this.lblFoundStudents.Font = new System.Drawing.Font("Sitka Display", 10.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblFoundStudents.Location = new System.Drawing.Point(1074, 236); - this.lblFoundStudents.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblFoundStudents.Location = new System.Drawing.Point(806, 189); this.lblFoundStudents.Name = "lblFoundStudents"; - this.lblFoundStudents.Size = new System.Drawing.Size(203, 42); + this.lblFoundStudents.Size = new System.Drawing.Size(157, 32); this.lblFoundStudents.TabIndex = 28; this.lblFoundStudents.Text = "Found Students:"; // @@ -708,15 +676,25 @@ this.saveFileDialogReport.Filter = "CSV Files|*.csv"; this.saveFileDialogReport.Title = "Save Report"; // - // studentBindingSource + // student_pictureBox // - this.studentBindingSource.DataSource = typeof(DBWizard.Models.Student); + this.student_pictureBox.Anchor = System.Windows.Forms.AnchorStyles.None; + this.student_pictureBox.BackColor = System.Drawing.SystemColors.Window; + this.student_pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("student_pictureBox.Image"))); + this.student_pictureBox.Location = new System.Drawing.Point(93, 103); + this.student_pictureBox.Name = "student_pictureBox"; + this.student_pictureBox.Size = new System.Drawing.Size(200, 198); + this.student_pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.student_pictureBox.TabIndex = 1; + this.student_pictureBox.TabStop = false; + this.student_pictureBox.Tag = "DefaultImage"; + this.student_pictureBox.DoubleClick += new System.EventHandler(this.student_pictureBox_DoubleClick); // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1759, 968); + this.ClientSize = new System.Drawing.Size(1319, 774); this.Controls.Add(this.lblFoundStudents); this.Controls.Add(this.foundStudents_comboBox); this.Controls.Add(this.topTableLayoutPanel); @@ -747,7 +725,6 @@ this.Controls.Add(this.schoolComboBox); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.mainMenuStrip; - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "KentYouthDB"; @@ -758,12 +735,12 @@ this.mainMenuStrip.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.studentDbID)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.parentDbID)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.student_pictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.studentBindingSource)).EndInit(); this.parent_groupBox.ResumeLayout(false); this.parent_groupBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.phoneNumberNumericUpDown)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.studentBindingSource)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.student_pictureBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -808,6 +785,8 @@ private System.Windows.Forms.NumericUpDown parentDbID; private System.Windows.Forms.ToolStripMenuItem exportAllDataToolStripMenuItem; private System.Windows.Forms.SaveFileDialog saveFileDialogReport; + private System.Windows.Forms.ToolStripMenuItem schoolsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem schoolEditorToolStripMenuItem; } } diff --git a/Form1.cs b/Form1.cs index 804f840..7793045 100644 --- a/Form1.cs +++ b/Form1.cs @@ -56,7 +56,18 @@ namespace DBWizard { programComboBox.Items.Add(p.name); } - + + FillSchoolComboBox(); + } + + /* Fills school combo boxes on the form + * with the static data from the sqlite db. + * must be seperated due to schoolEditor. + * input: no input + * output: void + */ + private void FillSchoolComboBox() + { List schools = new List(); schools = SqliteDataAccess.GetSchools(); foreach (School s in schools) @@ -64,7 +75,6 @@ namespace DBWizard schoolComboBox.Items.Add(s.name); } } - /* On click of the picture box, open a file picker dialog box * for the user to browse/choose a picture. * Once the user clicks OK, the _FileOK event below fires, @@ -533,5 +543,29 @@ namespace DBWizard } } + + /* Implement the school editor form window + * and attach our SchoolEditorClosed delegate to the form window + * so the main student form will automatically update/populate + * the school dropdown window with the newly added school. + * INPUT: no args + * OUTPUT: void + */ + private void schoolEditorToolStripMenuItem_Click(object sender, EventArgs e) + { + Form frm2 = new frmSchoolEditor(); + frm2.FormClosed += new FormClosedEventHandler(SchoolEditorClosed); + frm2.Show(); + } + + /* Clear the school combo box and fill it with the newly added school. + * INPUT: no args + * OUTPUT: void + */ + private void SchoolEditorClosed(object sender, FormClosedEventArgs e) + { + schoolComboBox.Items.Clear(); + FillSchoolComboBox(); + } } //Form1 } diff --git a/Form1.resx b/Form1.resx index bb9bed5..fecef7a 100644 --- a/Form1.resx +++ b/Form1.resx @@ -159,6 +159,21 @@ 17, 17 + + 204, 17 + + + 490, 20 + + + 713, 17 + + + 929, 17 + + + 94 + @@ -213,21 +228,6 @@ YII= - - 204, 17 - - - 490, 20 - - - 713, 17 - - - 929, 17 - - - 94 - AAABAAYAAAAAAAEAIACsQgAAZgAAAICAAAABACAAKAgBABJDAABAQAAAAQAgAChCAAA6SwEAMDAAAAEA diff --git a/Properties/DataSources/DBWizard.Models.School.datasource b/Properties/DataSources/DBWizard.Models.School.datasource new file mode 100644 index 0000000..32cc5f2 --- /dev/null +++ b/Properties/DataSources/DBWizard.Models.School.datasource @@ -0,0 +1,10 @@ + + + + DBWizard.Models.School, DBWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/SchoolEditor.Designer.cs b/SchoolEditor.Designer.cs new file mode 100644 index 0000000..bc8db10 --- /dev/null +++ b/SchoolEditor.Designer.cs @@ -0,0 +1,104 @@ +namespace DBWizard +{ + partial class frmSchoolEditor + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.Label schoolNameLabel; + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSchoolEditor)); + this.schoolBindingSource = new System.Windows.Forms.BindingSource(this.components); + this.schoolNameTextBox = new System.Windows.Forms.TextBox(); + this.btnAddSchool = new System.Windows.Forms.Button(); + this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components); + schoolNameLabel = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.schoolBindingSource)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit(); + this.SuspendLayout(); + // + // schoolBindingSource + // + this.schoolBindingSource.DataSource = typeof(DBWizard.Models.School); + // + // schoolNameLabel + // + schoolNameLabel.AutoSize = true; + schoolNameLabel.Location = new System.Drawing.Point(21, 19); + schoolNameLabel.Name = "schoolNameLabel"; + schoolNameLabel.Size = new System.Drawing.Size(186, 20); + schoolNameLabel.TabIndex = 1; + schoolNameLabel.Text = "Enter New School Name:"; + // + // schoolNameTextBox + // + this.schoolNameTextBox.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.schoolBindingSource, "name", true)); + this.schoolNameTextBox.Location = new System.Drawing.Point(25, 54); + this.schoolNameTextBox.Name = "schoolNameTextBox"; + this.schoolNameTextBox.Size = new System.Drawing.Size(182, 26); + this.schoolNameTextBox.TabIndex = 2; + this.schoolNameTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.nameTextBox_Validating); + // + // btnAddSchool + // + this.btnAddSchool.Location = new System.Drawing.Point(263, 26); + this.btnAddSchool.Name = "btnAddSchool"; + this.btnAddSchool.Size = new System.Drawing.Size(81, 54); + this.btnAddSchool.TabIndex = 3; + this.btnAddSchool.Text = "Add School"; + this.btnAddSchool.UseVisualStyleBackColor = true; + this.btnAddSchool.Click += new System.EventHandler(this.btnAddSchool_Click); + // + // errorProvider1 + // + this.errorProvider1.ContainerControl = this; + // + // frmSchoolEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(362, 123); + this.Controls.Add(this.btnAddSchool); + this.Controls.Add(schoolNameLabel); + this.Controls.Add(this.schoolNameTextBox); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "frmSchoolEditor"; + this.Text = "School Editor"; + ((System.ComponentModel.ISupportInitialize)(this.schoolBindingSource)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.BindingSource schoolBindingSource; + private System.Windows.Forms.TextBox schoolNameTextBox; + private System.Windows.Forms.Button btnAddSchool; + private System.Windows.Forms.ErrorProvider errorProvider1; + } +} \ No newline at end of file diff --git a/SchoolEditor.cs b/SchoolEditor.cs new file mode 100644 index 0000000..9088ebe --- /dev/null +++ b/SchoolEditor.cs @@ -0,0 +1,71 @@ +using DBWizard.Models; +using System; +using System.ComponentModel; +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace DBWizard +{ + public partial class frmSchoolEditor : Form + { + public frmSchoolEditor() + { + InitializeComponent(); + } + + /* Ensure the new school textbox has something in it. + * INPUT: no args + * OUTPUT: File to disk. + */ + private void nameTextBox_Validating(object sender, CancelEventArgs e) + { + TextBox tb = (TextBox)sender; + if (!Regex.IsMatch(tb.Text, "[A-Za-z]{2,}")) + errorProvider1.SetError(tb, "Enter a value a-z only of length two or longer."); + else + errorProvider1.SetError(tb, ""); + } + + /* Adds a new school to the SQLite database. + * INPUT: string schoolname + * OUTPUT: New row to sqlite database + */ + + private void btnAddSchool_Click(object sender, EventArgs e) + { + School NewSchool; + SqliteDataAccess SqliteDataAccess2 = new SqliteDataAccess(); + + // validate the form + // Check to see if any control is in error. + foreach (Control c in errorProvider1.ContainerControl.Controls) + { + if (errorProvider1.GetError(c) != "") + { + MessageBox.Show("School not saved due to errors on the form!", "KentYouthDB", MessageBoxButtons.OK, MessageBoxIcon.None); + return; + } + } + + //Check to see if the school is already in the database. + //if so, do not add the school to the DB again. + NewSchool = SqliteDataAccess2.GetSchoolByName(schoolNameTextBox.Text); + if(NewSchool != null) + { + MessageBox.Show("School already exists in the database, not saved.", "KentYouthDB", MessageBoxButtons.OK, MessageBoxIcon.None); + return; + } + + //Create a new school object and collect up the data. + NewSchool = new School(); + NewSchool.name = schoolNameTextBox.Text; + + //insert the new school to the backend db + SqliteDataAccess2.InsertNewSchool(NewSchool); + + //Display a friendly message and cleanup the textbox for any new entry. + MessageBox.Show("School added to the database.", "KentYouthDB", MessageBoxButtons.OK, MessageBoxIcon.None); + schoolNameTextBox.Text = string.Empty; + } + } +} diff --git a/SchoolEditor.resx b/SchoolEditor.resx new file mode 100644 index 0000000..caf11df --- /dev/null +++ b/SchoolEditor.resx @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + False + + + 250, 17 + + + + + AAABAAEAIB8AAAEAIAAkEAAAFgAAACgAAAAgAAAAPgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAD/AAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAD/AAABAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACqVVUDAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAACvII8QsSaHc60ngjuqM3cPry17dq0veFEAAAAAgACAAgAAAACqOWMSrDdkLqo8 + Xh6qQGAYqkBXeKhAVyyoR0wvqEZKeKpLRjOmTUAopUtAWKVQOjClUTRYolMyTQAAAACjXCcno1okW59Y + ICCiXRtCoWEaV4CAAAIAAAAAAAAAALEjiUGwJoeorimDda4sfnWuLHyErjB1i6wsdC4AAAAAAAAAAK04 + aDusOmLFqzxeiAAAAACqQFbArkNXJqdFTV2nRkuOqlU5CaZKQ4alTD3MpEw9VKNSNYKkUTZfAAAAAKNY + LWaiWySHo1wkcqJeGjygXxnBoF8WIwAAAAAAAAAAsySHRrEljFKvKoFDsCuAoa8se5WvLnaVsTF2GgAA + AAAAAAAArDhlVqw5YrisPV+Xs01mCqtAV5u2SVsOmU1NCqdHS5qqSE08ok1EHqVMPcmkTj07o1AzaaRS + NKKhVC1PpFgrWqFZJXWhWiJvoVwciqFeGn+qVQADAAAAAAAAAACzJIpGsSWIia4qgmiuKn+Lri18d60v + dYmvMHUwAAAAAAAAAACtOGZ2rDtjtak7X6SVC0oYpT1TbIAAgAKlRkszpEdEh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