public AddClassPopupForm(FacultyUserModel gotFaculty, SectionModel gotSection) { InitializeComponent(); faculty = gotFaculty; section = gotSection; datePicker.CalendarForeColor = Color.FromArgb(217, 217, 217); datePicker.CalendarMonthBackground = Color.FromArgb(49, 49, 49); datePicker.MinDate = DateTime.Today; datePicker.MaxDate = DateTime.MaxValue; datePicker.Value = DateTime.Today; List <ClassTimeModel> timeListStart = new List <ClassTimeModel>(); ClassTimeController timeControllerStart = new ClassTimeController(); timeListStart = timeControllerStart.Get(); comboBoxStartTime.DataSource = timeListStart; comboBoxStartTime.DisplayMember = "ClassTimeText"; comboBoxStartTime.ValueMember = "Id"; List <ClassTimeModel> timeListEnd = new List <ClassTimeModel>(); ClassTimeController timeControllerEnd = new ClassTimeController(); timeListEnd = timeControllerEnd.Get(); comboBoxEndTime.DataSource = timeListEnd; comboBoxEndTime.DisplayMember = "ClassTimeText"; comboBoxEndTime.ValueMember = "Id"; comboBoxClassType.DataSource = Enum.GetValues(typeof(ClassTypes)); }
public AllClassesForm(FacultyUserModel gotFaculty) { InitializeComponent(); faculty = gotFaculty; labelWelcome.Text = faculty.FullName; try { ClassController ccontroller = new ClassController(); List <ClassModel> allClassesList = ccontroller.GetByFacultyId(faculty.Id); //Console.WriteLine(allClassesList.Count + " improper classes"); List <ProperClassModel> properClassList = new List <ProperClassModel>(); foreach (ClassModel model in allClassesList) { ProperClassModel properModel = new ProperClassModel(); properModel.ClassDate = model.ClassDate; properModel.ClassType = model.ClassType; properModel.EndTimeId = model.EndTimeId; properModel.Id = model.Id; properModel.RoomNo = model.RoomNo; properModel.SectionId = model.SectionId; properModel.StartTimeId = model.StartTimeId; //Console.WriteLine("improper date: " + model.ClassDate + " | proper date: " + properModel.ClassDate); SectionController scontroller = new SectionController(); properModel.SectionName = scontroller.Get(model.SectionId).SectionName; ClassTimeController ctcontroller = new ClassTimeController(); properModel.Time = ctcontroller.Get(model.StartTimeId).ClassTimeText + " - " + ctcontroller.Get(model.EndTimeId).ClassTimeText; properClassList.Add(properModel); } MySortableBindingList <ProperClassModel> bindingClassesList = new MySortableBindingList <ProperClassModel>(properClassList); //Console.WriteLine(bindingClassesList.Count + " classes found"); dataGridViewClassList.AutoGenerateColumns = false; dataGridViewClassList.DataSource = bindingClassesList; dataGridViewSerial.AutoGenerateColumns = false; dataGridViewSerial.DataSource = bindingClassesList; } catch (Exception ex) { MessageBox.Show(ex.Message); } dataGridViewSerial.DataBindingComplete += (o, e) => { foreach (DataGridViewRow row in dataGridViewSerial.Rows) { row.Cells["sln"].Value = (row.Index + 1).ToString(); } }; }
public EditClassPopupForm(FacultyUserModel gotFaculty, ClassModel gotClass) { InitializeComponent(); faculty = gotFaculty; Class = gotClass; SectionController scontroller = new SectionController(); labelTitle.Text = "Edit class of " + scontroller.Get(Class.SectionId).SectionName + " on " + Class.ClassDate; datePicker.CalendarForeColor = Color.FromArgb(217, 217, 217); datePicker.CalendarMonthBackground = Color.FromArgb(49, 49, 49); datePicker.MinDate = DateTime.Today; datePicker.MaxDate = DateTime.MaxValue; datePicker.Value = DateTime.Parse(Class.ClassDate); List <ClassTimeModel> timeListStart = new List <ClassTimeModel>(); ClassTimeController timeControllerStart = new ClassTimeController(); timeListStart = timeControllerStart.Get(); comboBoxStartTime.DataSource = timeListStart; comboBoxStartTime.DisplayMember = "ClassTimeText"; comboBoxStartTime.ValueMember = "Id"; comboBoxStartTime.SelectedIndex = Class.StartTimeId - 1; List <ClassTimeModel> timeListEnd = new List <ClassTimeModel>(); ClassTimeController timeControllerEnd = new ClassTimeController(); timeListEnd = timeControllerEnd.Get(); comboBoxEndTime.DataSource = timeListEnd; comboBoxEndTime.DisplayMember = "ClassTimeText"; comboBoxEndTime.ValueMember = "Id"; comboBoxEndTime.SelectedIndex = Class.EndTimeId - 1; comboBoxClassType.DataSource = Enum.GetValues(typeof(ClassTypes)); comboBoxClassType.SelectedIndex = Convert.ToInt32(Class.ClassType); textBoxRoomNo.Text = Class.RoomNo; }
private void SearchForm_Load(object sender, EventArgs e) { flowTodaysClass.Width = panelLeft.Width + SystemInformation.VerticalScrollBarWidth; ClassController ccontroller = new ClassController(); ClassTimeController classTimeController = new ClassTimeController(); List <ClassModel> todaysClasses = ccontroller.GetByDateAndFacultyId(DateTime.Today.ToString("yyyy-MM-dd"), faculty.Id); int i = 0; foreach (ClassModel Class in todaysClasses) { FlowLayoutPanel todaysClassPanel = new FlowLayoutPanel(); todaysClassPanel.Size = new System.Drawing.Size(250, 80); todaysClassPanel.Margin = new Padding(0, 0, 0, 0); if (i % 2 == 0) { todaysClassPanel.BackColor = Color.FromArgb(59, 59, 59); } else { todaysClassPanel.BackColor = Color.FromArgb(48, 48, 48); } SectionController scontroller = new SectionController(); Label sectionName = new Label(); sectionName.Font = new Font("Arial", 9.5F, System.Drawing.FontStyle.Bold); sectionName.ForeColor = Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); sectionName.Location = new Point(8, 8); sectionName.Margin = new Padding(8, 5, 4, 4); sectionName.Size = new Size(188, 36); sectionName.TabIndex = 0; sectionName.Text = scontroller.Get(Class.SectionId).SectionName; sectionName.TextAlign = ContentAlignment.MiddleLeft; Button qr = new Button(); qr.BackgroundImage = Resources.qr; qr.BackgroundImageLayout = ImageLayout.Stretch; qr.FlatAppearance.BorderSize = 0; qr.Cursor = Cursors.Hand; qr.FlatStyle = FlatStyle.Flat; qr.Location = new Point(202, 8); qr.Margin = new Padding(2, 8, 2, 2); qr.Size = new Size(33, 33); qr.TabIndex = 4; qr.UseVisualStyleBackColor = true; qr.Click += delegate(object s, EventArgs ev) { qrButton_Click(sender, e, Class); }; Label classType = new Label(); classType.Font = new Font("Arial", 10.2F); classType.ForeColor = Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); classType.Location = new Point(8, 48); classType.Margin = new Padding(8, 0, 4, 4); classType.Name = "label2"; classType.Size = new Size(53, 28); classType.TabIndex = 1; classType.Text = Class.ClassType.ToString(); classType.TextAlign = ContentAlignment.MiddleLeft; Label time = new Label(); time.Font = new Font("Arial", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); time.ForeColor = Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); time.Location = new Point(69, 48); time.Margin = new Padding(4, 0, 4, 4); time.Size = new Size(104, 28); time.TabIndex = 2; time.Text = classTimeController.Get(Class.StartTimeId).ClassTimeText + " - " + classTimeController.Get(Class.EndTimeId).ClassTimeText; time.TextAlign = ContentAlignment.MiddleCenter; Label room = new Label(); room.Font = new Font("Arial", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); room.ForeColor = Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); room.Location = new Point(181, 48); room.Margin = new Padding(4, 0, 4, 4); room.Size = new Size(52, 28); room.TabIndex = 3; room.Text = Class.RoomNo; room.TextAlign = ContentAlignment.MiddleRight; todaysClassPanel.Controls.Add(sectionName); todaysClassPanel.Controls.Add(qr); todaysClassPanel.Controls.Add(classType); todaysClassPanel.Controls.Add(time); todaysClassPanel.Controls.Add(room); flowTodaysClass.Controls.Add(todaysClassPanel); i++; } }
public YourSectionsForm(FacultyUserModel gotFaculty) { InitializeComponent(); faculty = gotFaculty; labelWelcome.Text = faculty.FullName; SectionController controller = new SectionController(); try { List <SectionModel> sectionList = controller.GetByFaculty(faculty); if (sectionList.Count == 0) { Label noSections = new Label(); noSections.Text = "You have no sections added. To add a section,"; noSections.Font = new Font("Arial", 12, FontStyle.Regular); noSections.TextAlign = ContentAlignment.MiddleCenter; noSections.ForeColor = Color.FromArgb(217, 217, 217); noSections.AutoSize = true; noSections.Margin = new Padding(3, 3, 0, 3); flowLayoutPanelSections.Controls.Add(noSections); Label clickHere = new Label(); clickHere.Text = "click here"; clickHere.Font = new Font("Arial", 12, FontStyle.Underline); clickHere.ForeColor = Color.FromArgb(217, 217, 217); clickHere.Margin = new Padding(0, 3, 3, 3); clickHere.Cursor = Cursors.Hand; clickHere.Click += new System.EventHandler(this.ClickHere_Click);; flowLayoutPanelSections.Controls.Add(clickHere); } int r = 28; int g = 124; int b = 143; int i = 1; foreach (SectionModel model in sectionList) { //Console.WriteLine("Name: " + model.SectionName); FlowLayoutPanel sectionPanel = new FlowLayoutPanel(); sectionPanel.Width = 188; sectionPanel.Height = 110; sectionPanel.BorderStyle = BorderStyle.None; sectionPanel.Margin = new Padding(0, 3, 7, 5); sectionPanel.BackColor = Color.FromArgb(r, g, b); sectionPanel.FlowDirection = FlowDirection.LeftToRight; sectionPanel.WrapContents = true; sectionPanel.AutoScroll = false; sectionPanel.VerticalScroll.Visible = false; sectionPanel.HorizontalScroll.Enabled = false; flowLayoutPanelSections.Controls.Add(sectionPanel); Label labelSectionName = new Label(); labelSectionName.Text = model.SectionName; labelSectionName.Font = new Font("Arial", 10, FontStyle.Regular); labelSectionName.ForeColor = Color.FromArgb(217, 217, 217); labelSectionName.AutoSize = false; labelSectionName.Size = new Size(sectionPanel.Width - 4, 32); labelSectionName.Margin = new Padding(5, 8, 0, 3); labelSectionName.UseMnemonic = false; sectionPanel.Controls.Add(labelSectionName); SectionTimeController timeController = new SectionTimeController(); List <SectionTimeModel> sectionTimes = timeController.GetBySection(model); foreach (SectionTimeModel timeModel in sectionTimes) { WeekDayController dayCon = new WeekDayController(); ClassTimeController classCon = new ClassTimeController(); Label sectionTimeText1 = new Label(); sectionTimeText1.Text = timeModel.ClassType + ": " + dayCon.Get(timeModel.WeekDayId).WeekDayText.Substring(0, 3) + " " + classCon.Get(timeModel.StartTimeId).ClassTimeText + " - " + classCon.Get(timeModel.EndTimeId).ClassTimeText + " [" + timeModel.RoomNo + "]"; if (sectionTimes.Count == 2) { sectionTimeText1.AutoSize = true; } else { sectionTimeText1.Size = new Size(sectionPanel.Width - 4, 32); } sectionTimeText1.Font = new Font("Arial", 8, FontStyle.Italic); sectionTimeText1.ForeColor = Color.FromArgb(217, 217, 217); if (timeModel == sectionTimes[0]) { sectionTimeText1.Margin = new Padding(4, 0, 0, 0); } else { sectionTimeText1.Margin = new Padding(4, 0, 0, 4); } sectionPanel.Controls.Add(sectionTimeText1); } Button studentsButton = new Button(); studentsButton.Text = "Students"; studentsButton.BackColor = Color.FromArgb(38, 143, 164); studentsButton.Cursor = Cursors.Hand; studentsButton.FlatAppearance.BorderSize = 0; studentsButton.FlatStyle = FlatStyle.Flat; studentsButton.Font = new Font("Arial", 10F); studentsButton.ForeColor = Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); studentsButton.AutoSize = false; studentsButton.Size = new Size(75, 25); studentsButton.Margin = new Padding(12, 2, 6, 0); studentsButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; studentsButton.Dock = DockStyle.Bottom | DockStyle.Left; studentsButton.Click += delegate(object sender, EventArgs e) { studentsButton_Click(sender, e, model); }; sectionPanel.Controls.Add(studentsButton); Button editButton = new Button(); editButton.Text = "Edit"; editButton.BackColor = Color.FromArgb(38, 143, 164); editButton.Cursor = Cursors.Hand; editButton.FlatAppearance.BorderSize = 0; editButton.FlatStyle = FlatStyle.Flat; editButton.Font = new Font("Arial", 10F); editButton.ForeColor = Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); editButton.AutoSize = false; editButton.Size = new Size(75, 25); editButton.Margin = new Padding(6, 2, 12, 0); editButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; editButton.Click += delegate(object sender, EventArgs e) { editButton_Click(sender, e, model, sectionTimes); }; sectionPanel.Controls.Add(editButton); if (i % 3 == 0) { r -= 5; g -= 5; b -= 5; } i++; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public EditSectionForm(FacultyUserModel gotFaculty, SectionModel gotSection, List <SectionTimeModel> gotSectionTimes) { InitializeComponent(); faculty = gotFaculty; section = gotSection; sectionTimes = gotSectionTimes; labelWelcome.Text = faculty.FullName; labelEditSection.Text = "Edit section: " + section.SectionName; textBoxSectionName.Text = section.SectionName; List <WeekDayModel> dayList1 = new List <WeekDayModel>(); WeekDayController dayController1 = new WeekDayController(); dayList1 = dayController1.Get(); comboBoxWeekDay1.DataSource = dayList1; comboBoxWeekDay1.DisplayMember = "WeekDayText"; comboBoxWeekDay1.ValueMember = "Id"; comboBoxWeekDay1.SelectedIndex = sectionTimes[0].WeekDayId - 1; List <WeekDayModel> dayList2 = new List <WeekDayModel>(); WeekDayController dayController2 = new WeekDayController(); dayList2 = dayController2.Get(); comboBoxWeekDay2.DataSource = dayList2; comboBoxWeekDay2.DisplayMember = "WeekDayText"; comboBoxWeekDay2.ValueMember = "Id"; if (!(sectionTimes.Count == 1)) { comboBoxWeekDay2.SelectedIndex = sectionTimes[1].WeekDayId - 1; } List <ClassTimeModel> timeListStart1 = new List <ClassTimeModel>(); ClassTimeController timeControllerStart1 = new ClassTimeController(); timeListStart1 = timeControllerStart1.Get(); comboBoxStartTime1.DataSource = timeListStart1; comboBoxStartTime1.DisplayMember = "ClassTimeText"; comboBoxStartTime1.ValueMember = "Id"; comboBoxStartTime1.SelectedIndex = sectionTimes[0].StartTimeId - 1; List <ClassTimeModel> timeListStart2 = new List <ClassTimeModel>(); ClassTimeController timeControllerStart2 = new ClassTimeController(); timeListStart2 = timeControllerStart2.Get(); comboBoxStartTime2.DataSource = timeListStart2; comboBoxStartTime2.DisplayMember = "ClassTimeText"; comboBoxStartTime2.ValueMember = "Id"; if (!(sectionTimes.Count == 1)) { comboBoxStartTime2.SelectedIndex = sectionTimes[1].StartTimeId - 1; } List <ClassTimeModel> timeListEnd1 = new List <ClassTimeModel>(); ClassTimeController timeControllerEnd1 = new ClassTimeController(); timeListEnd1 = timeControllerEnd1.Get(); comboBoxEndTime1.DataSource = timeListEnd1; comboBoxEndTime1.DisplayMember = "ClassTimeText"; comboBoxEndTime1.ValueMember = "Id"; comboBoxEndTime1.SelectedIndex = sectionTimes[0].EndTimeId - 1; List <ClassTimeModel> timeListEnd2 = new List <ClassTimeModel>(); ClassTimeController timeControllerEnd2 = new ClassTimeController(); timeListEnd2 = timeControllerEnd2.Get(); comboBoxEndTime2.DataSource = timeListEnd2; comboBoxEndTime2.DisplayMember = "ClassTimeText"; comboBoxEndTime2.ValueMember = "Id"; if (!(sectionTimes.Count == 1)) { comboBoxEndTime2.SelectedIndex = sectionTimes[1].EndTimeId - 1; } comboBoxClassType1.DataSource = Enum.GetValues(typeof(ClassTypes)); comboBoxClassType2.DataSource = Enum.GetValues(typeof(ClassTypes)); comboBoxClassType1.SelectedItem = sectionTimes[0].ClassType; if (!(sectionTimes.Count == 1)) { comboBoxClassType2.SelectedItem = sectionTimes[1].ClassType; } textBoxRoomNo1.Text = sectionTimes[0].RoomNo; if (!(sectionTimes.Count == 1)) { textBoxRoomNo2.Text = sectionTimes[1].RoomNo; } //if (!(sectionTimes.Count == 1)) //Console.WriteLine(sectionTimes[0].Id + " " + sectionTimes[1].Id); if ((sectionTimes.Count == 1)) { checkBoxIgnore.Checked = true; panel3.Controls.Remove(comboBoxWeekDay2); panel3.Controls.Remove(labelTime2); panel3.Controls.Remove(labelFrom2); panel3.Controls.Remove(comboBoxStartTime2); panel3.Controls.Remove(labelTo2); panel3.Controls.Remove(comboBoxEndTime2); panel3.Controls.Remove(labelClassType2); panel3.Controls.Remove(comboBoxClassType2); panel3.Controls.Remove(labelRoomNo2); panel3.Controls.Remove(panelRoomNo2BG); panel3.Controls.Remove(textBoxRoomNo2); panel3.Controls.Remove(labelCheck); panel3.Controls.Remove(checkBoxIgnore); } else { panel3.Controls.Remove(labelCheck); panel3.Controls.Remove(checkBoxIgnore); } }
public FormCreateManual(FacultyUserModel gotFaculty) { InitializeComponent(); faculty = gotFaculty; labelWelcome.Text = faculty.FullName; List <WeekDayModel> dayList1 = new List <WeekDayModel>(); WeekDayController dayController1 = new WeekDayController(); dayList1 = dayController1.Get(); comboBoxWeekDay1.DataSource = dayList1; comboBoxWeekDay1.DisplayMember = "WeekDayText"; comboBoxWeekDay1.ValueMember = "Id"; List <WeekDayModel> dayList2 = new List <WeekDayModel>(); WeekDayController dayController2 = new WeekDayController(); dayList2 = dayController2.Get(); comboBoxWeekDay2.DataSource = dayList2; comboBoxWeekDay2.DisplayMember = "WeekDayText"; comboBoxWeekDay2.ValueMember = "Id"; List <ClassTimeModel> timeListStart1 = new List <ClassTimeModel>(); ClassTimeController timeControllerStart1 = new ClassTimeController(); timeListStart1 = timeControllerStart1.Get(); comboBoxStartTime1.DataSource = timeListStart1; comboBoxStartTime1.DisplayMember = "ClassTimeText"; comboBoxStartTime1.ValueMember = "Id"; List <ClassTimeModel> timeListStart2 = new List <ClassTimeModel>(); ClassTimeController timeControllerStart2 = new ClassTimeController(); timeListStart2 = timeControllerStart2.Get(); comboBoxStartTime2.DataSource = timeListStart2; comboBoxStartTime2.DisplayMember = "ClassTimeText"; comboBoxStartTime2.ValueMember = "Id"; List <ClassTimeModel> timeListEnd1 = new List <ClassTimeModel>(); ClassTimeController timeControllerEnd1 = new ClassTimeController(); timeListEnd1 = timeControllerEnd1.Get(); comboBoxEndTime1.DataSource = timeListEnd1; comboBoxEndTime1.DisplayMember = "ClassTimeText"; comboBoxEndTime1.ValueMember = "Id"; List <ClassTimeModel> timeListEnd2 = new List <ClassTimeModel>(); ClassTimeController timeControllerEnd2 = new ClassTimeController(); timeListEnd2 = timeControllerEnd2.Get(); comboBoxEndTime2.DataSource = timeListEnd2; comboBoxEndTime2.DisplayMember = "ClassTimeText"; comboBoxEndTime2.ValueMember = "Id"; comboBoxClassType1.DataSource = Enum.GetValues(typeof(ClassTypes)); comboBoxClassType2.DataSource = Enum.GetValues(typeof(ClassTypes)); }
public YourClassesForm(FacultyUserModel gotFaculty) { InitializeComponent(); faculty = gotFaculty; labelWelcome.Text = faculty.FullName; Label labelToday = new Label(); labelToday.Anchor = System.Windows.Forms.AnchorStyles.Left; labelToday.AutoSize = true; labelToday.Font = new System.Drawing.Font("Arial", 12.5F); labelToday.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); labelToday.Location = new System.Drawing.Point(25, 151); labelToday.Margin = new System.Windows.Forms.Padding(20, 10, 0, 10); labelToday.Name = "labelToday"; labelToday.Size = new System.Drawing.Size(52, 19); labelToday.TabIndex = 8; labelToday.Text = "Today"; labelToday.Margin = new Padding(25, 13, 0, 0); flowLayoutPanelClasses.Controls.Add(labelToday); Panel panelTodayUL = new Panel(); panelTodayUL.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); panelTodayUL.Location = new System.Drawing.Point(20, 178); panelTodayUL.Name = "panelTodayUL"; panelTodayUL.Size = new System.Drawing.Size(576, 1); panelTodayUL.TabIndex = 9; panelTodayUL.Margin = new Padding(19, 8, 0, 0); flowLayoutPanelClasses.Controls.Add(panelTodayUL); flowLayoutPanelToday.AutoScroll = false; flowLayoutPanelToday.AutoSize = true; flowLayoutPanelToday.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; flowLayoutPanelToday.Location = new System.Drawing.Point(20, 186); flowLayoutPanelToday.Name = "flowLayoutPanelToday"; flowLayoutPanelToday.Size = new System.Drawing.Size(0, 0); flowLayoutPanelToday.TabIndex = 10; flowLayoutPanelToday.ControlAdded += new System.Windows.Forms.ControlEventHandler(this.flowLayoutPanelToday_ControlAdded); flowLayoutPanelToday.WrapContents = true; flowLayoutPanelToday.FlowDirection = FlowDirection.LeftToRight; flowLayoutPanelToday.Margin = new Padding(19, 5, 0, 0); ClassController ccontroller = new ClassController(); List <ClassModel> todaysClasses = ccontroller.GetByDateAndFacultyId(DateTime.Today.ToString("yyyy-MM-dd"), faculty.Id); //todaysClasses.Sort(); //Console.WriteLine("Found " + todaysClasses.Count + "classes"); int r = 112; int g = 52; int b = 158; if (todaysClasses.Count != 0) { foreach (ClassModel model in todaysClasses) { Panel classPanel = new Panel(); classPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(r)))), ((int)(((byte)(g)))), ((int)(((byte)(b))))); classPanel.Size = new System.Drawing.Size(285, 71); classPanel.Margin = new Padding(0, 0, 5, 5); SectionController scontroller = new SectionController(); var gotSection = scontroller.Get(model.SectionId); Label sectionName = new Label(); sectionName.Text = gotSection.SectionName; sectionName.Anchor = System.Windows.Forms.AnchorStyles.Left; sectionName.AutoSize = false; sectionName.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); sectionName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); sectionName.Location = new System.Drawing.Point(10, 10); sectionName.Margin = new System.Windows.Forms.Padding(10, 10, 0, 0); sectionName.Name = "labelSectionName"; sectionName.Size = new System.Drawing.Size(217, 32); classPanel.Controls.Add(sectionName); Label classType = new Label(); classType.Text = model.ClassType.ToString(); classType.Anchor = System.Windows.Forms.AnchorStyles.Left; classType.AutoSize = true; classType.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Italic); classType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); classType.Location = new System.Drawing.Point(10, 45); classType.Margin = new System.Windows.Forms.Padding(10, 3, 0, 0); classType.Name = "labelClassType"; classType.Size = new System.Drawing.Size(53, 16); classPanel.Controls.Add(classType); ClassTimeController ctcontroller = new ClassTimeController(); Label classTime = new Label(); classTime.Text = ctcontroller.Get(model.StartTimeId).ClassTimeText + " - " + ctcontroller.Get(model.EndTimeId).ClassTimeText; classTime.Anchor = System.Windows.Forms.AnchorStyles.Left; classTime.AutoSize = true; classTime.Font = new System.Drawing.Font("Arial", 10F); classTime.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); classTime.Location = new System.Drawing.Point(73, 45); classTime.Margin = new System.Windows.Forms.Padding(10, 3, 0, 0); classTime.Name = "labelClassTime"; classTime.Size = new System.Drawing.Size(93, 16); classPanel.Controls.Add(classTime); Label roomNo = new Label(); roomNo.Text = model.RoomNo; roomNo.Anchor = System.Windows.Forms.AnchorStyles.Left; roomNo.AutoSize = true; roomNo.Font = new System.Drawing.Font("Arial", 10F); roomNo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); roomNo.Location = new System.Drawing.Point(176, 45); roomNo.Margin = new System.Windows.Forms.Padding(10, 3, 0, 0); roomNo.Name = "labelRoomNo"; roomNo.Size = new System.Drawing.Size(50, 16); classPanel.Controls.Add(roomNo); Button buttonEdit = new Button(); buttonEdit.BackgroundImage = Properties.Resources.edit; buttonEdit.Location = new System.Drawing.Point(250, 8); buttonEdit.Size = new System.Drawing.Size(20, 20); buttonEdit.FlatStyle = FlatStyle.Flat; buttonEdit.FlatAppearance.BorderSize = 0; buttonEdit.Cursor = Cursors.Hand; buttonEdit.BackgroundImageLayout = ImageLayout.Stretch; buttonEdit.Click += (sender, EventArgs) => { ButtonEdit_Click(sender, EventArgs, model); };; classPanel.Controls.Add(buttonEdit); Button buttonDelete = new Button(); buttonDelete.BackgroundImage = Properties.Resources.delete; buttonDelete.Location = new System.Drawing.Point(250, 40); buttonDelete.Size = new System.Drawing.Size(22, 22); buttonDelete.FlatStyle = FlatStyle.Flat; buttonDelete.FlatAppearance.BorderSize = 0; buttonDelete.Cursor = Cursors.Hand; buttonDelete.BackgroundImageLayout = ImageLayout.Center; buttonDelete.Click += (sender, EventArgs) => { ButtonDelete_Click(sender, EventArgs, model); };; classPanel.Controls.Add(buttonDelete); flowLayoutPanelToday.Controls.Add(classPanel); r -= 5; g -= 5; b -= 5; } } else { Label labelNoClasses = new Label(); labelNoClasses.Anchor = System.Windows.Forms.AnchorStyles.Left; labelNoClasses.AutoSize = false; labelNoClasses.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Italic); labelNoClasses.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); labelNoClasses.Location = new System.Drawing.Point(25, 151); labelNoClasses.Margin = new System.Windows.Forms.Padding(20, 10, 0, 10); labelNoClasses.Name = "labelToday"; labelNoClasses.Size = new System.Drawing.Size(500, 19); labelNoClasses.TabIndex = 8; labelNoClasses.Text = "No classes today"; labelNoClasses.Margin = new Padding(25, 13, 0, 0); flowLayoutPanelClasses.Controls.Add(labelNoClasses); } flowLayoutPanelClasses.Controls.Add(flowLayoutPanelToday); Label labelTomorrow = new Label(); labelTomorrow.Anchor = System.Windows.Forms.AnchorStyles.Left; labelTomorrow.AutoSize = false; labelTomorrow.Font = new System.Drawing.Font("Arial", 12.5F); labelTomorrow.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); labelTomorrow.Location = new System.Drawing.Point(25, 151); labelTomorrow.Margin = new System.Windows.Forms.Padding(20, 10, 0, 10); labelTomorrow.Name = "labelTomorrow"; labelTomorrow.Size = new System.Drawing.Size(500, 19); labelTomorrow.TabIndex = 8; labelTomorrow.Text = "Tomorrow"; labelTomorrow.Margin = new Padding(25, 13, 0, 0); flowLayoutPanelClasses.Controls.Add(labelTomorrow); Panel panelTommorrowUL = new Panel(); panelTommorrowUL.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); panelTommorrowUL.Location = new System.Drawing.Point(20, 178); panelTommorrowUL.Name = "panelTomorrowUL"; panelTommorrowUL.Size = new System.Drawing.Size(576, 1); panelTommorrowUL.TabIndex = 9; panelTommorrowUL.Margin = new Padding(19, 8, 0, 0); flowLayoutPanelClasses.Controls.Add(panelTommorrowUL); flowLayoutPanelTomorrow.AutoScroll = false; flowLayoutPanelTomorrow.AutoSize = true; flowLayoutPanelTomorrow.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; flowLayoutPanelTomorrow.Location = new System.Drawing.Point(20, 186); flowLayoutPanelTomorrow.Name = "flowLayoutPanelToday"; flowLayoutPanelTomorrow.Size = new System.Drawing.Size(0, 0); flowLayoutPanelTomorrow.TabIndex = 10; flowLayoutPanelTomorrow.ControlAdded += new System.Windows.Forms.ControlEventHandler(this.flowLayoutPanelToday_ControlAdded); flowLayoutPanelTomorrow.WrapContents = true; flowLayoutPanelTomorrow.FlowDirection = FlowDirection.LeftToRight; flowLayoutPanelTomorrow.Margin = new Padding(19, 5, 0, 0); List <ClassModel> tomorrowClasses = ccontroller.GetByDateAndFacultyId(DateTime.Today.AddDays(1).ToString("yyyy-MM-dd"), faculty.Id); //Console.WriteLine("Found " + todaysClasses.Count + "classes"); int r2 = 112; int g2 = 52; int b2 = 158; if (tomorrowClasses.Count != 0) { foreach (ClassModel model in tomorrowClasses) { Panel classPanel = new Panel(); classPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(r2)))), ((int)(((byte)(g2)))), ((int)(((byte)(b2))))); classPanel.Size = new System.Drawing.Size(285, 71); classPanel.Margin = new Padding(0, 0, 5, 5); SectionController scontroller = new SectionController(); var gotSection = scontroller.Get(model.SectionId); Label sectionName = new Label(); sectionName.Text = gotSection.SectionName; sectionName.Anchor = System.Windows.Forms.AnchorStyles.Left; sectionName.AutoSize = false; sectionName.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); sectionName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); sectionName.Location = new System.Drawing.Point(10, 10); sectionName.Margin = new System.Windows.Forms.Padding(10, 10, 0, 0); sectionName.Name = "labelSectionName"; sectionName.Size = new System.Drawing.Size(217, 32); classPanel.Controls.Add(sectionName); Label classType = new Label(); classType.Text = model.ClassType.ToString(); classType.Anchor = System.Windows.Forms.AnchorStyles.Left; classType.AutoSize = true; classType.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Italic); classType.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); classType.Location = new System.Drawing.Point(10, 45); classType.Margin = new System.Windows.Forms.Padding(10, 3, 0, 0); classType.Name = "labelClassType"; classType.Size = new System.Drawing.Size(53, 16); classPanel.Controls.Add(classType); ClassTimeController ctcontroller = new ClassTimeController(); Label classTime = new Label(); classTime.Text = ctcontroller.Get(model.StartTimeId).ClassTimeText + " - " + ctcontroller.Get(model.EndTimeId).ClassTimeText; classTime.Anchor = System.Windows.Forms.AnchorStyles.Left; classTime.AutoSize = true; classTime.Font = new System.Drawing.Font("Arial", 10F); classTime.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); classTime.Location = new System.Drawing.Point(73, 45); classTime.Margin = new System.Windows.Forms.Padding(10, 3, 0, 0); classTime.Name = "labelClassTime"; classTime.Size = new System.Drawing.Size(93, 16); classPanel.Controls.Add(classTime); Label roomNo = new Label(); roomNo.Text = model.RoomNo; roomNo.Anchor = System.Windows.Forms.AnchorStyles.Left; roomNo.AutoSize = true; roomNo.Font = new System.Drawing.Font("Arial", 10F); roomNo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); roomNo.Location = new System.Drawing.Point(176, 45); roomNo.Margin = new System.Windows.Forms.Padding(10, 3, 0, 0); roomNo.Name = "labelRoomNo"; roomNo.Size = new System.Drawing.Size(50, 16); classPanel.Controls.Add(roomNo); Button buttonEdit = new Button(); buttonEdit.BackgroundImage = Properties.Resources.edit; buttonEdit.Location = new System.Drawing.Point(250, 8); buttonEdit.Size = new System.Drawing.Size(20, 20); buttonEdit.FlatStyle = FlatStyle.Flat; buttonEdit.FlatAppearance.BorderSize = 0; buttonEdit.Cursor = Cursors.Hand; buttonEdit.BackgroundImageLayout = ImageLayout.Stretch; buttonEdit.Click += (sender, EventArgs) => { ButtonEdit_Click(sender, EventArgs, model); };; classPanel.Controls.Add(buttonEdit); Button buttonDelete = new Button(); buttonDelete.BackgroundImage = Properties.Resources.delete; buttonDelete.Location = new System.Drawing.Point(250, 40); buttonDelete.Size = new System.Drawing.Size(22, 22); buttonDelete.FlatStyle = FlatStyle.Flat; buttonDelete.FlatAppearance.BorderSize = 0; buttonDelete.Cursor = Cursors.Hand; buttonDelete.BackgroundImageLayout = ImageLayout.Center; buttonDelete.Click += (sender, EventArgs) => { ButtonDelete_Click(sender, EventArgs, model); };; classPanel.Controls.Add(buttonDelete); flowLayoutPanelTomorrow.Controls.Add(classPanel); r -= 5; g -= 5; b -= 5; } } else { Label labelNoClasses = new Label(); labelNoClasses.Anchor = System.Windows.Forms.AnchorStyles.Left; labelNoClasses.AutoSize = false; labelNoClasses.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Italic); labelNoClasses.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(217)))), ((int)(((byte)(217)))), ((int)(((byte)(217))))); labelNoClasses.Location = new System.Drawing.Point(25, 151); labelNoClasses.Margin = new System.Windows.Forms.Padding(20, 10, 0, 10); labelNoClasses.Name = "labelToday"; labelNoClasses.Size = new System.Drawing.Size(500, 19); labelNoClasses.TabIndex = 8; labelNoClasses.Text = "No classes tomorrow"; labelNoClasses.Margin = new Padding(25, 13, 0, 0); flowLayoutPanelClasses.Controls.Add(labelNoClasses); } flowLayoutPanelClasses.Controls.Add(flowLayoutPanelTomorrow); }