private void UpdatePeople()
        {
            people = PersonDataProvider.GetPeople();
            DateTime ActualTime = DateTime.Now;

            dateText.Content = "Today's date is: " + ActualTime.ToShortDateString().ToString();
            List <Person> SortedList = people.OrderBy(o => o.DateOfArrival).ToList();

            PatientDiagnosedDataGrid.Items.Clear();
            PatientLaterDataGrid.Items.Clear();
            PatientTodayDataGrid.Items.Clear();
            foreach (Person p in SortedList)
            {
                if (p.Diagnosis == null)
                {
                    if (p.DateOfArrival.ToShortDateString() == ActualTime.ToShortDateString())
                    {
                        PatientTodayDataGrid.Items.Add(p);
                    }
                    else
                    {
                        PatientLaterDataGrid.Items.Add(p);
                    }
                }
                else
                {
                    PatientDiagnosedDataGrid.Items.Add(p);
                }
            }
        }
        public bool ValidateDate(string date)
        {
            bool     result = true;
            DateTime DateChecker;

            if (DateTime.TryParse(date, out DateChecker) == false)
            {
                result = false;
            }
            else if (date.Length == 16 || date.Length == 19)
            {
                result = true;
            }
            else
            {
                result = false;
            }
            if (result != false)
            {
                if (DateChecker.Ticks < DateTime.Now.Ticks)
                {
                    result = false;
                }
                IList <Person> person = PersonDataProvider.GetPeople();
                var            match  = person.Where(p => p.DateOfArrival == DateChecker);
                IList <Person> act    = match.ToList();
                if (act.Count != 0)
                {
                    return(false);
                }
            }
            return(result);
        }
        public async Task Build_DropEverything_BuildsDatabase()
        {
            // Arrange
            var settings =
                new SettingsBuilder()
                .AddConvention(new CamelCaseElementNameConvention(), x => true)
                .AddDatabase("test1")
                .WithConnectionString("mongodb://localhost:27017")
                .DropDatabaseFirst()
                .AddCollection("col1", true, "Collection1.json")
                .AddCollection <Person>("people", true, new PersonDataProvider())
                .AddDatabase("test2")
                .WithConnectionString("mongodb://localhost:27017")
                .DropDatabaseFirst()
                .AddCollection("col2", true, "Collection2.json")
                .Build();

            var sut = new MongoSessionManager(settings);

            this.DbNames.Add("test1");
            this.DbNames.Add("test2");


            // Act
            var connections = sut.Build();


            // Assert
            Assert.Single(connections);

            this.Client = connections["mongodb://localhost:27017"];

            var test1    = this.Client.GetDatabase("test1");
            var col1     = test1.GetCollection <BsonDocument>("col1");
            var results1 = (await col1.FindAsync <BsonDocument>(new BsonDocument())).ToList();

            Assert.Equal(2, results1.Count);
            Assert.Equal("Value1b", results1[0].GetElement("Col1b").Value);
            Assert.Equal("Value2b", results1[0].GetElement("Col2b").Value);
            Assert.Equal("Value3b", results1[1].GetElement("Col1b").Value);
            Assert.Equal("Value4b", results1[1].GetElement("Col2b").Value);

            var peopleCol = test1.GetCollection <BsonDocument>("people");
            var people    = (await peopleCol.FindAsync <Person>(new BsonDocument())).ToList();

            Assert.Equal(3, people.Count);
            var data = new PersonDataProvider().GetData().ToList();

            Assert.True(people[0].IsEqual(data[0] as Person));
            Assert.True(people[1].IsEqual(data[1] as Person));
            Assert.True(people[2].IsEqual(data[2] as Person));

            var test2    = this.Client.GetDatabase("test2");
            var col2     = test2.GetCollection <BsonDocument>("col2");
            var results2 = (await col2.FindAsync <BsonDocument>(new BsonDocument())).ToList();

            Assert.Equal(2, results2.Count);
        }
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("Do you really want to delete the selected patient?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         PersonDataProvider.DeletePerson(_person.Id);
         DialogResult = true;
         Close();
     }
 }
Exemple #5
0
 private void UpdateButton_Click(object sender, RoutedEventArgs e)
 {
     if (ValidatePerson())
     {
         _person.Diagnosis = DiagnosisTextBox.Text;
         PersonDataProvider.UpdatePerson(_person);
         DialogResult = true;
         Close();
     }
 }
 public MainWindowViewModel()
 {
     Source        = new List <Person>(PersonDataProvider.GetDummyData());
     SelectedItems = new List <Person>()
     {
         Source.FirstOrDefault()
     };
     SelectedItems2          = new List <Person>();
     ShowSelectedItemCommand = new DelegateCommand <IList <Person> >(ShowSelectedItemCommandAction);
     AdvanceLookUpContract   = new AdvanceLookUpContract();
 }
        private void CompleteButton_Click(object sender, RoutedEventArgs e)
        {
            bool FirstNameValidated = ValidateName(FirstNameTextBox.Text.ToString());
            bool LastNameValidated  = ValidateName(LastNameTextBox.Text.ToString());
            bool SSNValidated       = ValidateSocialSecurityNumber(SocialSecurityNumberTextBox.Text.ToString());
            bool DateValidated      = ValidateDate(DateOfArrivalTextBox.Text.ToString());

            if (ValidatePatient())
            {
                if (FirstNameValidated)
                {
                    if (LastNameValidated)
                    {
                        if (SSNValidated)
                        {
                            if (DateValidated)
                            {
                                _person                      = new Person();
                                _person.FirstName            = FirstNameTextBox.Text;
                                _person.LastName             = LastNameTextBox.Text;
                                _person.DateOfBirth          = DateTextBox.SelectedDate.Value;
                                _person.Address              = AddressTextBox.Text;
                                _person.SocialSecurityNumber = SocialSecurityNumberTextBox.Text;
                                _person.Complaint            = ComplaintTextBox.Text;
                                DateTime date = DateTime.Parse(DateOfArrivalTextBox.Text);
                                _person.DateOfArrival = date;
                                PersonDataProvider.CreatePerson(_person);
                                DialogResult = true;
                                Close();
                            }
                            else
                            {
                                MessageBox.Show("Incorrect Date Format Or Date Is Occupied!", "Format Error", MessageBoxButton.OK, MessageBoxImage.Error);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Incorrect SSN Format!", "Format Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Incorrect Name Format!", "Format Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Incorrect Name Format!", "Format Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
 private void ModifyButton_Click(object sender, RoutedEventArgs e)
 {
     if (ValidateDate(DateOfArrivalTextBox.Text.ToString()) && CheckDate())
     {
         DateTime date = DateTime.Parse(DateOfArrivalTextBox.Text);
         _person.DateOfArrival = date;
         PersonDataProvider.UpdatePerson(_person);
         DialogResult = true;
         Close();
     }
     else
     {
         MessageBox.Show("Incorrect Date Format Or Date Is Occupied!", "Format Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemple #9
0
        private void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            if (ValidatePerson())
            {
                _person.FirstName            = FirstNameTextBox.Text;
                _person.LastName             = LastNameTextBox.Text;
                _person.DateOfArrival        = DateOfArrivalPicker.SelectedDate.Value;
                _person.SocialSecurityNumber = SocialSecurityNumberTextBox.Text;
                _person.Address = AddressTextBox.Text;
                _person.Symptom = SymptomTextBox.Text;

                PersonDataProvider.UpdatePerson(_person);
                DialogResult = true;
                Close();
            }
        }
Exemple #10
0
 private void ModifyPatientButton_Click(object sender, RoutedEventArgs e)
 {
     if (ValidatePerson())
     {
         _person.FirstName            = FirstNameTextBox.Text;
         _person.LastName             = LastNameTextBox.Text;
         _person.DateOfArrival        = DateOfArrivalPicker.SelectedDate.GetValueOrDefault();
         _person.SocialSecurityNumber = SocialSecurityNumberTextBox.Text;
         _person.Address        = AddressTextBox.Text;
         _person.Symptom        = SymptomTextBox.Text;
         _person.Diagnosis      = DiagnosisTextBox.Text;
         _person.LastTimeEdited = DateTime.Now;
         PersonDataProvider.UpdatePerson(_person);
         DialogResult = true;
         Close();
     }
 }
 public MainPage()
 {
     InitializeComponent();
     customerListBoxMain.ItemsSource = PersonDataProvider.GetData();
 }
Exemple #12
0
 private void UpdatePeople()
 {
     _people = PersonDataProvider.GetPeople();
     PeopleListBox.ItemsSource = _people;
 }