示例#1
0
        public void Get()
        {
            // Arrange

            WeekDayController controller = new WeekDayController(weekDayProvider);

            // Act
            object result = controller.Get();

            Assert.IsNotNull(result);
            if (HasProperty(result, "Total"))
            {
                object total = result.GetType().GetProperty("Total").GetValue(result);
                Assert.AreEqual(254, total);
            }
        }
示例#2
0
        public void GetBusinessDays()
        {
            // Arrange
            // Arrange
            WeekDayController controller = new WeekDayController(weekDayProvider);

            // Act
            string startDate = new DateTime(2019, 11, 20).ToString("dd-MM-yyyy");
            string endDate   = new DateTime(2019, 12, 31).ToString("dd-MM-yyyy");
            object result    = controller.Get(startDate, endDate);

            Assert.IsNotNull(result);
            if (HasProperty(result, "Total"))
            {
                object total = result.GetType().GetProperty("Total").GetValue(result);
                Assert.AreEqual(26, total);
            }
        }
示例#3
0
        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);
            }
        }
示例#5
0
        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));
        }
示例#6
0
 public static WeekDayController Fixture()
 {
     WeekDayController controller = new WeekDayController(new WeekDayRepository(), "", new LoginView());
     return controller;
 }
示例#7
0
        public static WeekDayController Fixture()
        {
            WeekDayController controller = new WeekDayController(new WeekDayRepository(), "", new LoginView());

            return(controller);
        }