Exemple #1
0
        private void InitCommand()
        {
            BackCmd = new RelayCommand(() =>
            {
                servObj = new WebService();

                if (!SetSearchPatientData())
                {
                    MessageBoxResult msgResult = MessageBox.Show("Are you sure to back?",
                                                                 "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (msgResult == MessageBoxResult.Yes)
                    {
                        SearchPatient = null;
                        navigationService.GoBack();
                    }
                }
                else
                {
                    SearchPatient = null;
                    navigationService.GoBack();
                }
            });

            OnLoad = new RelayCommand(() =>
            {
                servObj = new WebService();
                SetSearchPatient();
                SetPatientData();
            });

            ChangePatientDataCmd = new RelayCommand(() =>
            {
                if (!SetSearchPatientData())
                {
                    if (error != "" || PatientFirstName == null || PatientSecondName == null || PatientDOB == null || PatientEmail == null || PatientMRN == null || PatientSex == null)
                    {
                        MessageBox.Show("Invalid data!",
                                        "Confirmation", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        SearchPatient = new Patient {
                            DOB = PatientDOB, Email = PatientEmail, FirstName = PatientFirstName, MRN = PatientMRN, SecondName = PatientSecondName, Sex = SelectedPatientSex
                        };
                        servObj = new WebService();
                        servObj.UpdatePatientData(SearchPatient.MRN, SearchPatient.FirstName, SearchPatient.SecondName, SearchPatient.DOB.Date, true, SearchPatient.Sex, SearchPatient.Email);
                        MessageBox.Show("Succesfull",
                                        "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
                        navigationService.GoBack();
                    }
                }
                else
                {
                    MessageBox.Show("Nie wprowadzono zmian",
                                    "Confirmation", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            });
        }
        public EventCreateViewModel(IMyNavigationService navigationService)
        {
            var database = new NoteDatabase();

            SaveNoteCommand = new Command(() => {
                Event.Attendees = "";
                foreach (Person p in people)
                {
                    Event.Attendees += p.NoteId + ",";
                }
                Event.Attendees = Event.Attendees.Trim(',');
                var cal         = new MyCalendar();

                if (!(Event.CalId <= 0))
                {
                    cal.removeSystemCal(Event.CalId);
                }
                //Debug.WriteLine(Event.TimeStamp);
                long newid  = cal.addToSystemCal(Event.TimeStamp, Event.titleText, Event.NoteDetail, Event.LocationText);
                Event.CalId = newid;
                //Debug.WriteLine(Event.TimeStamp);
                Event.TimeStamp = Event.TimeStamp.AddHours(10);                //stop the database messing up dates
                database.InsertOrUpdateNote(Event);
                //Debug.WriteLine(database.GetNote(id).TimeStamp);
                navigationService.GoBack();
            });
        }
 public NoteDetailViewModel(IMyNavigationService navigationService)
 {
     var database = new NoteDatabase();
     SaveNoteCommand = new Command (() => {
         database.InsertOrUpdateNote(new Note(NoteTitle,DateTime.Now.ToString(),NoteActionFlag.ToString(),NoteDetail));
         navigationService.GoBack();
     });
 }
 public ReminderDetailViewModel(IMyNavigationService navigationService)
 {
     var database = new RemindersTable();
     SaveReminderCommand = new Command (() => {
         database.InsertOrUpdateNote(new Reminder(ReminderTitle,DateTime.Now.ToString(),ReminderActionFlag.ToString(),ReminderDetail));
         navigationService.GoBack();
     });
 }
		public EmployeeDetailViewModel (IMyNavigationService navigationService)
		{
			var database = new EmployeeDatabase();
			SaveNoteCommand = new Command (() => {
				database.InsertOrUpdateNote(new Employee(EmployeeName,DateTime.Now.ToString(),EmployeeAvailebleTime.ToString(),EmployeePosition));
				navigationService.GoBack();
			});
		}
Exemple #6
0
        private void InitCommand()
        {
            BackCmd = new RelayCommand(() =>
            {
                if (TestType != null || SelectedPriority != 0 || TestSpecimenCode != null || SelectedTitle != null)
                {
                    MessageBoxResult msgResult = MessageBox.Show("Are you sure to back?",
                                                                 "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    if (msgResult == MessageBoxResult.Yes)
                    {
                        TestType = SelectedTitle = TestSpecimenCode = null; SelectedPriority = TestOrderNumber = 0;
                        navigationService.NavigateTo(ViewModelLocator.PatientKey);
                    }
                }
                else
                {
                    navigationService.GoBack();
                }
            });

            AddTestCmd = new RelayCommand(() =>
            {
                if (ViewModelLocator.OrderNumberViewModel != 0)
                {
                    TestModel testModel = new TestModel(SelectedTitle, TestType, 0, TestSpecimenCode, SelectedPriority, false, TestOrderNumber);
                    ViewModelLocator.TestModelList.Add(testModel);
                    //servObj.CreateTestData(ConverterDataBase.toDataBase(testModel));
                    TestType = SelectedTitle = TestSpecimenCode = null; SelectedPriority = TestOrderNumber = 0;
                    navigationService.GoBack();
                }
            });

            OnLoad = new RelayCommand(() =>
            {
                TestTitle.Clear();
                LoadAllTest();
                if (ViewModelLocator.OrderNumberViewModel != 0)
                {
                    TestOrderNumber = ViewModelLocator.OrderNumberViewModel;
                }
                else
                {
                    TestOrderNumber = servObj.NextIdOrder();
                }
            });
        }
Exemple #7
0
		public ImagePickerViewModel(IMyNavigationService navigationService)
		{

			OnSelectImage = new Command(() => {
                //create new model for adding a step
                //Do something e.g:
                navigationService.GoBack();
//                 navigationService.NavigateTo(ViewModelLocator.SamplePagePageKey);
            });
//            SaveAndQuit = new Command(() =>
//            {
//                //actually implement saving somewhere here
//                navigationService.GoBack();
//            });
//            OpenImageSelector = new Command(() =>
//            {
//                //once i get the image selecor in it'll go here
//                //navigationService.NavigateTo();
//            });

		}
Exemple #8
0
        public AddActivityViewModel(IMyNavigationService navigationService)
        {
            var database = new ActivityDatabase();

            DemoButtonCommand = new Command(() => {
                //create new model for adding a step
                //Do something e.g:
                //navigationService.GoBack();
                // navigationService.NavigateTo(ViewModelLocator.SamplePagePageKey);
            });

            SaveAndQuit = new Command(() => {
                database.InsertOrUpdateActivity(new Activities(ActivityName, ActivityLocation, 1, false));
                navigationService.GoBack();
            });

            OpenImageSelector = new Command(() =>
            {
                //once i get the image selecor in it'll go here
                //navigationService.NavigateTo();
                navigationService.NavigateTo(ViewModelLocator.ImagePickerPageKey);
            });
        }
		public AddActivityViewModel(IMyNavigationService navigationService)
		{
			var database = new ActivityDatabase();

			DemoButtonCommand = new Command(() => {
				//create new model for adding a step
				//Do something e.g:
				//navigationService.GoBack();
				// navigationService.NavigateTo(ViewModelLocator.SamplePagePageKey);
			});

			SaveAndQuit = new Command (() => {
				database.InsertOrUpdateActivity(new Activities(ActivityName, ActivityLocation, 1, false));
				navigationService.GoBack();
			});

			OpenImageSelector = new Command(() =>
			{
				//once i get the image selecor in it'll go here
				//navigationService.NavigateTo();
				navigationService.NavigateTo(ViewModelLocator.ImagePickerPageKey);

			});
		}
        public EventCreateViewModel(IMyNavigationService navigationService)
        {
            var database = new NoteDatabase();
            SaveNoteCommand = new Command (() => {
                Event.Attendees = "";
                foreach(Person p in people){
                    Event.Attendees += p.NoteId + ",";
                }
                Event.Attendees = Event.Attendees.Trim(',');
                var cal = new MyCalendar ();

                if(! (Event.CalId <= 0)){
                    cal.removeSystemCal(Event.CalId);
                }
                //Debug.WriteLine(Event.TimeStamp);
                long newid = cal.addToSystemCal(Event.TimeStamp, Event.titleText, Event.NoteDetail, Event.LocationText);
                Event.CalId = newid;
                //Debug.WriteLine(Event.TimeStamp);
                Event.TimeStamp = Event.TimeStamp.AddHours(10);//stop the database messing up dates
                database.InsertOrUpdateNote(Event);
                //Debug.WriteLine(database.GetNote(id).TimeStamp);
                navigationService.GoBack();
            });
        }
		public EventViewModel(IMyNavigationService navigationService)
		{
			this.navigationService = navigationService;
			var database = new EventDatabase ();

			NewEventCommand = new Command (() => this.navigationService.NavigateTo (ViewModelLocator.EventPageKey));
			SaveEventCommand = new Command (() => {
				database.InsetOrUpdateEvent (new Event (EventName, EventTime, EventDate, EventLocation, EventAttendees, IsPublic, GuestCanInvite));
				navigationService.GoBack ();
			});

		}