diff --git a/TimeTable_App/App.config b/TimeTable_App/App.config
index f4360cc..d6e942a 100644
--- a/TimeTable_App/App.config
+++ b/TimeTable_App/App.config
@@ -1,8 +1,8 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/ConsectiveSessionsSubForm.Designer.cs b/TimeTable_App/Forms/SubForms/ConsectiveSessionsSubForm.Designer.cs
new file mode 100644
index 0000000..bfa9c0d
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/ConsectiveSessionsSubForm.Designer.cs
@@ -0,0 +1,218 @@
+namespace TimeTable_App.Forms.SubForms
+{
+ partial class ConsectiveSessionsSubForm
+ {
+ ///
+ /// 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 Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.btnInsert = new System.Windows.Forms.Button();
+ this.btnUpdate = new System.Windows.Forms.Button();
+ this.btnDelete = new System.Windows.Forms.Button();
+ this.btnCansel = new System.Windows.Forms.Button();
+ this.lblCaption = new System.Windows.Forms.Label();
+ this.comboYear = new System.Windows.Forms.ComboBox();
+ this.comboSemester = new System.Windows.Forms.ComboBox();
+ this.comboSub = new System.Windows.Forms.ComboBox();
+ this.gridGroupDetails = new System.Windows.Forms.DataGridView();
+ this.checkBoxLecture = new System.Windows.Forms.CheckBox();
+ this.checkBoxTutorial = new System.Windows.Forms.CheckBox();
+ this.checkBoxLab = new System.Windows.Forms.CheckBox();
+ ((System.ComponentModel.ISupportInitialize)(this.gridGroupDetails)).BeginInit();
+ this.SuspendLayout();
+ //
+ // btnInsert
+ //
+ this.btnInsert.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnInsert.Location = new System.Drawing.Point(763, 79);
+ this.btnInsert.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnInsert.Name = "btnInsert";
+ this.btnInsert.Size = new System.Drawing.Size(105, 26);
+ this.btnInsert.TabIndex = 0;
+ this.btnInsert.Text = "Insert";
+ this.btnInsert.UseVisualStyleBackColor = true;
+ this.btnInsert.Click += new System.EventHandler(this.btnInsert_Click);
+ //
+ // btnUpdate
+ //
+ this.btnUpdate.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnUpdate.Location = new System.Drawing.Point(763, 118);
+ this.btnUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnUpdate.Name = "btnUpdate";
+ this.btnUpdate.Size = new System.Drawing.Size(105, 26);
+ this.btnUpdate.TabIndex = 0;
+ this.btnUpdate.Text = "Update";
+ this.btnUpdate.UseVisualStyleBackColor = true;
+ this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
+ //
+ // btnDelete
+ //
+ this.btnDelete.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnDelete.Location = new System.Drawing.Point(763, 158);
+ this.btnDelete.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnDelete.Name = "btnDelete";
+ this.btnDelete.Size = new System.Drawing.Size(105, 26);
+ this.btnDelete.TabIndex = 0;
+ this.btnDelete.Text = "Delete";
+ this.btnDelete.UseVisualStyleBackColor = true;
+ this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
+ //
+ // btnCansel
+ //
+ this.btnCansel.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnCansel.Location = new System.Drawing.Point(763, 198);
+ this.btnCansel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnCansel.Name = "btnCansel";
+ this.btnCansel.Size = new System.Drawing.Size(105, 26);
+ this.btnCansel.TabIndex = 0;
+ this.btnCansel.Text = "Cancel";
+ this.btnCansel.UseVisualStyleBackColor = true;
+ this.btnCansel.Click += new System.EventHandler(this.btnCansel_Click);
+ //
+ // lblCaption
+ //
+ this.lblCaption.AutoSize = true;
+ this.lblCaption.Font = new System.Drawing.Font("Segoe UI Black", 16.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.lblCaption.Location = new System.Drawing.Point(356, 14);
+ this.lblCaption.Name = "lblCaption";
+ this.lblCaption.Size = new System.Drawing.Size(229, 30);
+ this.lblCaption.TabIndex = 2;
+ this.lblCaption.Text = "Consective Sessions";
+ //
+ // comboYear
+ //
+ this.comboYear.FormattingEnabled = true;
+ this.comboYear.Location = new System.Drawing.Point(60, 79);
+ this.comboYear.Name = "comboYear";
+ this.comboYear.Size = new System.Drawing.Size(307, 23);
+ this.comboYear.TabIndex = 10;
+ this.comboYear.SelectedIndexChanged += new System.EventHandler(this.comboYear_SelectedIndexChanged);
+ //
+ // comboSemester
+ //
+ this.comboSemester.FormattingEnabled = true;
+ this.comboSemester.Location = new System.Drawing.Point(399, 79);
+ this.comboSemester.Name = "comboSemester";
+ this.comboSemester.Size = new System.Drawing.Size(307, 23);
+ this.comboSemester.TabIndex = 11;
+ this.comboSemester.SelectedIndexChanged += new System.EventHandler(this.comboSemester_SelectedIndexChanged);
+ //
+ // comboSub
+ //
+ this.comboSub.FormattingEnabled = true;
+ this.comboSub.Location = new System.Drawing.Point(60, 118);
+ this.comboSub.Name = "comboSub";
+ this.comboSub.Size = new System.Drawing.Size(307, 23);
+ this.comboSub.TabIndex = 10;
+ //
+ // gridGroupDetails
+ //
+ this.gridGroupDetails.AllowUserToAddRows = false;
+ this.gridGroupDetails.AllowUserToDeleteRows = false;
+ this.gridGroupDetails.AllowUserToResizeColumns = false;
+ this.gridGroupDetails.AllowUserToResizeRows = false;
+ this.gridGroupDetails.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
+ this.gridGroupDetails.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.gridGroupDetails.Location = new System.Drawing.Point(60, 270);
+ this.gridGroupDetails.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.gridGroupDetails.Name = "gridGroupDetails";
+ this.gridGroupDetails.ReadOnly = true;
+ this.gridGroupDetails.RowHeadersWidth = 51;
+ this.gridGroupDetails.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.gridGroupDetails.Size = new System.Drawing.Size(808, 141);
+ this.gridGroupDetails.TabIndex = 9;
+ this.gridGroupDetails.Text = "dataGridView1";
+ this.gridGroupDetails.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.gridGroupDetails_CellDoubleClick);
+ //
+ // checkBoxLecture
+ //
+ this.checkBoxLecture.AutoSize = true;
+ this.checkBoxLecture.Location = new System.Drawing.Point(60, 158);
+ this.checkBoxLecture.Name = "checkBoxLecture";
+ this.checkBoxLecture.Size = new System.Drawing.Size(65, 19);
+ this.checkBoxLecture.TabIndex = 12;
+ this.checkBoxLecture.Text = "Lecture";
+ this.checkBoxLecture.UseVisualStyleBackColor = true;
+ //
+ // checkBoxTutorial
+ //
+ this.checkBoxTutorial.AutoSize = true;
+ this.checkBoxTutorial.Location = new System.Drawing.Point(131, 158);
+ this.checkBoxTutorial.Name = "checkBoxTutorial";
+ this.checkBoxTutorial.Size = new System.Drawing.Size(66, 19);
+ this.checkBoxTutorial.TabIndex = 12;
+ this.checkBoxTutorial.Text = "Tutorial";
+ this.checkBoxTutorial.UseVisualStyleBackColor = true;
+ //
+ // checkBoxLab
+ //
+ this.checkBoxLab.AutoSize = true;
+ this.checkBoxLab.Location = new System.Drawing.Point(202, 158);
+ this.checkBoxLab.Name = "checkBoxLab";
+ this.checkBoxLab.Size = new System.Drawing.Size(45, 19);
+ this.checkBoxLab.TabIndex = 12;
+ this.checkBoxLab.Text = "Lab";
+ this.checkBoxLab.UseVisualStyleBackColor = true;
+ //
+ // ConsectiveSessionsSubForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.checkBoxLab);
+ this.Controls.Add(this.checkBoxTutorial);
+ this.Controls.Add(this.checkBoxLecture);
+ this.Controls.Add(this.gridGroupDetails);
+ this.Controls.Add(this.comboYear);
+ this.Controls.Add(this.comboSemester);
+ this.Controls.Add(this.comboSub);
+ this.Controls.Add(this.lblCaption);
+ this.Controls.Add(this.btnCansel);
+ this.Controls.Add(this.btnDelete);
+ this.Controls.Add(this.btnUpdate);
+ this.Controls.Add(this.btnInsert);
+ this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.Name = "ConsectiveSessionsSubForm";
+ this.Size = new System.Drawing.Size(890, 450);
+ ((System.ComponentModel.ISupportInitialize)(this.gridGroupDetails)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+ private System.Windows.Forms.Button btnInsert;
+ private System.Windows.Forms.Button btnUpdate;
+ private System.Windows.Forms.Button btnCansel;
+ private System.Windows.Forms.Button btnDelete;
+ private System.Windows.Forms.Label lblCaption;
+ private System.Windows.Forms.ComboBox comboYear;
+ private System.Windows.Forms.ComboBox comboSemester;
+ private System.Windows.Forms.DataGridView gridGroupDetails;
+ private System.Windows.Forms.ComboBox comboSub;
+ private System.Windows.Forms.CheckBox checkBoxLecture;
+ private System.Windows.Forms.CheckBox checkBoxTutorial;
+ private System.Windows.Forms.CheckBox checkBoxLab;
+ }
+}
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/ConsectiveSessionsSubForm.cs b/TimeTable_App/Forms/SubForms/ConsectiveSessionsSubForm.cs
new file mode 100644
index 0000000..e59eff0
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/ConsectiveSessionsSubForm.cs
@@ -0,0 +1,369 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using TimeTable_App.Global;
+using TimeTable_App.Models;
+using System.Linq;
+
+namespace TimeTable_App.Forms.SubForms
+{
+ public partial class ConsectiveSessionsSubForm : UserControl
+ {
+ private static ConsectiveSessionsSubForm _instance;
+ private FormCtrl formCtrl;
+ private int ID = 0;
+
+ public static ConsectiveSessionsSubForm Instance
+ {
+ get
+ {
+ if (_instance == null) _instance = new ConsectiveSessionsSubForm();
+ return _instance;
+ }
+ }
+
+ public ConsectiveSessionsSubForm()
+ {
+ InitializeComponent();
+ formCtrl = new FormCtrl();
+ initForm();
+ }
+
+
+
+ private void initForm()
+ {
+
+ ID = 0;
+ comboYear.Items.Clear();
+ comboSemester.Items.Clear();
+ comboSub.Items.Clear();
+
+ checkBoxLecture.Checked = false;
+ checkBoxTutorial.Checked = false;
+ checkBoxLab.Checked = false;
+
+ comboYear.Items.Insert(0, "Select Year");
+ comboSemester.Items.Insert(0, "Select Semester");
+ comboSub.Items.Insert(0, "Select Subject");
+
+ ActionResult ASYResult = formCtrl._getFormData(typeof(ASYModel), "ASY");
+ if (ASYResult.State)
+ {
+ List ASYList = ASYResult.Data;
+ List ASYDistinctList = ASYList
+ .GroupBy(ASY => ASY.Year)
+ .Select(g => g.First())
+ .ToList();
+ int count = 1;
+ ASYDistinctList.ForEach(ASY => {
+ comboYear.Items.Insert(count, ASY.Year);
+ ++count;
+ });
+ }
+
+
+
+ comboYear.SelectedIndex = 0;
+ comboSemester.SelectedIndex = 0;
+ comboSub.SelectedIndex = 0;
+ comboSemester.Enabled = false;
+ comboSub.Enabled = false;
+
+ btnInsert.Enabled = true;
+ btnCansel.Enabled = true;
+ btnUpdate.Enabled = false;
+ btnDelete.Enabled = false;
+
+
+
+ ActionResult groupResult = formCtrl._getFormData(typeof(ConsectiveSessionsModel), "ConsectiveSessions");
+ if (groupResult.State)
+ {
+
+ gridGroupDetails.DataSource = groupResult.Data;
+
+ gridGroupDetails.Columns[1].HeaderCell.Value = "Year";
+ gridGroupDetails.Columns[2].HeaderCell.Value = "Semester";
+ gridGroupDetails.Columns[3].HeaderCell.Value = "Subject";
+ gridGroupDetails.Columns[4].HeaderCell.Value = "Lecture";
+ gridGroupDetails.Columns[5].HeaderCell.Value = "Tutorial";
+ gridGroupDetails.Columns[6].HeaderCell.Value = "Lab";
+
+ gridGroupDetails.Columns[0].Visible = false;
+
+ gridGroupDetails.RowHeadersVisible = false;
+
+ }
+ }
+
+ private void comboYear_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (comboYear.SelectedIndex != 0)
+ {
+ ActionResult ASYResult = formCtrl._getFormData(typeof(ASYModel), "ASY");
+ if (ASYResult.State)
+ {
+ comboSemester.Items.Clear();
+ comboSemester.Items.Insert(0, "Select Semester");
+ comboSub.Items.Clear();
+ comboSub.Items.Insert(0, "Select Subject");
+
+
+ List ASYList = ASYResult.Data;
+ var SemesterList = ASYList.Where(ASY => ASY.Year == comboYear.SelectedItem.ToString()).ToList();
+ int count = 1;
+ SemesterList.ForEach(ASY =>
+ {
+ comboSemester.Items.Insert(count, ASY.Semester);
+ ++count;
+ }
+ );
+
+ comboSemester.SelectedIndex = 0;
+ comboSub.SelectedIndex = 0;
+
+ comboSemester.Enabled = true;
+ comboSub.Enabled = false;
+ }
+ }
+ }
+
+ private void comboSemester_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (comboYear.SelectedIndex != 0)
+ {
+ ActionResult SubjectResult = formCtrl._getFormData(typeof(SubjectsFormModel), "Subjects");
+ if (SubjectResult.State)
+ {
+
+ comboSub.Items.Clear();
+ comboSub.Items.Insert(0, "Select Subject");
+
+ List subjectList = SubjectResult.Data;
+ var SelectedSubjectList = subjectList.Where(sub => sub.Year == comboYear.SelectedItem.ToString() && sub.Semester == comboSemester.SelectedItem.ToString()).ToList();
+ int count = 1;
+ SelectedSubjectList.ForEach(grp =>
+ {
+ comboSub.Items.Insert(count, grp.SubjectName);
+ ++count;
+ }
+ );
+
+ comboSub.SelectedIndex = 0;
+
+ comboSemester.Enabled = true;
+ comboSub.Enabled = true;
+ }
+ }
+ }
+
+
+
+
+ private void gridGroupDetails_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
+ {
+ DataGridViewRow selectedRow = this.gridGroupDetails.SelectedRows[0];
+ if (selectedRow != null)
+ {
+ ID = Int32.Parse(selectedRow.Cells[0].Value.ToString());
+ comboYear.SelectedIndex = comboYear.FindStringExact(selectedRow.Cells[1].Value.ToString());
+ comboSemester.SelectedIndex = comboSemester.FindStringExact(selectedRow.Cells[2].Value.ToString());
+ comboSub.SelectedIndex = comboSub.FindStringExact(selectedRow.Cells[3].Value.ToString());
+ checkBoxLecture.Checked = getState(selectedRow.Cells[4].Value.ToString());
+ checkBoxTutorial.Checked = getState(selectedRow.Cells[5].Value.ToString());
+ checkBoxLab.Checked = getState(selectedRow.Cells[6].Value.ToString());
+
+ btnInsert.Enabled = false;
+ btnUpdate.Enabled = true;
+ btnDelete.Enabled = true;
+
+ }
+ }
+
+ private void btnCansel_Click(object sender, EventArgs e)
+ {
+ initForm();
+ }
+
+ private void btnInsert_Click(object sender, EventArgs e)
+ {
+
+ if (comboYear.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboYear.Focus();
+ }
+ else if (comboSemester.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSemester.Focus();
+ }
+ else if (comboSub.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Subject!If Year List Empty Please Add Subject", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSub.Focus();
+ }
+ else if ((!checkBoxLecture.Checked && !checkBoxTutorial.Checked && !checkBoxLab.Checked) || (!checkBoxLecture.Checked && !checkBoxTutorial.Checked) || (!checkBoxLecture.Checked && !checkBoxLab.Checked) || (!checkBoxTutorial.Checked && !checkBoxLab.Checked))
+ {
+ MessageBox.Show("Please Select Two or More Tags For Consective Session!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSub.Focus();
+ }
+
+
+ else
+ {
+ ActionResult saveResult = formCtrl._saveFormData(new ConsectiveSessionsModel()
+ {
+ Year = comboYear.SelectedItem.ToString(),
+ Semester = comboSemester.SelectedItem.ToString(),
+ Subject = comboSub.SelectedItem.ToString(),
+ Lecture = getCheckedSate("Lecture"),
+ Tutorial = getCheckedSate("Tutorial"),
+ Lab = getCheckedSate("Lab"),
+
+ });
+
+ if (saveResult.State)
+ {
+ ConsectiveSessionsModel saveObj = saveResult.Data;
+ MessageBox.Show("Consective Session Sucessfully Saved!", "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ initForm();
+ }
+ else
+ {
+ MessageBox.Show(saveResult.Data, "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ }
+
+
+ private string getCheckedSate(String type) {
+
+ string state = "NO";
+
+ if (type == "Lecture")
+ {
+ if (checkBoxLecture.Checked)
+ {
+ state = "YES";
+ }
+ }
+ else if (type == "Tutorial")
+ {
+ if (checkBoxTutorial.Checked)
+ {
+ state = "YES";
+ }
+ }
+ else {
+
+ if (checkBoxLab.Checked)
+ {
+ state = "YES";
+ }
+ }
+
+
+ return state;
+ }
+
+ private bool getState(String value)
+ {
+
+ bool checkedValue = false;
+
+ if (value == "YES")
+ {
+ checkedValue = true;
+ }
+
+ return checkedValue;
+ }
+
+
+
+ private void btnDelete_Click(object sender, EventArgs e)
+ {
+ if (ID == 0)
+ {
+ MessageBox.Show("Please select Consective Session first!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ initForm();
+ }
+ else
+ {
+ ActionResult deleteResult = formCtrl._deleteFormData(new ConsectiveSessionsModel() { Id = ID });
+
+ if (deleteResult.State)
+ {
+ ConsectiveSessionsModel deleteObj = deleteResult.Data;
+ MessageBox.Show("Consective Session Sucessfully Deleted!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ initForm();
+ }
+ else
+ {
+ MessageBox.Show(deleteResult.Data, "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+
+ }
+
+ private void btnUpdate_Click(object sender, EventArgs e)
+ {
+ if (comboYear.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboYear.Focus();
+ }
+ else if (comboSemester.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSemester.Focus();
+ }
+ else if (comboSub.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Subject!If Year List Empty Please Add Subject", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSub.Focus();
+ }
+ else if ((!checkBoxLecture.Checked && !checkBoxTutorial.Checked && !checkBoxLab.Checked) || (!checkBoxLecture.Checked && !checkBoxTutorial.Checked) || (!checkBoxLecture.Checked && !checkBoxLab.Checked) || (!checkBoxTutorial.Checked && !checkBoxLab.Checked))
+ {
+ MessageBox.Show("Please Select Two or More Tags For Consective Session!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSub.Focus();
+ }
+
+ else
+ {
+
+ ActionResult updateResult = formCtrl._updateFormData(new ConsectiveSessionsModel()
+ {
+ Id = ID,
+ Year = comboYear.SelectedItem.ToString(),
+ Semester = comboSemester.SelectedItem.ToString(),
+ Subject = comboSub.SelectedItem.ToString(),
+ Lecture = getCheckedSate("Lecture"),
+ Tutorial = getCheckedSate("Tutorial"),
+ Lab = getCheckedSate("Lab"),
+ });
+
+ if (updateResult.State)
+ {
+ ConsectiveSessionsModel updateObj = updateResult.Data;
+ MessageBox.Show("Consective Session Sucessfully Updated!", "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ initForm();
+ }
+ else
+ {
+ MessageBox.Show(updateResult.Data, "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/ConsectiveSessionsSubForm.resx b/TimeTable_App/Forms/SubForms/ConsectiveSessionsSubForm.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/ConsectiveSessionsSubForm.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/NATLectureSubForm.Designer.cs b/TimeTable_App/Forms/SubForms/NATLectureSubForm.Designer.cs
new file mode 100644
index 0000000..e883d0a
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/NATLectureSubForm.Designer.cs
@@ -0,0 +1,203 @@
+namespace TimeTable_App.Forms.SubForms
+{
+ partial class NATLectureSubForm
+ {
+ ///
+ /// 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 Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.btnInsert = new System.Windows.Forms.Button();
+ this.btnUpdate = new System.Windows.Forms.Button();
+ this.btnDelete = new System.Windows.Forms.Button();
+ this.btnCansel = new System.Windows.Forms.Button();
+ this.lblCaption = new System.Windows.Forms.Label();
+ this.txtTo = new System.Windows.Forms.TextBox();
+ this.txtFrom = new System.Windows.Forms.TextBox();
+ this.comboDetails = new System.Windows.Forms.ComboBox();
+ this.comboType = new System.Windows.Forms.ComboBox();
+ this.gridRoomDetails = new System.Windows.Forms.DataGridView();
+ this.comboDay = new System.Windows.Forms.ComboBox();
+ ((System.ComponentModel.ISupportInitialize)(this.gridRoomDetails)).BeginInit();
+ this.SuspendLayout();
+ //
+ // btnInsert
+ //
+ this.btnInsert.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnInsert.Location = new System.Drawing.Point(763, 79);
+ this.btnInsert.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnInsert.Name = "btnInsert";
+ this.btnInsert.Size = new System.Drawing.Size(105, 26);
+ this.btnInsert.TabIndex = 0;
+ this.btnInsert.Text = "Insert";
+ this.btnInsert.UseVisualStyleBackColor = true;
+ this.btnInsert.Click += new System.EventHandler(this.btnInsert_Click);
+ //
+ // btnUpdate
+ //
+ this.btnUpdate.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnUpdate.Location = new System.Drawing.Point(763, 118);
+ this.btnUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnUpdate.Name = "btnUpdate";
+ this.btnUpdate.Size = new System.Drawing.Size(105, 26);
+ this.btnUpdate.TabIndex = 0;
+ this.btnUpdate.Text = "Update";
+ this.btnUpdate.UseVisualStyleBackColor = true;
+ this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
+ //
+ // btnDelete
+ //
+ this.btnDelete.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnDelete.Location = new System.Drawing.Point(763, 158);
+ this.btnDelete.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnDelete.Name = "btnDelete";
+ this.btnDelete.Size = new System.Drawing.Size(105, 26);
+ this.btnDelete.TabIndex = 0;
+ this.btnDelete.Text = "Delete";
+ this.btnDelete.UseVisualStyleBackColor = true;
+ this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
+ //
+ // btnCansel
+ //
+ this.btnCansel.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnCansel.Location = new System.Drawing.Point(763, 198);
+ this.btnCansel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnCansel.Name = "btnCansel";
+ this.btnCansel.Size = new System.Drawing.Size(105, 26);
+ this.btnCansel.TabIndex = 0;
+ this.btnCansel.Text = "Cancel";
+ this.btnCansel.UseVisualStyleBackColor = true;
+ this.btnCansel.Click += new System.EventHandler(this.btnCansel_Click);
+ //
+ // lblCaption
+ //
+ this.lblCaption.AutoSize = true;
+ this.lblCaption.Font = new System.Drawing.Font("Segoe UI Black", 16.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.lblCaption.Location = new System.Drawing.Point(381, 11);
+ this.lblCaption.Name = "lblCaption";
+ this.lblCaption.Size = new System.Drawing.Size(88, 30);
+ this.lblCaption.TabIndex = 2;
+ this.lblCaption.Text = "Rooms";
+ //
+ // txtTo
+ //
+ this.txtTo.Location = new System.Drawing.Point(60, 162);
+ this.txtTo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtTo.Name = "txtTo";
+ this.txtTo.PlaceholderText = "To";
+ this.txtTo.Size = new System.Drawing.Size(307, 23);
+ this.txtTo.TabIndex = 1;
+ //
+ // txtFrom
+ //
+ this.txtFrom.Location = new System.Drawing.Point(415, 118);
+ this.txtFrom.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtFrom.Name = "txtFrom";
+ this.txtFrom.PlaceholderText = "From";
+ this.txtFrom.Size = new System.Drawing.Size(307, 23);
+ this.txtFrom.TabIndex = 12;
+ //
+ // comboDetails
+ //
+ this.comboDetails.FormattingEnabled = true;
+ this.comboDetails.Location = new System.Drawing.Point(415, 79);
+ this.comboDetails.Name = "comboDetails";
+ this.comboDetails.Size = new System.Drawing.Size(307, 23);
+ this.comboDetails.TabIndex = 10;
+ this.comboDetails.SelectedIndexChanged += new System.EventHandler(this.comboDetails_SelectedIndexChanged);
+ //
+ // comboType
+ //
+ this.comboType.FormattingEnabled = true;
+ this.comboType.Location = new System.Drawing.Point(60, 79);
+ this.comboType.Name = "comboType";
+ this.comboType.Size = new System.Drawing.Size(307, 23);
+ this.comboType.TabIndex = 11;
+ this.comboType.SelectedIndexChanged += new System.EventHandler(this.comboType_SelectedIndexChanged);
+ //
+ // gridRoomDetails
+ //
+ this.gridRoomDetails.AllowUserToAddRows = false;
+ this.gridRoomDetails.AllowUserToDeleteRows = false;
+ this.gridRoomDetails.AllowUserToResizeColumns = false;
+ this.gridRoomDetails.AllowUserToResizeRows = false;
+ this.gridRoomDetails.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
+ this.gridRoomDetails.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.gridRoomDetails.Location = new System.Drawing.Point(60, 270);
+ this.gridRoomDetails.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.gridRoomDetails.Name = "gridRoomDetails";
+ this.gridRoomDetails.ReadOnly = true;
+ this.gridRoomDetails.RowHeadersWidth = 51;
+ this.gridRoomDetails.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.gridRoomDetails.Size = new System.Drawing.Size(808, 141);
+ this.gridRoomDetails.TabIndex = 9;
+ this.gridRoomDetails.Text = "dataGridView1";
+ this.gridRoomDetails.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.gridRoomDetails_CellDoubleClick);
+ //
+ // comboDay
+ //
+ this.comboDay.FormattingEnabled = true;
+ this.comboDay.Location = new System.Drawing.Point(60, 121);
+ this.comboDay.Name = "comboDay";
+ this.comboDay.Size = new System.Drawing.Size(307, 23);
+ this.comboDay.TabIndex = 10;
+ //
+ // NATLectureSubForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.comboDay);
+ this.Controls.Add(this.gridRoomDetails);
+ this.Controls.Add(this.txtTo);
+ this.Controls.Add(this.txtFrom);
+ this.Controls.Add(this.comboDetails);
+ this.Controls.Add(this.comboType);
+ this.Controls.Add(this.lblCaption);
+ this.Controls.Add(this.btnCansel);
+ this.Controls.Add(this.btnDelete);
+ this.Controls.Add(this.btnUpdate);
+ this.Controls.Add(this.btnInsert);
+ this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.Name = "NATLectureSubForm";
+ this.Size = new System.Drawing.Size(890, 450);
+ ((System.ComponentModel.ISupportInitialize)(this.gridRoomDetails)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+ private System.Windows.Forms.Button btnInsert;
+ private System.Windows.Forms.Button btnUpdate;
+ private System.Windows.Forms.Button btnCansel;
+ private System.Windows.Forms.Button btnDelete;
+ private System.Windows.Forms.Label lblCaption;
+ private System.Windows.Forms.TextBox txtTo;
+ private System.Windows.Forms.TextBox txtFrom;
+ private System.Windows.Forms.ComboBox comboDetails;
+ private System.Windows.Forms.ComboBox comboType;
+ private System.Windows.Forms.DataGridView gridRoomDetails;
+ private System.Windows.Forms.ComboBox comboDay;
+ }
+}
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/NATLectureSubForm.cs b/TimeTable_App/Forms/SubForms/NATLectureSubForm.cs
new file mode 100644
index 0000000..a6c1b66
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/NATLectureSubForm.cs
@@ -0,0 +1,334 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using TimeTable_App.Global;
+using TimeTable_App.Models;
+
+namespace TimeTable_App.Forms.SubForms
+{
+ public partial class NATLectureSubForm : UserControl
+ {
+ private static NATLectureSubForm _instance;
+ private FormCtrl formCtrl;
+ private int Id = 0;
+
+ public static NATLectureSubForm Instance
+ {
+ get
+ {
+ if (_instance == null) _instance = new NATLectureSubForm();
+ return _instance;
+ }
+ }
+ public NATLectureSubForm()
+ {
+ InitializeComponent();
+ formCtrl = new FormCtrl();
+ initForm();
+ }
+
+
+
+ private void initForm()
+ {
+
+ Id = 0;
+ txtTo.Text = string.Empty;
+ txtFrom.Text = string.Empty;
+ comboType.Items.Clear();
+ comboDetails.Items.Clear();
+ comboDay.Items.Clear();
+
+ comboType.Items.Insert(0, "Select Type");
+ comboDetails.Items.Insert(0, "Select Value");
+ comboDay.Items.Insert(0, "Select Day");
+
+ comboType.Items.Insert(1, "Lecturer");
+ comboType.Items.Insert(2, "Session");
+ comboType.Items.Insert(3, "Group");
+ comboType.Items.Insert(4, "Sub Group");
+
+ comboDay.Items.Insert(1, "Monday");
+ comboDay.Items.Insert(2, "Tuesday");
+ comboDay.Items.Insert(3, "Wednesday");
+ comboDay.Items.Insert(4, "Thursday");
+ comboDay.Items.Insert(5, "Friday");
+ comboDay.Items.Insert(6, "Saturday");
+ comboDay.Items.Insert(7, "Sunday");
+
+ comboDetails.SelectedIndex = 0;
+ comboType.SelectedIndex = 0;
+ comboDay.SelectedIndex = 0;
+
+ btnInsert.Enabled = true;
+ btnCansel.Enabled = true;
+ btnUpdate.Enabled = false;
+ btnDelete.Enabled = false;
+ comboDetails.Enabled = false;
+ comboDay.Enabled = false;
+ txtFrom.Enabled = false;
+ txtTo.Enabled = false;
+
+
+ ActionResult TimeResult = formCtrl._getFormData(typeof(NATLectureModel), "NATLecture");
+ if (TimeResult.State)
+ {
+
+
+ gridRoomDetails.DataSource = TimeResult.Data;
+
+ gridRoomDetails.Columns[1].HeaderCell.Value = "Type";
+ gridRoomDetails.Columns[2].HeaderCell.Value = "Value";
+ gridRoomDetails.Columns[3].HeaderCell.Value = "Day";
+ gridRoomDetails.Columns[4].HeaderCell.Value = "From";
+ gridRoomDetails.Columns[5].HeaderCell.Value = "To";
+
+ gridRoomDetails.Columns[0].Visible = false;
+
+ gridRoomDetails.RowHeadersVisible = false;
+
+ }
+ }
+
+ private void gridRoomDetails_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
+ {
+ DataGridViewRow selectedRow = this.gridRoomDetails.SelectedRows[0];
+ if (selectedRow != null)
+ {
+ Id = Int32.Parse(selectedRow.Cells[0].Value.ToString());
+ comboType.SelectedIndex = comboType.FindStringExact(selectedRow.Cells[1].Value.ToString());
+ comboDetails.SelectedIndex = comboDetails.FindStringExact(selectedRow.Cells[2].Value.ToString());
+ comboDay.SelectedIndex = comboDay.FindStringExact(selectedRow.Cells[3].Value.ToString());
+ txtFrom.Text = selectedRow.Cells[4].Value.ToString();
+ txtTo.Text = selectedRow.Cells[5].Value.ToString();
+
+
+ btnInsert.Enabled = false;
+ btnUpdate.Enabled = true;
+ btnDelete.Enabled = true;
+
+ }
+ }
+
+ private void btnCansel_Click(object sender, EventArgs e)
+ {
+ initForm();
+ }
+
+ private void btnInsert_Click(object sender, EventArgs e)
+ {
+ if (comboType.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Type!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboType.Focus();
+ }
+ else if (comboDetails.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Details!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboDetails.Focus();
+ }
+ else if (comboDay.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Day!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboDay.Focus();
+ }
+
+ else if (string.IsNullOrEmpty(txtFrom.Text))
+ {
+ MessageBox.Show("Please Enter From!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ txtFrom.Focus();
+ }
+ else if (string.IsNullOrEmpty(txtTo.Text))
+ {
+ MessageBox.Show("Please Enter To", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ txtTo.Focus();
+ }
+ else
+ {
+ ActionResult saveResult = formCtrl._saveFormData(new NATLectureModel()
+ {
+
+ Type = comboType.SelectedItem.ToString(),
+ Value = comboDetails.SelectedItem.ToString(),
+ Day = comboDay.SelectedItem.ToString(),
+ From = txtFrom.Text.Trim(),
+ To = txtTo.Text.Trim(),
+
+ });
+
+ if (saveResult.State)
+ {
+ NATLectureModel saveObj = saveResult.Data;
+ MessageBox.Show("Not Available Time : " + saveObj.Type + " - " + saveObj.Value + " Sucessfully Saved!", "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ initForm();
+ }
+ else
+ {
+ MessageBox.Show(saveResult.Data, "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ }
+
+ private void btnDelete_Click(object sender, EventArgs e)
+ {
+ if (Id == 0)
+ {
+ MessageBox.Show("Please select Non Allocate time first!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ initForm();
+ }
+ else
+ {
+ ActionResult deleteResult = formCtrl._deleteFormData(new NATLectureModel() { Id = Id });
+
+ if (deleteResult.State)
+ {
+ NATLectureModel deleteObj = deleteResult.Data;
+ MessageBox.Show("Not Available Time Sucessfully Deleted!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ initForm();
+ }
+ else
+ {
+ MessageBox.Show(deleteResult.Data, "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+
+ }
+
+
+
+
+
+ private void btnUpdate_Click(object sender, EventArgs e)
+ {
+ if (comboType.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Type!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboType.Focus();
+ }
+ else if (comboDetails.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Value!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboDetails.Focus();
+ }
+ else if (comboDay.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Day!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboDay.Focus();
+ }
+
+ else if (string.IsNullOrEmpty(txtFrom.Text))
+ {
+ MessageBox.Show("Please Enter From!", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ txtFrom.Focus();
+ }
+ else if (string.IsNullOrEmpty(txtTo.Text))
+ {
+ MessageBox.Show("Please Enter To", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ txtTo.Focus();
+ }
+ else
+ {
+
+ ActionResult updateResult = formCtrl._updateFormData(new NATLectureModel()
+ {
+ Id = Id,
+ Type = comboType.SelectedItem.ToString(),
+ Value = comboDetails.SelectedItem.ToString(),
+ Day = comboDay.SelectedItem.ToString(),
+ From = txtFrom.Text.Trim(),
+ To = txtTo.Text.Trim(),
+ });
+
+ if (updateResult.State)
+ {
+ NATLectureModel updateObj = updateResult.Data;
+ MessageBox.Show("Not Available Time : " + updateObj.Type + " - " + updateObj.Value + " Sucessfully Updated!", "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ initForm();
+ }
+ else
+ {
+ MessageBox.Show(updateResult.Data, "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+
+ }
+
+ private void comboType_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ comboDetails.Items.Clear();
+ comboDetails.Items.Insert(0, "Select Value");
+ int count = 1;
+ if (getList() != null)
+ {
+ List valueList = getList();
+ valueList.ForEach(value => comboDetails.Items.Insert(count, value));
+ ++count;
+ }
+
+ comboDetails.Enabled = true;
+ }
+
+ private void comboDetails_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ comboDay.Enabled = true;
+ txtTo.Enabled = true;
+ txtFrom.Enabled = true;
+ }
+
+ private List getList() {
+
+ List valueList = new List();
+ valueList.Clear();
+
+ string value = comboType.SelectedItem.ToString();
+ if (value == "Lecturer") {
+ ActionResult LectureResult = formCtrl._getFormData(typeof(LecturersFormModel), "Lecturers");
+ if (LectureResult.State)
+ {
+ List vList = LectureResult.Data;
+ vList.ForEach(detail => valueList.Add(detail.EmployeeId + " - " + detail.EmployeeName));
+
+ }
+ }else if (value == "Session")
+ {
+ ActionResult RoomResult = formCtrl._getFormData(typeof(RoomsModel), "Rooms");
+ if (RoomResult.State)
+ {
+ valueList = RoomResult.Data;
+
+ }
+ }
+ else if (value == "Group")
+ {
+ ActionResult groupResult = formCtrl._getFormData(typeof(GroupIDModel), "GroupID");
+ if (groupResult.State)
+ {
+ List vList = groupResult.Data;
+ vList.ForEach(detail => valueList.Add(detail.GroupID));
+
+ }
+ }
+ else if (value == "Sub Group")
+ {
+ ActionResult SubGroupResult = formCtrl._getFormData(typeof(SubGroupIDModel), "SubGroupID");
+ if (SubGroupResult.State)
+ {
+ List vList = SubGroupResult.Data;
+ vList.ForEach(detail => valueList.Add(detail.SubGroupID));
+
+ }
+ }
+
+ return valueList;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/NATLectureSubForm.resx b/TimeTable_App/Forms/SubForms/NATLectureSubForm.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/NATLectureSubForm.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/NOSSubForm.Designer.cs b/TimeTable_App/Forms/SubForms/NOSSubForm.Designer.cs
new file mode 100644
index 0000000..f7823bc
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/NOSSubForm.Designer.cs
@@ -0,0 +1,179 @@
+namespace TimeTable_App.Forms.SubForms
+{
+ partial class NOSSubForm
+ {
+ ///
+ /// 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 Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.btnInsert = new System.Windows.Forms.Button();
+ this.btnUpdate = new System.Windows.Forms.Button();
+ this.btnDelete = new System.Windows.Forms.Button();
+ this.btnCansel = new System.Windows.Forms.Button();
+ this.lblCaption = new System.Windows.Forms.Label();
+ this.comboYear = new System.Windows.Forms.ComboBox();
+ this.comboSemester = new System.Windows.Forms.ComboBox();
+ this.comboSesssion = new System.Windows.Forms.ComboBox();
+ this.gridGroupDetails = new System.Windows.Forms.DataGridView();
+ ((System.ComponentModel.ISupportInitialize)(this.gridGroupDetails)).BeginInit();
+ this.SuspendLayout();
+ //
+ // btnInsert
+ //
+ this.btnInsert.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnInsert.Location = new System.Drawing.Point(763, 79);
+ this.btnInsert.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnInsert.Name = "btnInsert";
+ this.btnInsert.Size = new System.Drawing.Size(105, 26);
+ this.btnInsert.TabIndex = 0;
+ this.btnInsert.Text = "Insert";
+ this.btnInsert.UseVisualStyleBackColor = true;
+ this.btnInsert.Click += new System.EventHandler(this.btnInsert_Click);
+ //
+ // btnUpdate
+ //
+ this.btnUpdate.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnUpdate.Location = new System.Drawing.Point(763, 118);
+ this.btnUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnUpdate.Name = "btnUpdate";
+ this.btnUpdate.Size = new System.Drawing.Size(105, 26);
+ this.btnUpdate.TabIndex = 0;
+ this.btnUpdate.Text = "Update";
+ this.btnUpdate.UseVisualStyleBackColor = true;
+ this.btnUpdate.Click += new System.EventHandler(this.btnUpdate_Click);
+ //
+ // btnDelete
+ //
+ this.btnDelete.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnDelete.Location = new System.Drawing.Point(763, 158);
+ this.btnDelete.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnDelete.Name = "btnDelete";
+ this.btnDelete.Size = new System.Drawing.Size(105, 26);
+ this.btnDelete.TabIndex = 0;
+ this.btnDelete.Text = "Delete";
+ this.btnDelete.UseVisualStyleBackColor = true;
+ this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
+ //
+ // btnCansel
+ //
+ this.btnCansel.Font = new System.Drawing.Font("Segoe UI Semibold", 10.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.btnCansel.Location = new System.Drawing.Point(763, 198);
+ this.btnCansel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnCansel.Name = "btnCansel";
+ this.btnCansel.Size = new System.Drawing.Size(105, 26);
+ this.btnCansel.TabIndex = 0;
+ this.btnCansel.Text = "Cancel";
+ this.btnCansel.UseVisualStyleBackColor = true;
+ this.btnCansel.Click += new System.EventHandler(this.btnCansel_Click);
+ //
+ // lblCaption
+ //
+ this.lblCaption.AutoSize = true;
+ this.lblCaption.Font = new System.Drawing.Font("Segoe UI Black", 16.2F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.lblCaption.Location = new System.Drawing.Point(381, 11);
+ this.lblCaption.Name = "lblCaption";
+ this.lblCaption.Size = new System.Drawing.Size(244, 30);
+ this.lblCaption.TabIndex = 2;
+ this.lblCaption.Text = "Not Overlap Sessions";
+ //
+ // comboYear
+ //
+ this.comboYear.FormattingEnabled = true;
+ this.comboYear.Location = new System.Drawing.Point(60, 79);
+ this.comboYear.Name = "comboYear";
+ this.comboYear.Size = new System.Drawing.Size(307, 23);
+ this.comboYear.TabIndex = 10;
+ this.comboYear.SelectedIndexChanged += new System.EventHandler(this.comboYear_SelectedIndexChanged);
+ //
+ // comboSemester
+ //
+ this.comboSemester.FormattingEnabled = true;
+ this.comboSemester.Location = new System.Drawing.Point(399, 79);
+ this.comboSemester.Name = "comboSemester";
+ this.comboSemester.Size = new System.Drawing.Size(307, 23);
+ this.comboSemester.TabIndex = 11;
+ this.comboSemester.SelectedIndexChanged += new System.EventHandler(this.comboSemester_SelectedIndexChanged);
+ //
+ // comboSesssion
+ //
+ this.comboSesssion.FormattingEnabled = true;
+ this.comboSesssion.Location = new System.Drawing.Point(60, 118);
+ this.comboSesssion.Name = "comboSesssion";
+ this.comboSesssion.Size = new System.Drawing.Size(307, 23);
+ this.comboSesssion.TabIndex = 10;
+ //
+ // gridGroupDetails
+ //
+ this.gridGroupDetails.AllowUserToAddRows = false;
+ this.gridGroupDetails.AllowUserToDeleteRows = false;
+ this.gridGroupDetails.AllowUserToResizeColumns = false;
+ this.gridGroupDetails.AllowUserToResizeRows = false;
+ this.gridGroupDetails.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
+ this.gridGroupDetails.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.gridGroupDetails.Location = new System.Drawing.Point(60, 270);
+ this.gridGroupDetails.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.gridGroupDetails.Name = "gridGroupDetails";
+ this.gridGroupDetails.ReadOnly = true;
+ this.gridGroupDetails.RowHeadersWidth = 51;
+ this.gridGroupDetails.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.gridGroupDetails.Size = new System.Drawing.Size(808, 141);
+ this.gridGroupDetails.TabIndex = 9;
+ this.gridGroupDetails.Text = "dataGridView1";
+ this.gridGroupDetails.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.gridGroupDetails_CellDoubleClick);
+ //
+ // NOSSubForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.gridGroupDetails);
+ this.Controls.Add(this.comboYear);
+ this.Controls.Add(this.comboSemester);
+ this.Controls.Add(this.comboSesssion);
+ this.Controls.Add(this.lblCaption);
+ this.Controls.Add(this.btnCansel);
+ this.Controls.Add(this.btnDelete);
+ this.Controls.Add(this.btnUpdate);
+ this.Controls.Add(this.btnInsert);
+ this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.Name = "NOSSubForm";
+ this.Size = new System.Drawing.Size(890, 450);
+ ((System.ComponentModel.ISupportInitialize)(this.gridGroupDetails)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+ private System.Windows.Forms.Button btnInsert;
+ private System.Windows.Forms.Button btnUpdate;
+ private System.Windows.Forms.Button btnCansel;
+ private System.Windows.Forms.Button btnDelete;
+ private System.Windows.Forms.Label lblCaption;
+ private System.Windows.Forms.ComboBox comboYear;
+ private System.Windows.Forms.ComboBox comboSemester;
+ private System.Windows.Forms.ComboBox comboSesssion;
+ private System.Windows.Forms.DataGridView gridGroupDetails;
+ }
+}
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/NOSSubForm.cs b/TimeTable_App/Forms/SubForms/NOSSubForm.cs
new file mode 100644
index 0000000..5cd8103
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/NOSSubForm.cs
@@ -0,0 +1,323 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using TimeTable_App.Global;
+using TimeTable_App.Models;
+using System.Linq;
+
+namespace TimeTable_App.Forms.SubForms
+{
+ public partial class NOSSubForm : UserControl
+ {
+ private static NOSSubForm _instance;
+ private FormCtrl formCtrl;
+ private int ID = 0;
+
+ public static NOSSubForm Instance
+ {
+ get
+ {
+ if (_instance == null) _instance = new NOSSubForm();
+ return _instance;
+ }
+ }
+ public NOSSubForm()
+ {
+ InitializeComponent();
+ formCtrl = new FormCtrl();
+ initForm();
+ }
+
+
+
+ private void initForm()
+ {
+
+ ID = 0;
+ comboYear.Items.Clear();
+ comboSemester.Items.Clear();
+ comboSesssion.Items.Clear();
+
+
+ comboYear.Items.Insert(0, "Select Year");
+ comboSemester.Items.Insert(0, "Select Semester");
+ comboSesssion.Items.Insert(0, "Select Session");
+
+ ActionResult ASYResult = formCtrl._getFormData(typeof(ASYModel), "ASY");
+ if (ASYResult.State)
+ {
+ List ASYList = ASYResult.Data;
+ List ASYDistinctList = ASYList
+ .GroupBy(ASY => ASY.Year)
+ .Select(g => g.First())
+ .ToList();
+ int count = 1;
+ ASYDistinctList.ForEach(ASY => {
+ comboYear.Items.Insert(count, ASY.Year);
+ ++count;
+ });
+ }
+
+
+
+ comboYear.SelectedIndex = 0;
+ comboSemester.SelectedIndex = 0;
+ comboSesssion.SelectedIndex = 0;
+ comboSemester.Enabled = false;
+ comboSesssion.Enabled = false;
+
+ btnInsert.Enabled = true;
+ btnCansel.Enabled = true;
+ btnUpdate.Enabled = false;
+ btnDelete.Enabled = false;
+
+
+
+ ActionResult NOSResult = formCtrl._getFormData(typeof(NOSModel), "NOS");
+ if (NOSResult.State)
+ {
+
+
+ gridGroupDetails.DataSource = NOSResult.Data;
+
+ gridGroupDetails.Columns[1].HeaderCell.Value = "Year";
+ gridGroupDetails.Columns[2].HeaderCell.Value = "Semester";
+ gridGroupDetails.Columns[3].HeaderCell.Value = "Session";
+
+ gridGroupDetails.Columns[0].Visible = false;
+
+ gridGroupDetails.RowHeadersVisible = false;
+
+ }
+ }
+
+ private void comboYear_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (comboYear.SelectedIndex != 0)
+ {
+ ActionResult ASYResult = formCtrl._getFormData(typeof(ASYModel), "ASY");
+ if (ASYResult.State)
+ {
+ comboSemester.Items.Clear();
+ comboSemester.Items.Insert(0, "Select Semester");
+
+
+ comboSesssion.Items.Clear();
+ comboSesssion.Items.Insert(0, "Select Session");
+
+
+ List ASYList = ASYResult.Data;
+ var SemesterList = ASYList.Where(ASY => ASY.Year == comboYear.SelectedItem.ToString()).ToList();
+ int count = 1;
+ SemesterList.ForEach(ASY =>
+ {
+ comboSemester.Items.Insert(count, ASY.Semester);
+ ++count;
+ }
+ );
+
+ comboSemester.SelectedIndex = 0;
+ comboSesssion.SelectedIndex = 0;
+
+ comboSemester.Enabled = true;
+ comboSesssion.Enabled = false;
+ }
+ }
+ }
+
+ private void comboSemester_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (comboYear.SelectedIndex != 0)
+ {
+ ActionResult GroupsResult = formCtrl._getFormData(typeof(GroupIDModel), "GroupID");
+ if (GroupsResult.State)
+ {
+
+ comboSesssion.Items.Clear();
+ comboSesssion.Items.Insert(0, "Select Session");
+
+ ActionResult subjectsResult = formCtrl._getFormData(typeof(SubjectsFormModel), "Subjects");
+ if (subjectsResult.State)
+ {
+ List SubList = subjectsResult.Data;
+
+ ActionResult NOSResult = formCtrl._getFormData(typeof(NOSModel), "NOS");
+ if (NOSResult.State)
+ {
+
+
+ gridGroupDetails.DataSource = NOSResult.Data;
+
+ gridGroupDetails.Columns[1].HeaderCell.Value = "Year";
+ gridGroupDetails.Columns[2].HeaderCell.Value = "Semester";
+ gridGroupDetails.Columns[3].HeaderCell.Value = "Session";
+
+ gridGroupDetails.Columns[0].Visible = false;
+
+ gridGroupDetails.RowHeadersVisible = false;
+
+ }
+
+ }
+
+
+
+ List GroupsList = GroupsResult.Data;
+ var SelectedYAndSList = GroupsList.Where(grp => grp.Year == comboYear.SelectedItem.ToString() && grp.Semester == comboSemester.SelectedItem.ToString()).ToList();
+ int count = 1;
+ SelectedYAndSList.ForEach(grp =>
+ {
+ comboSesssion.Items.Insert(count, grp.Programme);
+ ++count;
+ }
+ );
+
+ comboSesssion.SelectedIndex = 0;
+
+ comboSemester.Enabled = true;
+ comboSesssion.Enabled = true;
+ }
+ }
+ }
+
+
+
+ private void gridGroupDetails_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
+ {
+ DataGridViewRow selectedRow = this.gridGroupDetails.SelectedRows[0];
+ if (selectedRow != null)
+ {
+ ID = Int32.Parse(selectedRow.Cells[0].Value.ToString());
+ comboYear.SelectedIndex = comboYear.FindStringExact(selectedRow.Cells[1].Value.ToString());
+ comboSemester.SelectedIndex = comboSemester.FindStringExact(selectedRow.Cells[2].Value.ToString());
+ comboSesssion.SelectedIndex = comboSesssion.FindStringExact(selectedRow.Cells[3].Value.ToString());
+
+ btnInsert.Enabled = false;
+ btnUpdate.Enabled = true;
+ btnDelete.Enabled = true;
+
+ }
+ }
+
+ private void btnCansel_Click(object sender, EventArgs e)
+ {
+ initForm();
+ }
+
+ private void btnInsert_Click(object sender, EventArgs e)
+ {
+
+ if (comboYear.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboYear.Focus();
+ }
+ else if (comboSemester.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSemester.Focus();
+ }
+ else if (comboSesssion.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Programme!If Year List Empty Please Add Programmes", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSesssion.Focus();
+ }
+
+ else
+ {
+ ActionResult saveResult = formCtrl._saveFormData(new SubGroupIDModel()
+ {
+ Year = comboYear.SelectedItem.ToString(),
+ Semester = comboSemester.SelectedItem.ToString(),
+ Programme = comboSesssion.SelectedItem.ToString(),
+
+ });
+
+ if (saveResult.State)
+ {
+ SubGroupIDModel saveObj = saveResult.Data;
+ MessageBox.Show("Sub Group ID " + saveObj.SubGroupID + " Sucessfully Saved!", "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ initForm();
+ }
+ else
+ {
+ MessageBox.Show(saveResult.Data, "Save Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ }
+
+ private void btnDelete_Click(object sender, EventArgs e)
+ {
+ if (ID == 0)
+ {
+ MessageBox.Show("Please select Sub Group Id first!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ initForm();
+ }
+ else
+ {
+ ActionResult deleteResult = formCtrl._deleteFormData(new SubGroupIDModel() { Id = ID });
+
+ if (deleteResult.State)
+ {
+ SubGroupIDModel deleteObj = deleteResult.Data;
+ MessageBox.Show("Sub Group ID " + deleteObj.SubGroupID + " Sucessfully Deleted!", "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ initForm();
+ }
+ else
+ {
+ MessageBox.Show(deleteResult.Data, "Delete Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+
+ }
+
+ private void btnUpdate_Click(object sender, EventArgs e)
+ {
+ if (comboYear.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboYear.Focus();
+ }
+ else if (comboSemester.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Year!If Year List Empty Please Add Academic Year And Semster", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSemester.Focus();
+ }
+ else if (comboSesssion.SelectedIndex == 0)
+ {
+ MessageBox.Show("Please Select Programme!If Year List Empty Please Add Programmes", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ comboSesssion.Focus();
+ }
+ else
+ {
+
+ ActionResult updateResult = formCtrl._updateFormData(new SubGroupIDModel()
+ {
+ Id = ID,
+ Year = comboYear.SelectedItem.ToString(),
+ Semester = comboSemester.SelectedItem.ToString(),
+ Programme = comboSesssion.SelectedItem.ToString(),
+ });
+
+ if (updateResult.State)
+ {
+ SubGroupIDModel updateObj = updateResult.Data;
+ MessageBox.Show("Sub Group ID " + updateObj.SubGroupID + " Sucessfully Updated!", "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ initForm();
+ }
+ else
+ {
+ MessageBox.Show(updateResult.Data, "Update Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/NOSSubForm.resx b/TimeTable_App/Forms/SubForms/NOSSubForm.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/NOSSubForm.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/ParallelSessionsSubForm.Designer.cs b/TimeTable_App/Forms/SubForms/ParallelSessionsSubForm.Designer.cs
new file mode 100644
index 0000000..282dfb2
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/ParallelSessionsSubForm.Designer.cs
@@ -0,0 +1,37 @@
+namespace TimeTable_App.Forms.SubForms
+{
+ partial class ParallelSessionsSubForm
+ {
+ ///
+ /// 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 Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ }
+
+ #endregion
+ }
+}
diff --git a/TimeTable_App/Forms/SubForms/ParallelSessionsSubForm.cs b/TimeTable_App/Forms/SubForms/ParallelSessionsSubForm.cs
new file mode 100644
index 0000000..ffcf321
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/ParallelSessionsSubForm.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+
+namespace TimeTable_App.Forms.SubForms
+{
+ public partial class ParallelSessionsSubForm : UserControl
+ {
+ public ParallelSessionsSubForm()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/TimeTable_App/Forms/SubForms/ParallelSessionsSubForm.resx b/TimeTable_App/Forms/SubForms/ParallelSessionsSubForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/TimeTable_App/Forms/SubForms/ParallelSessionsSubForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
diff --git a/TimeTable_App/Forms/SubForms/SubGroupIDSubForm.cs b/TimeTable_App/Forms/SubForms/SubGroupIDSubForm.cs
index 82468a0..af8a633 100644
--- a/TimeTable_App/Forms/SubForms/SubGroupIDSubForm.cs
+++ b/TimeTable_App/Forms/SubForms/SubGroupIDSubForm.cs
@@ -16,6 +16,15 @@ public partial class SubGroupIDSubForm : UserControl
private static SubGroupIDSubForm _instance;
private FormCtrl formCtrl;
private int ID = 0;
+
+ public static SubGroupIDSubForm Instance
+ {
+ get
+ {
+ if (_instance == null) _instance = new SubGroupIDSubForm();
+ return _instance;
+ }
+ }
public SubGroupIDSubForm()
{
InitializeComponent();
diff --git a/TimeTable_App/Forms/SubjectsForm.resx b/TimeTable_App/Forms/SubjectsForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/TimeTable_App/Forms/SubjectsForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
diff --git a/TimeTable_App/Global/TimeTableDbContext.cs b/TimeTable_App/Global/TimeTableDbContext.cs
index 7235c69..ecf03df 100644
--- a/TimeTable_App/Global/TimeTableDbContext.cs
+++ b/TimeTable_App/Global/TimeTableDbContext.cs
@@ -44,6 +44,11 @@ public TimeTableDbContext() : base("DBCON")
public DbSet SubGroupID { get; set; }
public DbSet Rooms { get; set; }
public DbSet Subjects { get; set; }
+ public DbSet NATLecture { get; set; }
+ public DbSet RoomsforTimeNotReserved { get; set; }
+ public DbSet ConsectiveSessions { get; set; }
+ public DbSet Sessions { get; set; }
+ public DbSet NOS { get; set; }
public DbSet RoomsWithTags { get; set; }
public DbSet RoomsForASubject { get; set; }
public DbSet RoomsforaLecturer { get; set; }
diff --git a/TimeTable_App/Migrations/Configuration.cs b/TimeTable_App/Migrations/Configuration.cs
index cc8ab9f..4df2001 100644
--- a/TimeTable_App/Migrations/Configuration.cs
+++ b/TimeTable_App/Migrations/Configuration.cs
@@ -45,7 +45,11 @@ protected override void Seed(TimeTable_App.Global.TimeTableDbContext context)
context.AppSubForms.Add(new AppSubFormsModel() { SubFormName = "Working Days", SubFormDesc = "Working Days", SubFormController = "WorkingDaySubForm", Status = "A", FormId = 7 });
context.AppSubForms.Add(new AppSubFormsModel() { SubFormName = "Time Slots", SubFormDesc = "Time Slots", SubFormController = "TimeSlotSubForm", Status = "A", FormId = 7 });
-
+
+ context.AppSubForms.Add(new AppSubFormsModel() { SubFormName = "Not Available Time Of Lecturer", SubFormDesc = "Not Available Time Of Lecturer", SubFormController = "NATLectureSubForm", Status = "A", FormId = 8 });
+ context.AppSubForms.Add(new AppSubFormsModel() { SubFormName = "Consective Sessions", SubFormDesc = "Consective Sessions", SubFormController = "ConsectiveSessionsSubForm", Status = "A", FormId = 8 });
+ context.AppSubForms.Add(new AppSubFormsModel() { SubFormName = "Not Overlap Sessions", SubFormDesc = "Not Overlap Sessions", SubFormController = "NOSSubForm", Status = "A", FormId = 8 });
+ context.AppSubForms.Add(new AppSubFormsModel() { SubFormName = "Parallel Sessions", SubFormDesc = "Parallel Sessions", SubFormController = "ParallelSessionsSubForm", Status = "A", FormId = 8 });
context.AppSubForms.Add(new AppSubFormsModel() { SubFormName = "Sessions", SubFormDesc = "Sessions", SubFormController = "SessionsSubForm", Status = "A", FormId = 8 });
// Adding Faculties [Kusal Perera]
@@ -86,9 +90,12 @@ protected override void Seed(TimeTable_App.Global.TimeTableDbContext context)
context.WorkingDays.Add(new WorkingDaySubFormModel() { StrWorkingDays = "Friday", WorkHourPerDay = 0, status = "I" });
context.WorkingDays.Add(new WorkingDaySubFormModel() { StrWorkingDays = "Saturday", WorkHourPerDay = 0, status = "I" });
-
+ // Adding Subjects
+ context.Subjects.Add(new SubjectsFormModel() { SubjectCode = "IT1010", SubjectName = "IP", Year = "Y1", Semester = "S1", LectureHours = 2, LabHours = 0, TuteHours = 2, EvaluationHours = 0 });
+ context.Subjects.Add(new SubjectsFormModel() { SubjectCode = "IT1020", SubjectName = "SPM", Year = "Y1", Semester = "S2", LectureHours = 2, LabHours = 0, TuteHours = 2, EvaluationHours = 2 });
+
+ // Adding Consective Sessions
context.ConsectiveSessions.Add(new ConsectiveSessionsModel() { Year = "Y1", Semester = "S1", Subject="OOP",Lecture= "YES", Tutorial="YES", Lab ="NO" });
-
}
}
}
diff --git a/TimeTable_App/Models/AppFormsModel.cs b/TimeTable_App/Models/AppFormsModel.cs
index 6a24e6f..2525aa6 100644
--- a/TimeTable_App/Models/AppFormsModel.cs
+++ b/TimeTable_App/Models/AppFormsModel.cs
@@ -22,13 +22,13 @@ public class AppFormsModel
[Key]
public int FormId { get; set; }
[Required]
- [MaxLength(20)]
+ [MaxLength(100)]
public string FormName { get; set; }
[Required]
[MaxLength(100)]
public string FormDesc { get; set; }
[Required]
- [MaxLength(20)]
+ [MaxLength(100)]
public string FormController { get; set; }
[Required]
[MaxLength(1)]
diff --git a/TimeTable_App/Models/ConsectiveSessionsModel.cs b/TimeTable_App/Models/ConsectiveSessionsModel.cs
index f13e8b2..c501ef0 100644
--- a/TimeTable_App/Models/ConsectiveSessionsModel.cs
+++ b/TimeTable_App/Models/ConsectiveSessionsModel.cs
@@ -29,8 +29,6 @@ public class ConsectiveSessionsModel
[Required]
[MaxLength(50)]
public string Lab { get; set; }
-
-
public dynamic GetFormData(TimeTableDbContext _dbContext, string type)
{
diff --git a/TimeTable_App/Models/NATLectureModel.cs b/TimeTable_App/Models/NATLectureModel.cs
new file mode 100644
index 0000000..8d37e75
--- /dev/null
+++ b/TimeTable_App/Models/NATLectureModel.cs
@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using TimeTable_App.Global;
+
+namespace TimeTable_App.Models
+{
+ public class NATLectureModel
+ {
+ [Key]
+ public int Id { get; set; }
+ [Required]
+ [MaxLength(50)]
+ public string Type { get; set; }
+ [Required]
+ [MaxLength(50)]
+ public string Value { get; set; }
+ [Required]
+ [MaxLength(100)]
+ public string Day { get; set; }
+ [Required]
+ [MaxLength(100)]
+ public string From { get; set; }
+ [Required]
+ [MaxLength(100)]
+ public string To { get; set; }
+
+
+ public dynamic GetFormData(TimeTableDbContext _dbContext, string type)
+ {
+ if (type == "Lecturers")
+ {
+ return _dbContext.Lecturers.AsNoTracking().ToList();
+ }
+ else if (type == "GroupID")
+ {
+ return _dbContext.GroupID.AsNoTracking().ToList();
+ }
+ else if (type == "SubGroupID")
+ {
+ return _dbContext.SubGroupID.AsNoTracking().ToList();
+ }
+ else if (type == "NATLecture")
+ {
+ return _dbContext.NATLecture.AsNoTracking().ToList();
+ }
+
+ return null;
+ }
+ }
+}
+
diff --git a/TimeTable_App/Models/NOSModel.cs b/TimeTable_App/Models/NOSModel.cs
new file mode 100644
index 0000000..1f1747a
--- /dev/null
+++ b/TimeTable_App/Models/NOSModel.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using TimeTable_App.Global;
+
+namespace TimeTable_App.Models
+{
+ public class NOSModel
+ {
+ [Key]
+ public int Id { get; set; }
+ [Required]
+ [MaxLength(50)]
+ public string Year { get; set; }
+ [Required]
+ [MaxLength(50)]
+ public string Semester { get; set; }
+ [Required]
+ public int SessionID { get; set; }
+
+
+
+ public dynamic GetFormData(TimeTableDbContext _dbContext, string type)
+ {
+
+ if (type == "ASY")
+ {
+ return _dbContext.ASY.AsNoTracking().ToList();
+ }
+ else if (type == "Sessions")
+ {
+ return _dbContext.Sessions.AsNoTracking().ToList();
+ }
+ else if (type == "NOS")
+ {
+ return _dbContext.NOS.AsNoTracking().ToList();
+ }
+ return null;
+ }
+ }
+}
diff --git a/TimeTable_App/Models/SessionsSubFormModel.cs b/TimeTable_App/Models/SessionsSubFormModel.cs
index 5c6b4e3..fe9b5f4 100644
--- a/TimeTable_App/Models/SessionsSubFormModel.cs
+++ b/TimeTable_App/Models/SessionsSubFormModel.cs
@@ -45,6 +45,7 @@ public class SessionsSubFormModel
public int NoOfStudent { get; set; }
[Required]
public int Duration { get; set; }
+
public dynamic GetFormData(TimeTableDbContext _dbContext, string type)
{