public async void createPatientHistory() { patientsInfoTable = Connection.MobileService.GetTable<PatientHistory>(); Pi = new PatientHistory { PatientId = String.Empty, Cholestrol = String.Empty, InfoDate = DateTime.Now, BloodPressure = String.Empty, Pulse = String.Empty, Rr = String.Empty, Temperature = String.Empty, Weight = String.Empty, Height = String.Empty, Info1 = String.Empty, Info2 = String.Empty, Info3 = String.Empty, }; Items = await getListOfNames(); // Items = new List<string>() { "a","b" }; }
public async void fillCalendar() { Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Wait, 2); Windows.Globalization.Calendar calendar = new Windows.Globalization.Calendar(); List<NameValueItem2> dList = new List<NameValueItem2>(); try { if ((!SelectedMonth.Equals(calendar.MonthAsSoloString()) || !SelectedYear.Equals(calendar.Year.ToString())) && flip == 0) stay = true; } catch { } int noOfDaysInTheSelectedMonth = 0; int shift = 0; string firstDay = String.Empty; if (flip == 0) { if (!stay) { SelectedMonth = calendar.MonthAsSoloString(); SelectedYear = calendar.Year.ToString(); } // firstDay = new DateTime(Convert.ToInt32(SelectedYear), DateTime.ParseExact(SelectedMonth, "MMMM", CultureInfo.CurrentCulture).Month, 1).ToString("dddd"); } if (flip == -1) { int temp = DateTime.ParseExact(SelectedMonth, "MMMM", CultureInfo.CurrentCulture).Month; if (temp == 1) { temp = 12; } else { temp--; } SelectedMonth = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(temp); if (temp != 12) { //SelectedYear = calendar.Year.ToString(); } else { int tempYear = Convert.ToInt32(SelectedYear); tempYear--; SelectedYear = tempYear.ToString(); } } if (flip == 1) { { int temp = DateTime.ParseExact(SelectedMonth, "MMMM", CultureInfo.CurrentCulture).Month; if (temp == 12) { temp = 1; } else { temp++; } SelectedMonth = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(temp); if (temp != 1) { } else { int tempYear = Convert.ToInt32(SelectedYear); tempYear++; SelectedYear = tempYear.ToString(); } } } noOfDaysInTheSelectedMonth = DateTime.DaysInMonth(Convert.ToInt32(SelectedYear), DateTime.ParseExact(SelectedMonth, "MMMM", CultureInfo.CurrentCulture).Month); firstDay = new DateTime(Convert.ToInt32(SelectedYear), DateTime.ParseExact(SelectedMonth, "MMMM", CultureInfo.CurrentCulture).Month, 1).ToString("dddd"); switch (firstDay) { case "Sunday": shift = 0; break; case "Monday": shift = 1; break; case "Tuesday": shift = 2; break; case "Wednesday": shift = 3; break; case "Thursday": shift = 4; break; case "Friday": shift = 5; break; case "Saturday": shift = 6; break; } while (shift > 0) { dList.Add(new NameValueItem2()); shift--; } appList = await Appointment.ReadAppointmentsList(); appList = appList.Where(ap => ap.PatientID == SelectedPatient.PatientID).ToList(); try { peList = (await PatientEncounter.ReadPatientEncountersList()).Where(pe => (getAppointment(pe.AppointmentId)).PatientID == SelectedPatient.PatientID).ToList(); } catch { } List<PatientHistory> pList = await patientViewModel.patientsInfoTable.Where( ph => (ph.PatientId == SelectedPatient.PatientID && ph.InfoDate > (new DateTime(Convert.ToInt32(SelectedYear), DateTime.ParseExact(SelectedMonth, "MMMM", CultureInfo.CurrentCulture).Month, 1)) && ph.InfoDate < (new DateTime(Convert.ToInt32(SelectedYear), DateTime.ParseExact(SelectedMonth, "MMMM", CultureInfo.CurrentCulture).Month, noOfDaysInTheSelectedMonth)) )).ToListAsync(); //Where(p => p.FName == ComboPatient).Select(patient => patient.PatientID).ToListAsync()).First(); for (int i = 1; i <= noOfDaysInTheSelectedMonth; i++) { DateTime loopDate = new DateTime(Convert.ToInt32(SelectedYear), DateTime.ParseExact(SelectedMonth, "MMMM", CultureInfo.CurrentCulture).Month, i); PatientHistory temp; try { temp = pList.Where(ph => ph.InfoDate.ToString("MMMM dd, yyyy") == loopDate.ToString("MMMM dd, yyyy")).ToList().First(); } catch { temp = new PatientHistory(); } Appointment app; try { app = appList.Where(ap => ap.Date.Date.Equals(loopDate.Date.Date)).ToList().First(); } catch { app = new Appointment(); } PatientEncounter pee; try { pee = peList.Where(pe => (getAppointment(pe.AppointmentId)).Date.Date.Equals(loopDate.Date.Date)).ToList().First(); } catch { pee = new PatientEncounter(); } dList.Add(new NameValueItem2 { Value = i.ToString(), date = new DateTime(Convert.ToInt32(SelectedYear), DateTime.ParseExact(SelectedMonth, "MMMM", CultureInfo.CurrentCulture).Month, i), pHistory = temp, Color = ((!String.IsNullOrEmpty(temp.PatientId)) ? "Pink" : (pee.AppointmentId != null) ? "LightBlue" : (!String.IsNullOrEmpty(app.PatientID) ? "#BFB5DF" : "White")), appointment = app, patientEncounter = pee, Width1 = ((!String.IsNullOrEmpty(temp.PatientId)) || (String.IsNullOrEmpty(temp.PatientId) && String.IsNullOrEmpty(app.PatientID)) ? 98 : 0), Width2 = (!String.IsNullOrEmpty((app.PatientID)) && String.IsNullOrEmpty(temp.PatientId) && pee.AppointmentId == null ? 98 : 0), Width3 = (pee.AppointmentId != null ? 98 : 0) }); } MonthGridView.ItemsSource = dList; flip = 0; Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 2); }
public static async void DeletePatientHistory(PatientHistory ph) { try { await patientHistory.DeleteAsync(ph); } catch { new MessageDialog("Deleting error").ShowAsync(); } }
public static async void UpdatePatientHistory(PatientHistory ph) { await patientHistory.UpdateAsync(ph); }
public static async void InsertNewPatientHistory(PatientHistory ph) { try { await patientHistory.InsertAsync(ph); } catch (MobileServiceInvalidOperationException e) { Debug.WriteLine(e.Message); } }