private void OnViewNotes(AppMessages.ViewNotesMessage.MessageData message)
        {
            try
            {
                MainViewModel viewModel = (MainViewModel)DataContext;

                // check to see if the patient is restricted
                bool canProceed = CanUserViewPatientData(message.SiteCode, message.PatientICN);
                if (!canProceed)
                {
                    MessageBox.Show("You cannot view information on this patient.", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }

                bool readOnly = viewModel.WorklistsViewModel.CurrentWorkList.Type == ExamListViewType.Patient ? true : false;
                NotesViewModel dialogViewModel = new NotesViewModel(viewModel.DataSource,
                                                                    message.SiteCode,
                                                                    message.PatientICN,
                                                                    message.PatientID,
                                                                    message.AccessionNr,
                                                                    message.CaseURN,
                                                                    readOnly);
                NotesView dialog = new NotesView(dialogViewModel);
                dialog.Owner = (message.Owner != null) ? message.Owner : this;

                ViewModelLocator.ContextManager.IsBusy = true;
                dialog.ShowDialog();
            }
            catch (Exception ex)
            {
                Log.Error("Failed to show notes.", ex);
                MessageBox.Show("Could not display notes for the case.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                ViewModelLocator.ContextManager.IsBusy = false;
            }
        }
Ejemplo n.º 2
0
 public MainWindow()
 {
     InitializeComponent();
     ViewModel        = new NotesViewModel();
     this.DataContext = ViewModel;
 }
Ejemplo n.º 3
0
 internal NotesView()
 {
     InitializeComponent();
     DataContext = new NotesViewModel();
 }
Ejemplo n.º 4
0
 public App(String filename)
 {
     InitializeComponent();
     NotesViewModel.Inicializador(filename);
     MainPage = new NotesView();
 }
Ejemplo n.º 5
0
 public NewNoteCommand(NotesViewModel vm)
 {
     VM = vm;
 }
Ejemplo n.º 6
0
 public NewNoteCommand(NotesViewModel notesViewModel)
 {
     NotesViewModel = notesViewModel;
 }
 public void SetNotes(NotesViewModel vmNotes)
 {
     SetNotesValues(vmNotes);
 }
Ejemplo n.º 8
0
        public allNotesPage()
        {
            Title = "Список дел";
            ToolbarItem toolbar_edit2 = new ToolbarItem {
                Icon = "toolbar_edit3.png"
            };

            toolbar_edit2.Clicked += Toolbar_edit2_Clicked;
            ToolbarItems.Add(ToolbarItem);
            ToolbarItems.Add(toolbar_edit2);
            BindingContext = new NotesViewModel()
            {
                Navigation = this.Navigation
            };

            notesListView = new CustomListView
            {
                //Margin = new Thickness(15,0,15,0),
                HasUnevenRows       = true,
                IsGroupingEnabled   = true,
                GroupHeaderTemplate = new DataTemplate(() =>
                {
                    Label headerLabel = new Label
                    {
                        TextColor      = Color.FromHex("0D47A1"),
                        FontAttributes = FontAttributes.None,
                        Margin         = new Thickness(25, 20, 0, 15)
                    };
                    headerLabel.SetBinding(Label.TextProperty, "Name");
                    return(new ViewCell
                    {
                        View = headerLabel
                    });
                }),
                ItemTemplate = new DataTemplate(() =>
                {
                    Label nameLabel = new Label
                    {
                        FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                        Margin   = new Thickness(5, 0, 0, 0)
                    };
                    nameLabel.SetBinding(Label.TextProperty, "Name");

                    Label commentLabel = new Label();
                    commentLabel.SetBinding(Label.TextProperty, "Comment");
                    commentLabel.SetBinding(Label.IsVisibleProperty, "HasComment");

                    Label sublabel = new Label {
                        IsVisible = false
                    };
                    sublabel.SetBinding(Label.TextProperty, "Subtasks_string", BindingMode.TwoWay);

                    int count_subtasks     = 0;
                    StackLayout subtasksSL = new StackLayout
                    {
                        Margin  = new Thickness(35, 0, 0, 0),
                        Spacing = 10
                    };
                    subtasksSL.SetBinding(StackLayout.IsVisibleProperty, "HasSubtasks");

                    sublabel.BindingContextChanged += (sender, e) =>
                    {
                        string str = sublabel.Text;
                        if (str != null)
                        {
                            string[] subtasks_array = str.Split(new char[] { '✖' });
                            foreach (char s in str)
                            {
                                if (s == '✖')
                                {
                                    count_subtasks++;
                                }
                            }

                            for (int i = 1; i <= count_subtasks; i++)
                            {
                                int subtask_index = i - 1;
                                CustomButton donesubtaskButton = new CustomButton
                                {
                                    FontSize          = Device.GetNamedSize(NamedSize.Micro, typeof(Button)),
                                    WidthRequest      = 23,
                                    HeightRequest     = 23,
                                    BorderRadius      = 12,
                                    BackgroundColor   = Color.Transparent,
                                    BorderWidth       = 1,
                                    BorderColor       = Color.LightGray,
                                    HorizontalOptions = LayoutOptions.Center,
                                    VerticalOptions   = LayoutOptions.Start
                                };
                                donesubtaskButton.SetBinding(Button.TextColorProperty, "TextColorSubtasks");
                                donesubtaskButton.SetBinding(Button.BorderColorProperty, "ColorSubtasks");

                                Label newsubtaskLabel = new Label
                                {
                                    FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Entry)),
                                    Text     = subtasks_array[i - 1]
                                };

                                if (Addition.IsStrikethrough(newsubtaskLabel.Text) == true)
                                {
                                    donesubtaskButton.Text = "✔";
                                }

                                StackLayout newsubtaskSL = new StackLayout
                                {
                                    Children    = { donesubtaskButton, newsubtaskLabel },
                                    Orientation = StackOrientation.Horizontal
                                };
                                subtasksSL.Children.Add(newsubtaskSL);

                                donesubtaskButton.Clicked += async(sender2, e2) =>
                                {
                                    string substringOld = newsubtaskLabel.Text;
                                    if (Addition.IsStrikethrough(newsubtaskLabel.Text) == true)
                                    {
                                        donesubtaskButton.Text = "";
                                        newsubtaskLabel.Text   = Addition.ConvertFromStrikethrough(newsubtaskLabel.Text);
                                    }
                                    else
                                    {
                                        donesubtaskButton.Text = "✔";
                                        newsubtaskLabel.Text   = Addition.ConvertToStrikethrough(newsubtaskLabel.Text);
                                    }

                                    subtasks_array[subtask_index] = newsubtaskLabel.Text;
                                    str           = String.Join("✖", subtasks_array);
                                    sublabel.Text = str;

                                    var note = sublabel?.BindingContext as NoteVM;
                                    await App.Database.SaveItemAsync(note);
                                    //var vm = BindingContext as NotesViewModel;
                                    //vm?.UpdateSubTasks(note);

                                    //Navigation.PopAsync();
                                    //Navigation.PopToRootAsync();

                                    //OnPropertyChanged2(sublabel.Text);
                                };
                            }
                        }
                    };

                    Label everydayLabel = new Label
                    {
                        Text     = "Каждый день",
                        FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label))
                    };
                    everydayLabel.SetBinding(Label.IsVisibleProperty, "Repeat");

                    Label overdueLabel = new Label {
                        FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label))
                    };
                    overdueLabel.SetBinding(Label.TextProperty, "Overdue_str");
                    overdueLabel.SetBinding(Label.IsVisibleProperty, "IsOverdue");

                    CustomButton doneButton = new CustomButton
                    {
                        FontSize          = Device.GetNamedSize(NamedSize.Micro, typeof(Button)),
                        WidthRequest      = 30,
                        HeightRequest     = 30,
                        BorderRadius      = 15,
                        BorderColor       = Color.LightGray,
                        BorderWidth       = 1,
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.Start,
                        Margin            = new Thickness(0, 1, 0, 0)
                    };
                    doneButton.SetBinding(Button.BorderWidthProperty, "ButtonsWidth");
                    doneButton.SetBinding(BackgroundColorProperty, "ColorMarker");
                    doneButton.Clicked += Done_Clicked;
                    doneButton.Clicked += (sender, e) =>
                    {
                        nameLabel.Text = Addition.ConvertToStrikethrough(nameLabel.Text);
                    };

                    Button removeButton = new Button
                    {
                        Text            = "✖",
                        BackgroundColor = Color.White,
                        TextColor       = Color.FromHex("0D47A1")
                    };
                    removeButton.Clicked += RemoveButton_Clicked;

                    Button editButton = new Button
                    {
                        Text            = "•••",
                        FontAttributes  = FontAttributes.Bold,
                        BackgroundColor = Color.White,
                        TextColor       = Color.FromHex("0D47A1")
                    };
                    editButton.Clicked += edit_Clicked;

                    StackLayout invisibleStackL = new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.Center,
                        Margin            = new Thickness(0, 10, 0, 0),
                        Padding           = new Thickness(-20, 0, 0, 0),
                        Children          = { removeButton, editButton }
                    };
                    invisibleStackL.SetBinding(StackLayout.IsVisibleProperty, "IsVisible");

                    return(new ViewCell
                    {
                        View = new StackLayout
                        {
                            Orientation = StackOrientation.Vertical,
                            Children =
                            {
                                new StackLayout
                                {
                                    Orientation = StackOrientation.Horizontal,
                                    Children =
                                    {
                                        doneButton,
                                        new StackLayout
                                        {
                                            Children =
                                            {
                                                nameLabel,
                                                new StackLayout
                                                {
                                                    Orientation = StackOrientation.Horizontal,
                                                    Children ={ everydayLabel, overdueLabel                },
                                                    Margin = new Thickness(5,                 0, 0, 0)
                                                },
                                            },
                                        }
                                    }
                                },
                                commentLabel,
                                sublabel,
                                subtasksSL,
                                invisibleStackL
                            },
                            Margin = new Thickness(10),
                            Padding = new Thickness(20, 0, 10, 0),
                            Spacing = 15,
                        }
                    });
                    //Label nameLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) };
                    //nameLabel.SetBinding(Label.TextProperty, "Name");

                    //Label everydayLabel = new Label
                    //{
                    //    Text = "Каждый день",
                    //    FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label))
                    //};
                    //everydayLabel.SetBinding(Label.IsVisibleProperty, "Repeat");

                    //Label overdueLabel = new Label { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) };
                    //overdueLabel.SetBinding(Label.TextProperty, "Overdue_str");
                    //overdueLabel.SetBinding(Label.IsVisibleProperty, "IsOverdue");

                    //Button doneButton = new Button
                    //{
                    //    Text = "✔",
                    //    BackgroundColor = Color.White,
                    //    TextColor = Color.FromHex("0D47A1")
                    //};
                    //doneButton.Clicked += Done_Clicked;

                    //Button removeButton = new Button
                    //{
                    //    Text = "✖",
                    //    BackgroundColor = Color.White,
                    //    TextColor = Color.FromHex("0D47A1")
                    //};
                    //removeButton.Clicked += RemoveButton_Clicked;

                    //Button editButton = new Button
                    //{
                    //    Text = "•••",
                    //    FontAttributes = FontAttributes.Bold,
                    //    BackgroundColor = Color.White,
                    //    TextColor = Color.FromHex("0D47A1")
                    //};
                    //editButton.Clicked += edit_Clicked;

                    //StackLayout invisibleStackL = new StackLayout
                    //{
                    //    Orientation = StackOrientation.Horizontal,
                    //    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    //    Margin = new Thickness(0, 10, 0, 0),
                    //    Children = { doneButton,removeButton, editButton }
                    //};
                    //invisibleStackL.SetBinding(StackLayout.IsVisibleProperty, "IsVisible");

                    //Grid grid = new Grid
                    //{
                    //    ColumnDefinitions =
                    //    {
                    //        new ColumnDefinition { Width = new GridLength(0.95, GridUnitType.Star)},
                    //        new ColumnDefinition { Width = new GridLength(0.05, GridUnitType.Star)}
                    //    },
                    //    ColumnSpacing = 0
                    //};

                    //BoxView boxView = new BoxView();
                    //boxView.SetBinding(BackgroundColorProperty, "ColorMarker");


                    //grid.Children.Add(new StackLayout
                    //{
                    //    Orientation = StackOrientation.Vertical,
                    //    Children = { nameLabel,
                    //            new StackLayout
                    //            {   Orientation = StackOrientation.Horizontal,
                    //                Children ={everydayLabel,overdueLabel}},
                    //    invisibleStackL },
                    //    Margin = new Thickness(10),
                    //    Padding = new Thickness(35, 0, 0, 0),
                    //    Spacing = 15,
                    //}, 0, 0);
                    //grid.Children.Add(boxView, 1, 0);

                    //return new ViewCell
                    //{
                    //    View = grid
                    //};
                })
            };
            notesListView.ItemTapped += NotesListView_ItemTapped;

            addButton = new Button
            {
                Text              = "+",
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Button)),
                BackgroundColor   = Color.FromHex("E3F2FD"),
                TextColor         = Color.FromHex("0D47A1"),
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.End,
                WidthRequest      = 70,
                HeightRequest     = 70,
                BorderRadius      = 35,
                Margin            = new Thickness(0, 0, 20, 20)
            };
            addButton.SetBinding(Button.CommandProperty, "CreateNoteCommand");
            pastactionLabel = new Label
            {
                Text = "Отменить",
                //IsVisible = false,
                //IsVisible = true,
                //IsVisible = App.pastaction,
                //TextColor =Color.Red,
                TextColor         = Color.FromHex("0D47A1"),
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };
            pastactionLabel.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() => pastactionLabel.Text = "Кликнул"),
            });

            RelativeLayout relativeLayout = new RelativeLayout();

            relativeLayout.Children.Add(notesListView,
                                        Constraint.RelativeToParent((parent) => parent.X),
                                        Constraint.RelativeToParent((parent) => parent.Y /*+ 20*/),
                                        //Constraint.RelativeToView(pastactionLabel, (parent,view)=>/*parent.Y+*/pastactionLabel.Height),
                                        Constraint.RelativeToParent((parent) => parent.Width),
                                        Constraint.RelativeToParent((parent) => parent.Height /** .975*/));

            //double pastactionLabelWidth(RelativeLayout parent) => pastactionLabel.Measure(parent.Width, parent.Height).Request.Width;
            ////double pastactionLabelHeight(RelativeLayout parent) => pastactionLabel.Measure(parent.Width, parent.Height).Request.Height;
            //relativeLayout.Children.Add(pastactionLabel,
            //    //Constraint.RelativeToParent(parent => parent.Width / 2 - pastactionLabelWidth(parent) / 2),
            //    //Constraint.RelativeToParent(parent => notesListView.Width)
            //    Constraint.RelativeToView(notesListView, (parent, view) => notesListView.Width - pastactionLabelWidth(parent)),
            //    Constraint.RelativeToParent(parent => parent.Y+5)
            //    );

            //double getnonotesLabelWidth(RelativeLayout parent) => nonotesLabel.Measure(parent.Width, parent.Height).Request.Width;
            //relativeLayout.Children.Add(nonotesLabel,
            //    Constraint.RelativeToParent(parent => parent.Width / 2 - getnonotesLabelWidth(parent) / 2),
            //    Constraint.RelativeToParent(parent => parent.Height*.45));
            double getnonotesImageWidth(RelativeLayout parent) => nonotesImage.Measure(parent.Width, parent.Height).Request.Width;
            double getnonotesImageHeight(RelativeLayout parent) => nonotesImage.Measure(parent.Width, parent.Height).Request.Width;

            relativeLayout.Children.Add(nonotesImage,
                                        Constraint.RelativeToParent(parent => /*parent.Width/2- 100*/ parent.Width / 2 - getnonotesImageWidth(parent) / 2),
                                        Constraint.RelativeToParent(parent => parent.Height / 2 - getnonotesImageHeight(parent) / 2 /*parent.Height/2-100*/ /*parent.Height * .45*/));

            relativeLayout.Children.Add(addButton,
                                        Constraint.RelativeToParent((parent) => parent.Width * .75),
                                        Constraint.RelativeToParent((parent) => parent.Height * .8125));

            this.BackgroundColor = Color.White;
            this.Content         = relativeLayout;
        }
Ejemplo n.º 9
0
 public HasEditedCommand(NotesViewModel viewModel)
 {
     ViewModel = viewModel;
 }
Ejemplo n.º 10
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new NotesViewModel(ToastGrid);
 }
Ejemplo n.º 11
0
 public BeginEditCommand(NotesViewModel viewModel)
 {
     ViewModel = viewModel;
 }
        // GET: NotesController/Delete/5
        public ActionResult Delete(int id, NotesViewModel notesViewModel)
        {
            var note = _nContainer.GetNoteById(id);

            return(View(new NotesViewModel(note)));
        }
 // GET: NotesController/Create
 public ActionResult Create(NotesViewModel notesViewModel)
 {
     return(View(notesViewModel));
 }
Ejemplo n.º 14
0
 public ActionResult _ViewCancelNotes(NotesViewModel model)
 {
     return(PartialView("~/Views/Shared/_ViewCancelNotes.cshtml", model));
 }
Ejemplo n.º 15
0
 public NewNoteBookCommand(NotesViewModel notesViewModel)
 {
     this.NotesViewModel = notesViewModel;
 }
 public NewNotebookCommand(NotesViewModel vm)
 {
     NotesViewModel = vm;
 }
Ejemplo n.º 17
0
 public DeleteNoteCommand(NotesViewModel vm)
 {
     VM = vm;
 }
Ejemplo n.º 18
0
 public MainPage()
 {
     InitializeComponent();
     BindingContext = new NotesViewModel();
     (BindingContext as ViewModelBase).Navigation = Navigation;
 }
Ejemplo n.º 19
0
        public async Task <IActionResult> Notes(int?entityId, string searchedStringInText,
                                                int?categoryId, string exactDate, string fromDate, string toDate, string creator,
                                                NotesSearchByStatus searchByStatus, string sortOption, bool sortIsAscending, int?pageNumber)
        {
            string userId   = GetLoggedUserId();
            var    userName = HttpContext.User.Identity.Name;

            var entities = await _userEntitiesService.GetAllUserEntitiesAsync(userId);

            var selectedEntityId = entityId ?? entities[0].EntityId;
            var entityCategories = await GetEntityCategoriesAsync(selectedEntityId);

            int pageSize  = 5;
            int pageIndex = pageNumber ?? 1;
            int?skip      = (pageIndex - 1) * (pageSize);
            int?take      = pageSize;

            AddNoteViewModel addNoteVm = new AddNoteViewModel()
            {
                Note = new NoteViewModel
                {
                    EntityId = selectedEntityId,
                    NoteUser = new NoteUserViewModel
                    {
                        Id   = userId,
                        Name = userName
                    }
                },
                EntityCategories = entityCategories,
            };

            NotesSearchResultDTO notesSearchResult = null;
            string errorMessage = null;

            try
            {
                notesSearchResult = await _notesService.SearchAsync(selectedEntityId, searchedStringInText,
                                                                    categoryId, ParseNullableDate(exactDate), ParseNullableDate(fromDate),
                                                                    ParseNullableDate(toDate), creator, searchByStatus, sortOption, sortIsAscending,
                                                                    skip, pageSize);
            }
            catch (ApplicationException ex)
            {
                errorMessage = ex.Message;
            }
            catch (Exception ex)
            {
                errorMessage = "Error loading notes. Please try again.";
            }
            NotesViewModel vm = CreateNotesViewModel(searchedStringInText, categoryId,
                                                     exactDate, fromDate, toDate,
                                                     creator, searchByStatus, sortOption, sortIsAscending,
                                                     entities, selectedEntityId, entityCategories,
                                                     pageSize, addNoteVm, null, null);

            if (!string.IsNullOrEmpty(errorMessage))
            {
                vm.ErrorMessage = errorMessage;
                return(View(vm));
            }

            var notes      = notesSearchResult.Notes;
            var notesCount = notesSearchResult.NotesCount;


            var previousPageLink = Url.Action(nameof(Notes), "Notes", new
            {
                entityId,
                searchedStringInText,
                categoryId,
                exactDate,
                fromDate,
                toDate,
                creator,
                sortOption,
                sortIsAscending,
                pageNumber = (pageNumber ?? 1) - 1
            });


            var nextPageLink = Url.Action(nameof(Notes), "Notes", new
            {
                entityId,
                searchedStringInText,
                categoryId,
                exactDate,
                fromDate,
                toDate,
                creator,
                sortOption,
                sortIsAscending,
                pageNumber = (pageNumber ?? 1) + 1
            });

            vm.Notes = new PaginatedList <NoteViewModel>(
                notes.Select(x => ConvertNoteDtoToNoteViewModel(x, userId)).ToList(),
                notesCount, pageIndex, pageSize);
            vm.PreviousPageLink = previousPageLink;
            vm.NextPageLink     = nextPageLink;

            return(View(vm));
        }
Ejemplo n.º 20
0
        internal NotesView(NotesViewModel viewModel)
        {
            InitializeComponent();

            DataContext = viewModel;
        }
Ejemplo n.º 21
0
 public NotesListPage(Notes notes = null)
 {
     InitializeComponent();
     _notes         = notes;
     BindingContext = new NotesViewModel(_notes);
 }
Ejemplo n.º 22
0
 public void SetNotes(NotesViewModel notes)
 {
     SetNotesValues(notes);
 }
Ejemplo n.º 23
0
        public NotesPage()
        {
            InitializeComponent();

            BindingContext = viewModel = new NotesViewModel();
        }
Ejemplo n.º 24
0
        public NotesDialog()
        {
            InitializeComponent();

            DataContext = new NotesViewModel();
        }
Ejemplo n.º 25
0
 public NewNoteCommand(NotesViewModel viewModel)
 {
     ViewModel = viewModel;
 }
Ejemplo n.º 26
0
 public HasEditedCommand(NotesViewModel vm)
 {
     VM = vm;
 }
Ejemplo n.º 27
0
 public BeginEditCommand(NotesViewModel vm)
 {
     VM = vm;
 }