Exemplo n.º 1
0
        //public DailyCheckViewModel DailyCheck
        //{
        //    get { return (DailyCheckViewModel)GetValue(DailyCheckProperty); }
        //    set { SetValue(DailyCheckProperty, value); }
        //}

        ////public static readonly DependencyProperty DailyCheckProperty = DependencyProperty.Register("DailyCheck", typeof(DailyCheckViewModel), typeof(StatusSelector), new FrameworkPropertyMetadata(null, OnDailyCheckPropertyChanged));
        //public static readonly DependencyProperty DailyCheckProperty = DependencyProperty.Register("DailyCheck", typeof(DailyCheckViewModel), typeof(StatusSelector), new FrameworkPropertyMetadata(OnDailyCheckPropertyChanged));

        //private static void OnDailyCheckPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        //{
        //}


        //private void CheckBox_Checked(object sender, RoutedEventArgs e)
        //{
        //    DeCheck = false;
        //    CheckBox checkbox = (sender as CheckBox);
        //    if (checkbox.Name.Equals("chkbxN"))
        //    {
        //        Reset();
        //    }

        //    if (checkbox != null)
        //    {
        //        bool found = false;
        //        foreach (UIElement element in panelSelectors.Children)
        //        {
        //            if (element == checkbox)
        //            {
        //                found = true;
        //                break;
        //            }
        //        }

        //        if (found)
        //        {
        //            // make checkboxes mutually exclusive
        //            foreach (UIElement element in panelSelectors.Children)
        //            {
        //                if (element is CheckBox && (element as CheckBox) != checkbox)
        //                {
        //                    CheckBox iCheckbox = (element as CheckBox);
        //                    //iCheckbox.IsChecked = null;
        //                    iCheckbox.IsChecked = false;
        //                }
        //            }
        //        }

        //        if (chkbx2.IsChecked == false)
        //        {
        //            // if the user changes the status from 'sick' to something else, then make sure the iso checkboxes get unchecked
        //            if (chkbx5.IsChecked == true) chkbx5.IsChecked = false;
        //            if (chkbx6.IsChecked == true) chkbx6.IsChecked = false;
        //        }
        //        else if (chkbx2.IsChecked == true)
        //        {
        //            if (chkbx5.IsChecked == false && chkbx6.IsChecked == false) chkbx7.IsChecked = true;
        //            if (chkbx5 == checkbox) chkbx6.IsChecked = false;
        //            if (chkbx6 == checkbox) chkbx5.IsChecked = false;
        //        }

        //        if (StatusChanged != null)
        //        {
        //            DailyCheckStatusChangedEventArgs args = new DailyCheckStatusChangedEventArgs(this);
        //            StatusChanged(DataContext as DailyCheckViewModel, args);
        //        }
        //    }
        //}

        public void Reset()
        {
            DailyCheckViewModel dcVM = DataContext as DailyCheckViewModel;

            if (dcVM != null)
            {
                dcVM.IsStatusUnknown = true;
            }
        }
Exemplo n.º 2
0
        private void Update()
        {
            if (IsLoading)
            {
                return;
            }

            if (StatusChanged != null)
            {
                DailyCheckStatusChangedEventArgs args = new DailyCheckStatusChangedEventArgs(this);

                DailyCheckViewModel dc = DataContext as DailyCheckViewModel;
                if (dc != null)
                {
                    StatusChanged(dc, args);

                    string friendlyStatus = "'not marked'/unknown";

                    if (dc.Status.HasValue)
                    {
                        switch (Convert.ToInt16(dc.Status.Value))
                        {
                        case 0:
                            friendlyStatus = "'seen and not sick'";
                            break;

                        case 1:
                            friendlyStatus = "'seen, sick, and isolated'";
                            break;

                        case 2:
                            friendlyStatus = "'seen and sick, not isolated'";
                            break;

                        case 3:
                            friendlyStatus = "'seen and sick, isolated not filled out'";
                            break;

                        case 4:
                            friendlyStatus = "'not seen'";
                            break;

                        case 5:
                            friendlyStatus = "'not recorded'";
                            break;
                        }
                    }

                    Epi.Logger.Log(DateTime.Now + ":  " +
                                   System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString() + ": " +
                                   "Contact " + dc.ContactID + " was updated in the daily or previous follow-up list on day " + dc.Day.ToString() + " to status: " + friendlyStatus);
                }
            }
        }