コード例 #1
0
        public async Task Init()
        {
            UserSearchRequest request = new UserSearchRequest {
                Username = APIService.Username
            };
            var list = await _userService.GetAll <List <User> >(request);

            var client = list[0];

            if (AppointmentList.Count > 0)
            {
                AppointmentList.Clear();
            }

            AppointmentSearchRequest request2 = new AppointmentSearchRequest {
                UserID = client.UserID
            };
            var appointments = await _appointmentService.GetAll <List <Appointment> >(request2);

            foreach (var appointment in appointments)
            {
                AppointmentList.Add(appointment);
            }

            if (AppointmentList.Count == 0)
            {
                await Application.Current.MainPage.DisplayAlert("Warning", "You don't have any appointments yet.", "OK");
            }
        }
コード例 #2
0
        static public void SearchAppointment(ComboBox box, TextBox search, HairSpaContext context)
        {
            IQueryable <Appointment> list = null;

            AppointmentList.Clear();

            switch (box.SelectedItem)
            {
            case "Id":
                list = context.Appointments.Where(ap => ap.Id.ToString().Contains(search.Text));
                break;

            case "Type":
                list = context.Appointments.Where(ap => ap.Type.Contains(search.Text));
                break;

            case "Customer Id":
                list = context.Appointments.Where(ap => ap.CustomersId.ToString().Contains(search.Text));
                break;

            case "Employee Id":
                list = context.Appointments.Where(ap => ap.EmployeesId.ToString().Contains(search.Text));
                break;

            default:
                break;
            }

            try
            {
                if (list.ToList().Count <= 0)
                {
                    MessageBox.Show("No records were found", "No Results");
                    return;
                }
                else
                {
                    list.ToList().ForEach(ap => AppointmentList.Add(ap));
                }
            }
            catch (Exception)
            {
                MessageBox.Show("No records were found", "No Results");
                return;
            }
        }
コード例 #3
0
        async Task SearchAppointments()
        {
            if (EndDate < StartDate)
            {
                await Application.Current.MainPage.DisplayAlert("Warning", "End date must be greater than start date", "Try again");

                return;
            }

            UserSearchRequest request = new UserSearchRequest {
                Username = APIService.Username
            };
            var list = await _userService.GetAll <List <User> >(request);

            var client = list[0];

            if (AppointmentList.Count > 0)
            {
                AppointmentList.Clear();
            }

            AppointmentSearchRequest request2 = new AppointmentSearchRequest
            {
                UserID        = client.UserID,
                TreatmentName = TreatmentName,
                StartDate     = StartDate.Date,
                EndDate       = EndDate.Date
            };

            var appointments = await _appointmentService.GetAll <List <Appointment> >(request2);

            foreach (var appointment in appointments)
            {
                AppointmentList.Add(appointment);
            }

            if (AppointmentList.Count == 0)
            {
                await Application.Current.MainPage.DisplayAlert("Warning", "There are no results for this search", "OK");
            }
        }
コード例 #4
0
 private void BtnDisplay_Click(object sender, RoutedEventArgs e)
 {
     saveList.Clear();
     ReadFromXML();
     Applist.Clear();
     for (int i = 0; i < saveList.Count(); i++)
     {
         Patient   patient    = saveList[i].Patient;
         MyPatient newPatient = new MyPatient();
         newPatient.Age              = patient.Age;
         newPatient.Time             = patient.Time;
         newPatient.Gender           = patient.Gender;
         newPatient.MedicalCondition = patient.MedicalCondition;
         newPatient.CtXray           = patient.CtXray;
         newPatient.Treatment        = patient.Treatment;
         newPatient.CreditCard       = patient.CreditCard;
         Applist.Add(newPatient);
         TimeList.Remove(patient.Time);
     }
     MyGrid.ItemsSource = Applist;
 }