ScheduleWorks.UI.AddOrEditLessonForm.addDefaultControlsInformationWhenEditing C# (CSharp) Method

addDefaultControlsInformationWhenEditing() private method

private addDefaultControlsInformationWhenEditing ( ) : void
return void
        private void addDefaultControlsInformationWhenEditing()
        {
            Telerik.WinControls.UI.RadListDataItem radListDataItem4 = new Telerik.WinControls.UI.RadListDataItem();
            Telerik.WinControls.UI.RadListDataItem radListDataItem5 = new Telerik.WinControls.UI.RadListDataItem();
            Telerik.WinControls.UI.RadListDataItem radListDataItem6 = new Telerik.WinControls.UI.RadListDataItem();
            radListDataItem4.Text = "1 час";
            radListDataItem4.Value = 1;
            radListDataItem4.TextWrap = true;
            radListDataItem5.Text = "2 часа";
            radListDataItem5.Value = 2;
            radListDataItem5.TextWrap = true;
            radListDataItem6.Text = "без значение";
            radListDataItem6.Value = 3;
            radListDataItem6.TextWrap = true;
            try
            {
                switch (mLesson.HourLenght)
                {
                    case HourLenght.SingleHour:
                        radListDataItem4.Selected = true;
                        break;
                    case HourLenght.DoubleHour:
                        radListDataItem5.Selected = true;
                        break;
                    case HourLenght.NoMatter:
                        radListDataItem6.Selected = true;
                        break;

                }
            }
            catch
            {
                radListDataItem4.Selected = true;
            }
            this.dropDownListLessonLenght.Items.Add(radListDataItem4);
            this.dropDownListLessonLenght.Items.Add(radListDataItem5);
            this.dropDownListLessonLenght.Items.Add(radListDataItem6);

            foreach (Teacher t in mDBManager.Teachers)
            {
                RadListDataItem listDataItem = new RadListDataItem();
                listDataItem.Text = t.Name;
                listDataItem.Value = t.ID;

                if (t.ID == mLesson.Teacher.ID)
                {
                    listDataItem.Selected = true;
                }

                dropDownListTeachers.Items.Add(listDataItem);
            }

            foreach (Subject s in mDBManager.Subjects)
            {
                RadListDataItem listDataItem = new RadListDataItem();
                listDataItem.Text = s.Name;
                listDataItem.Value = s.ID;

                if (s.ID == mLesson.Subject.ID)
                {
                    listDataItem.Selected = true;
                }

                dropDownListSubjects.Items.Add(listDataItem);
            }

            foreach (Class c in mDBManager.Classes)
            {
                RadListDataItem listDataItem = new RadListDataItem();
                listDataItem.Text = c.Name;
                listDataItem.Value = c.ID;

                if (c.ID == mLesson.Class.ID)
                {
                    listDataItem.Selected = true;
                }

                dropDownListClasses.Items.Add(listDataItem);
            }

            foreach (Classroom c in mDBManager.Classrooms)
            {
                RadListDataItem listDataItem = new RadListDataItem();
                listDataItem.Text = c.Name;
                listDataItem.Value = c.ID;

                try
                {
                    if (c.ID == mLesson.DesiredClassroom.ID)
                    {
                        listDataItem.Selected = true;
                    }
                }
                catch { }

                dropDownListWantedRoom.Items.Add(listDataItem);
            }

            spinEditorHoursPerWeek.Value = mLesson.HoursPerWeek;
        }