示例#1
0
        private void LoadStatusToLabel(ClassCalendar calendar)
        {
            IEnumerable <ClassStatus> query =
                from elem in sql.StatusList()
                where elem.StatusId == calendar.Status.StatusId
                select elem;

            if (!query.Any())
            {
                throw new Exception("Unable to find apropriate status in database");
            }
            Status_Label.Text = query.First().Status;

            //Check if update status to Waitng to Veryfy
            if (Status_Label.Text == ClassStatus.StatusString(EnumStatus.SharedForDoctors))
            {
                sql.UpdateCalendar(calendar.CalendarId);
                List <ClassCalendar> list = sql.CalendarList();
                if (calendar.Status.StatusId != GetCalendarForSelectedCalendarInComboboxFromDataBase().Status.StatusId)
                {
                    ComboBoxPickDate.ItemsSource = sql.CalendarList();
                    if (ComboBoxPickDate.Items.Count == 0)
                    {
                        return;
                    }
                    ComboBoxPickDate.SelectedIndex = ComboBoxPickDate.Items.Count - 1;
                }
            }
        }