Ejemplo n.º 1
0
        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            specifics = task.Description.Split(new string[] { "split" }, StringSplitOptions.None);
            StartHour = int.Parse(specifics[0]);
            StartMin = int.Parse(specifics[1]);
            LateHour = int.Parse(specifics[2]);
            LateMin = int.Parse(specifics[3]);
            Tune = specifics[4];
            DateTime LateAlarmTime = new DateTime(2013, 1, 1, LateHour, LateMin, 0);
            IEnumerable<ScheduledNotification> notifications = ScheduledActionService.GetActions<ScheduledNotification>();
            AlarmsSet = 0;
            if (notifications != null)
            {
                for (int i = 0; i < notifications.Count(); i++)
                {
                    if (notifications.ElementAt(i).ExpirationTime.TimeOfDay > notifications.ElementAt(i).BeginTime.AddSeconds(1).TimeOfDay && notifications.ElementAt(i).ExpirationTime.TimeOfDay < notifications.ElementAt(i).BeginTime.AddSeconds(5).TimeOfDay && notifications.ElementAt(i).BeginTime.TimeOfDay < LateAlarmTime.TimeOfDay)
                    {
                        AlarmsSet++;
                    }
                }
            }

            Appointments appts = new Appointments();

            appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted_Background);

            DateTime start = DateTime.Now;
            start = start.AddHours(-start.Hour);
            start = start.AddMinutes(-start.Minute);
            DateTime end = DateTime.Now.AddDays(7);

            appts.SearchAsync(start, end, "Appointments Test #1");
        }
Ejemplo n.º 2
0
        public void FindAppointmentByName(String name,AsyncCallback callback)
        {

            Appointments appo = new Appointments();
            appo.SearchCompleted += new AppointmentFinder(callback,name).finishSearch;
            appo.SearchAsync(DateTime.Now, DateTime.Now.AddYears(1), 1000, null);
        }
        private void ProcurarProximoCompromisso_Click(object sender, RoutedEventArgs e)
        {
            var appointments = new Appointments();
            appointments.SearchCompleted += Appointments_SearchCompleted;

            appointments.SearchAsync(DateTime.Now,
                DateTime.Now + TimeSpan.FromDays(7), 1, null);
        }
Ejemplo n.º 4
0
 private void buttonSearchAppointments_Click(object sender, RoutedEventArgs e)
 {
     
     Appointments appointments = new Appointments();
     appointments.SearchCompleted += appointments_SearchCompleted;
     
     appointments.SearchAsync(DateTime.Today, DateTime.Today.AddDays(1), "All appointments today");
 }
Ejemplo n.º 5
0
 public ResolveAppointmentsEventArgs(DateTime start, DateTime end)
 {
     m_StartDate = start;
     m_EndDate = end;
         //COMP2003: Not compatible
     //m_Appointments = new List<Appointment>();
         m_Appointments = new Appointments();
 }
Ejemplo n.º 6
0
 public static List<Appointment> GetCalenderAppointments()
 {
     Appointments appointment = new Appointments();
     appointment.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(SearchAppointment);
     DateTime startDate = DateTime.Now;
     DateTime endDate = startDate.AddDays(1);
     appointment.SearchAsync(startDate, endDate, null);
     return listOfAppointment;
 }
Ejemplo n.º 7
0
        private void LoadAppointments()
        {
            Appointments appoints = new Appointments();

            appoints.SearchCompleted += appoints_SearchCompleted;

            DateTime now = DateTime.Now;
            DateTime end = now.AddYears(1);

            appoints.SearchAsync(now, end, 100000, "Get all appointments for WhatTodo");
        }
 public void TestLoadNoFile()
 {
     // Arrange
     Appointments testApps = new Appointments();
     PrivateObject privApp = new PrivateObject(testApps);
     privApp.SetField("fileName", String.Empty);
     // Act
     bool successfullLoad = testApps.Load();
     // Assert
     Assert.IsFalse(successfullLoad, "The appointment didn't load from a file!");
 }
 public void TestLoadInvalidFile()
 {
     // Arrange
     Appointments testApps = new Appointments();
     PrivateObject privApps = new PrivateObject(testApps);
     privApps.SetField("fileName", "UnitTests/LoadInvalid.xml");
     // Act
     bool successfullLoad = testApps.Load();
     // Assert
     Assert.IsFalse(successfullLoad, "The appointment loaded an invalid file.");
 }
        private void RefreshAppointments()
        {
            Appointments appointment = new Appointments();
            appointment.SearchCompleted += appointment_SearchCompleted;
            DateTime starttime = DateTime.Now;
            DateTime endtime = starttime.AddDays(10);

            int max = 50;

            appointment.SearchAsync(starttime, endtime, max, null);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Récupère les rendez-vous d'un jour précis
        /// </summary>
        /// <value> <list type="List<Meeting>">Results</list></value>
        /// <param name="date">Jour à partir duquel récupèrer les rendez-vous</param>
        public void GetAllMeetingsAsync(DateTime date)
        {
            Appointments appointments = new Appointments();
            
            //Lorsque les rendez-vous sont reçus de la plateforme Calendar WP7
            appointments.SearchCompleted += (o, e) =>
            {
                int countSended = 0;
                //Liste finale, des meetings récupérés, envoyée à la fin du traitement
                List<Meeting> mettings = new List<Meeting>();

                //Si il n'y a aucun résultat
                if (!e.Results.Any())
                {
                    Debug.WriteLine("No Apointments Found");
                    return;
                }

                //Lorsqu'on reçoit une réponse de recherche de location
                LocationChecked += (sender, locationEvent) =>
                {
                    mettings.Add(locationEvent.Meeting);
                    Debug.WriteLine("réponse " + locationEvent.Meeting.Subject + " ->" + locationEvent.Meeting.Location.Latitude + " " + locationEvent.Meeting.Location.Longitude);

                    //Si cette réponse est la dernière parmis toutes celles lancées
                    if (countSended == mettings.Count)
                    {
                        Debug.WriteLine("AllMeetingsRetreived!!");
                        AllMeetingsReceivedEventArgs eventToSend = new AllMeetingsReceivedEventArgs();
                        //On range les réponses par date
                        eventToSend.Meetings = mettings.OrderBy(m => m.DateTime);
                        //Et on notifie les observateurs
                        AllMeetingsRetreived(this, eventToSend);

                        //On se dé-abonne de l'event
                        LocationChecked = null;
                    }
                };

                //Pour charque rendez-vous trouvés on lance la méthode de check location
                foreach (Appointment a in e.Results)
                {
                    if (a.Location != null)
                    {
                        countSended++;
                        CheckLocationAsync(a);
                    }
                }
            };
            Debug.WriteLine("Date de début : " + date);
            Debug.WriteLine("Date de fin : " + date.AddDays(1));
            appointments.SearchAsync(date, date.AddDays(1), null);
        }
        protected void EventoMostrar()
        {
            Appointments appts = new Appointments();

            appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);

            DateTime start = DateTime.Now;
            DateTime end = start.AddDays(7);
            int max = 20;

            appts.SearchAsync(start, end, max);
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Appointments appts = new Appointments();
            
            

            appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);

            DateTime start = DateTime.Now;
            DateTime end = start.AddDays(7);
            int max = 20;

            appts.SearchAsync(start, end, max);
        }
 public void TestLoadValid()
 {
     // Arrange
     Appointments testApps = new Appointments();
     PrivateObject privApps = new PrivateObject(testApps);
     privApps.SetField("fileName", "UnitTests/Load.xml");
     DateTime dt = new DateTime(DateTime.Now.Year + 1, 1, 1, 0, 0, 0);
     // Act
     bool successfullLoad = testApps.Load();
     // Assert
     Assert.IsTrue(successfullLoad, "The file wasn't loaded!");
     for (int i = 0; i < testApps.Count; ++i)
     {
         Assert.AreEqual("Description: Test Appointment " + i + "\nLocation: Test Location", testApps[i].DisplayableDescription, "The appointments description doesn't match!");
         Assert.AreEqual(30, testApps[i].Length, "The appointments length is not the same!");
         Assert.AreEqual(dt, testApps[i].Start, "The appointments starting time is not the same!");
     }
 }
        public void GetFreeTime()
        {
            Appointments appts = new Appointments();

            //Identify the method that runs after the asynchronous search completes.
            appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);

            DateTime start = DateTime.Now;

            //Hard Code to 7 days
            DateTime end = start.AddDays(7);

            //Hard limit
            int max = 5;

            //Start the asynchronous search.
            appts.SearchAsync(start, end, max, "Appointments Test #1");
        }
 /// <summary>
 /// Default constructor for when adding a
 /// blank appointment.
 /// </summary>
 /// <param name="recurring">If the appointment is recurring.</param>
 public FormAddAppointment(bool recurring)
 {
     InitializeComponent();
     this.ChangeRecurringControlsState(recurring);
     this.currentAppointments = new Appointments();
     this.currentAppointments.Load();
     this.newApp = new Appointment();
     this.dateTimePickerStartTime.Value = new DateTime(this.dateTimePickerStartTime.Value.Year,
         this.dateTimePickerStartTime.Value.Month,
         this.dateTimePickerStartTime.Value.Day,
         this.dateTimePickerStartTime.Value.Hour,
         0,
         0);
     this.dateTimePickerLength.Value = new DateTime(DateTime.Now.Year,
         DateTime.Now.Month,
         DateTime.Now.Day,
         0,
         30,
         0);
     this.comboBoxFreq.Text = Resources.AppointmentFrequency;
 }
Ejemplo n.º 17
0
 public void AddAppointments()
 {
     using (var context = new HospitalManagementContext())
     {
         Console.WriteLine("Enter Patient Name:");
         string pname = Console.ReadLine();
         Console.WriteLine("Enter Doctor Name:");
         string dname = Console.ReadLine();
         Console.WriteLine("Enter Appointment Time:");
         string time   = Console.ReadLine();
         var    doctor = context.Doctors.Single(b => b.DoctorName == dname);
         //Console.WriteLine(doctor.DoctorId);
         int doctorid = doctor.DoctorId;
         var appoint  = new Appointments()
         {
             PatientName     = pname,
             DoctorId        = doctorid,
             AppointmentTime = System.DateTime.Parse(time),
         };
         context.Appointments.Add(appoint);
         context.SaveChanges();
     }
 }
 private void Create(Appointments appointment)
 {
     int rowsAffected = _db.Execute(@"INSERT INTO [dbo].[Appointments] ([Type], [StartDate], [EndDate], [AllDay], [Subject], [Location], [Description], [Status], [Label],[ResourceID], [ResourceIDs], [ReminderInfo], [RecurrenceInfo], [TimeZoneId], [CustomField1]) " +
                                    "VALUES (@Type, @StartDate, @EndDate, @AllDay, @Subject, @Location, @Description, @Status, @Label, @ResourceID, @ResourceIDs, @ReminderInfo, @RecurrenceInfo, @TimeZoneId, @CustomField1) ",
                                    new
     {
         Type           = appointment.Type,
         StartDate      = appointment.StartDate,
         EndDate        = appointment.EndDate,
         AllDay         = appointment.AllDay,
         Subject        = appointment.Subject,
         Location       = appointment.Location,
         Description    = appointment.Description,
         Status         = appointment.Status,
         Label          = appointment.Label,
         ResourceID     = appointment.ResourceID,
         ResourceIDs    = appointment.ResourceIDs,
         ReminderInfo   = appointment.ReminderInfo,
         RecurrenceInfo = appointment.RecurrenceInfo,
         TimeZoneId     = appointment.TimeZoneId,
         CustomField1   = appointment.CustomField1
     });
 }
Ejemplo n.º 19
0
        //Method to call the instance of insertPatient from the PatientDB.
        //This method will be attached to the button 'Insert' command.
        private void UpdateAppointment()
        {
            try
            {
                rowsAffected = AppointmentDB.updateAppointment(SelectedAppointment);

                Appointments.Clear();
                DisplayAllAppointments();

                if (rowsAffected != 0)
                {
                    MessageBox.Show("Appointment updated");
                }
                else
                {
                    MessageBox.Show("Update Failed");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Ejemplo n.º 20
0
        public ActionResult Add(string a_date, string a_time, int d_name, string a_reason)
        {
            string patientId = User.Identity.GetUserId();

            if (a_date != "")
            {
                //store the counts of appointments ID so that we can add it one on every new appointment
                //for creating the appointment reference number
                List <Appointments> appointments = db.Appointments.ToList();
                int count = appointments.Count();

                Appointments newappointments = new Appointments();
                newappointments.appointmentDate            = DateTime.ParseExact(a_date + " " + a_time, "yyyy-MM-dd Hmm", CultureInfo.InvariantCulture);
                newappointments.patientId                  = patientId;
                newappointments.doctorId                   = d_name;
                newappointments.appointmentReason          = a_reason;
                newappointments.appointmentReferenceNumebr = "HSN" + count + 1;
                db.Appointments.Add(newappointments);
                db.SaveChanges();
            }
            //return Redirect("https://localhost:44315/Success/List");
            return(RedirectToAction("List"));
        }
        /// <summary>
        /// Update Appointment Details to Json file.
        /// </summary>
        /// <param name="appointments">List Of All Appointment.</param>
        public static void UpdateAppointmentToJson(List <Appointment> appointments)
        {
            try
            {
                string filename = CliniqueManagementsProgram.AppointmentPath;

                Appointments appointments1 = new Appointments()
                {
                    GetAppointments = appointments
                };

                string updateAppointmentData = JsonConvert.SerializeObject(appointments1);

                using StreamWriter streamWriter = new StreamWriter(filename);
                streamWriter.WriteLine(updateAppointmentData);

                Console.WriteLine("Appointment Has been Booked.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Message: {0}", e.Message);
            }
        }
Ejemplo n.º 22
0
        public async Task <bool> UpdateAppointmentAsync(Appointment appointment, bool save = true)
        {
            try
            {
                Appointments dbAppointment = await _context.Appointments.FirstOrDefaultAsync(a => a.Appointmentid == appointment.Id);

                dbAppointment.Appointmentdatetime = appointment.AppointmentDateTime;
                dbAppointment.Appointmenttitle    = appointment.Title;

                _context.Appointments.Update(dbAppointment);

                if (save)
                {
                    await _context.SaveChangesAsync();
                }

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Ejemplo n.º 23
0
        public IHttpActionResult DeleteAppointments(int id)
        {
            Appointments appointments = db.Appointments.Find(id);

            if (appointments == null)
            {
                return(NotFound());
            }

            // Get hours between dates
            DateTime now   = DateTime.Now;
            double   hours = (appointments.AppointmentDateTime - now).TotalHours;

            if (hours < 24)
            {
                return(BadRequest());
            }

            db.Appointments.Remove(appointments);
            db.SaveChanges();

            return(Ok(appointments));
        }
Ejemplo n.º 24
0
        //Detalles Citas
        public async Task <ActionResult> Details(int Id)
        {
            if (User.Identity.Name != null)
            {
                var user = await _userManager.FindByEmailAsync(User.Identity.Name);

                var administrador = user.Administrador;

                if (administrador == true)
                {
                    TempData["hablitarUser"] = "******";
                }
            }
            //-------------------------------------------------------------------------------------------------------------

            //Models
            Appointments appointments = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(BaseUrl);

                //Http Get
                var responseTask = client.GetAsync("api/Appointments/" + Id.ToString());
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <Appointments>();
                    readTask.Wait();
                    appointments = readTask.Result;
                }
            }

            return(View(appointments));
        }
        public ActionResult Update(Appointments appointment)
        {
            if (ModelState.IsValid)
            {
                Appointments a = db.Appointments.Where(s => s.Id == appointment.Id).First();
                a.StartDateTime = appointment.StartDateTime;
                a.Details       = appointment.Details;
                a.Status        = appointment.Status;

                //a.DoctorId = appointment.DoctorId;  //Both are Correct
                //a.PatientId = appointment.PatientId;
                a.Doctor  = appointment.Doctor;
                a.Doctor  = db.Doctors.Where(p => p.DoctorId == appointment.DoctorId).FirstOrDefault();
                a.Patient = appointment.Patient;
                a.Patient = db.Patients.Where(p => p.PatientId == appointment.PatientId).FirstOrDefault();
                db.SaveChanges();
                return(RedirectToAction("Index", "Appointments"));
            }
            List <Doctors> list = new List <Doctors>();

            list = (from t in _context.Doctors select t).ToList();
            list.Insert(0, new Doctors {
                DoctorId = 0, Name = ""
            });
            ViewBag.message = new SelectList(list, "DoctorId", "Name");


            List <Patients> plist = new List <Patients>();

            plist = (from p in _context.Patients select p).ToList();
            plist.Insert(0, new Patients {
                PatientId = 0, Name = ""
            });
            ViewBag.listofitem = new SelectList(plist, "PatientId", "Name");

            return(View(appointment));
        }
Ejemplo n.º 26
0
        public async Task <IActionResult> EditPost(int id, AppointmentDetailViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                return(View(vm));
            }

            Appointments obj = null;

            if (orm == 1)
            {
                obj = qdb.retAppointment(id);
            }
            else
            {
                obj = await _db.Appointments.FirstAsync(e => e.Id == id);
            }

            obj.CustomerName    = vm.Appointments.CustomerName;
            obj.CustomerEmail   = vm.Appointments.CustomerEmail;
            obj.IsConfirmed     = vm.Appointments.IsConfirmed;
            obj.CustomerNumber  = vm.Appointments.CustomerNumber;
            obj.AppointmentDate = vm.Appointments.AppointmentDate.AddHours(vm.Appointments.AppointmentTime.Hour)
                                  .AddMinutes(vm.Appointments.AppointmentTime.Minute);

            if (orm == 1)
            {
                qdb.upAppointment(obj);
            }
            else
            {
                await _db.SaveChangesAsync();
            }

            TempData["edit"] = 1;
            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> IndexPost()
        {
            List <string> lstShoppingCart = HttpContext.Session.Get <List <string> >(SD.SessionShoppingCartName);

            if (lstShoppingCart != null && lstShoppingCart.Count > 0)
            {
                CartsVM.Appointment.AppointmentDate = CartsVM.Appointment.AppointmentDate
                                                      .AddHours(CartsVM.Appointment.AppointmentTime.Hour)
                                                      .AddMinutes(CartsVM.Appointment.AppointmentTime.Minute);

                Appointments appointment = CartsVM.Appointment;
                _db.Appointments.Add(appointment);
                await _db.SaveChangesAsync();

                string appId = appointment.Id;

                foreach (string productId in lstShoppingCart)
                {
                    ProductsSelectedForAppointment selectedProduct = new ProductsSelectedForAppointment()
                    {
                        AppointmentId = appId,
                        ProductId     = productId
                    };

                    _db.ProductsSelectedForAppointment.Add(selectedProduct);
                }

                await _db.SaveChangesAsync();

                lstShoppingCart = new List <string>();
                HttpContext.Session.Set(SD.SessionShoppingCartName, lstShoppingCart);

                return(RedirectToAction("AppointmentConfirmation", "ShoppingCarts", new { id = appId }));
            }

            return(View(CartsVM));
        }
Ejemplo n.º 28
0
 private void DelegateUpdateProcess(ScheduledTask task, LiveData data, bool hasCalendar)
 {
     if (hasCalendar && (bool)SettingHelper.Get(Constants.CALENDAR_SHOW_APPOINTMENT))
     {
         //일정이 몇개 있는지를 백타일에 표시
         Appointments ap = new Appointments();
         ap.SearchCompleted += (so, se) =>
         {
             VsCalendar.MergeCalendar(data.DayList, se.Results);
             if (data is LockscreenData)
             {
                 SetLockscreenImage(task, (LockscreenData)data);
             }
             else
             {
                 SetLivetileImage(task, (LivetileData)data);
             }
             //완료됨을 OS에 알림
             NotifyComplete();
         };
         ap.SearchAsync(data.DayList[7].DateTime, data.DayList[data.DayList.Count - 1].DateTime.AddDays(1), null);
     }
     else
     {
         //백타일에 일정 표시하지 않음
         if (data is LockscreenData)
         {
             SetLockscreenImage(task, (LockscreenData)data);
         }
         else
         {
             SetLivetileImage(task, (LivetileData)data);
         }
         //완료됨을 OS에 알림
         NotifyComplete();
     }
 }
Ejemplo n.º 29
0
        public async Task <IActionResult> Create([Bind("AppointmentId,MemberId,ServiceId,AppointmentDate,AppointmentTime,Description")] Appointments appointments)
        {
            if (HttpContext.Session.GetString("employeeId") != null)
            {
                if (ModelState.IsValid)
                {
                    if (DateTime.Today < appointments.AppointmentDate)
                    {
                        appointments.Approved = true;
                        _context.Add(appointments);
                        await _context.SaveChangesAsync();

                        //Email customer
                        var member = _context.Members.Where(a => a.MemberId == appointments.MemberId).FirstOrDefault();
                        var email  = member.Email;
                        var fname  = member.FirstName;
                        var lname  = member.LastName;

                        SendEmail("Created", email, fname + " " + lname, appointments.AppointmentDate, appointments.AppointmentTime);

                        return(RedirectToAction(nameof(Index)));
                    }
                    else
                    {
                        ViewBag.dateError = "Choose any date after today";
                    }
                }
                ViewData["MemberId"]  = new SelectList(_context.Members, "MemberId", "fullName", appointments.MemberId);
                ViewData["ServiceId"] = new SelectList(_context.Services, "ServiceId", "Name", appointments.ServiceId);
                //ViewData["VehicleId"] = new SelectList(_context.Vehicles.Where(a => a.MemberId == int.Parse(memberId)), "VehicleId", "fullVehicleName", appointments.VehicleId);
                return(View(appointments));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 30
0
        // Get : Edit
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            List <Products> products     = null;
            Appointments    appointments = null;

            if (orm == 1)
            {
                products = qdb.p_join_psa((int)id);
                qdb.include_pt_st(products);
                appointments = qdb.retAppointment((int)id);
            }
            else
            {
                products = (from i in _db.Products
                            join j in _db.ProductsSelectedForAppointments on i.Id equals j.ProductId
                            where j.AppointmentId == id
                            select i
                            ).Include(e => e.ProductTypes).ToList();
                appointments = (from i in _db.Appointments where i.Id == (int)id select i).FirstOrDefault();
            }

            //var appointment = (from i in _db.Appointments where i.Id == (int) id select i).FirstOrDefault();
            var applicationUsers           = (from i in _db.ApplicationUsers select i).ToList();
            AppointmentDetailViewModel avm = new AppointmentDetailViewModel()
            {
                Appointments     = appointments,
                ApplicationUsers = applicationUsers,
                Products         = products
            };

            return(View(avm));
        }
Ejemplo n.º 31
0
        public async Task <IActionResult> IndexPost()
        {
            Appointments scheduledAppointment = new Appointments
            {
                CustomerName        = ShoppingCartVM.Appointments.CustomerName,
                CustomerEmail       = ShoppingCartVM.Appointments.CustomerEmail,
                CustomerPhoneNumber = ShoppingCartVM.Appointments.CustomerPhoneNumber,
                AppointmentDate     = ShoppingCartVM.Appointments.AppointmentDate
                                      .AddHours(ShoppingCartVM.Appointments.AppointmentTime.Hour)
                                      .AddMinutes(ShoppingCartVM.Appointments.AppointmentTime.Minute),
                IsConfirmed = false,
            };

            _db.Appointments.Add(scheduledAppointment);
            await _db.SaveChangesAsync();

            int appointmentId = scheduledAppointment.Id;

            List <int> lstShoppingCart = HttpContext.Session.Get <List <int> >("ssShoppingCart");

            foreach (var item in lstShoppingCart)
            {
                ProductsSelectedForAppointment productsSelectedForAppointment = new ProductsSelectedForAppointment()
                {
                    AppointmentId = appointmentId,
                    ProductId     = item
                };
                _db.ProductsSelectedForAppointment.Add(productsSelectedForAppointment);
            }
            await _db.SaveChangesAsync();

            // Emptying shopping cart list
            lstShoppingCart = new List <int>();

            HttpContext.Session.Set("ssShoppingCart", lstShoppingCart);
            return(RedirectToAction("AppointmentConfirmaion", "ShoppingCart", new { Id = appointmentId }));
        }
Ejemplo n.º 32
0
        public static void ProcessPV1(Patient pat, long aptNum, HL7DefSegment segDef, SegmentHL7 seg)
        {
            long provNum;
            int  provNumOrder = 0;

            for (int i = 0; i < segDef.hl7DefFields.Count; i++)
            {
                if (segDef.hl7DefFields[i].FieldName == "prov.provIdName" || segDef.hl7DefFields[i].FieldName == "prov.provIdNameLFM")
                {
                    provNumOrder = segDef.hl7DefFields[i].OrdinalPos;
                    break;
                }
            }
            if (provNumOrder == 0)           //No provIdName or provIdNameLFM field in this segment definition so do nothing with it
            {
                return;
            }
            provNum = FieldParser.ProvProcess(seg.Fields[provNumOrder]);
            if (provNum == 0)           //This segment didn't have a valid provider id in it to locate the provider (must have been blank) so do nothing
            {
                return;
            }
            Appointment apt = Appointments.GetOneApt(aptNum); //SCH segment was found and aptNum was retrieved, if no SCH segment for this message then 0

            if (apt == null)                                  //Just in case we can't find an apt with the aptNum from SCH segment
            {
                return;
            }
            Appointment aptOld = apt.Clone();
            Patient     patOld = pat.Copy();

            apt.ProvNum = provNum;
            pat.PriProv = provNum;
            Appointments.Update(apt, aptOld);
            Patients.Update(pat, patOld);
            return;
        }
Ejemplo n.º 33
0
        public ActionResult EditRecord(int id, Record rec, Appointments eve)
        {
            eve.Id          = id;
            eve.StartDate   = Convert.ToDateTime(Request.Form["textar3"]);
            eve.EndDate     = Convert.ToDateTime(Request.Form["textar4"]);
            eve.Description = Request.Form["textar2"];
            rec.Id_Record   = id;
            rec.DateEdit    = DateTime.Now;
            rec.Text        = Request.Form["textar"];
            rec.PreviewText = Request.Form["textar2"];
            rec.Price       = Convert.ToInt32(Request.Form["textar5"]);
            rec.Location    = Request.Form["textar6"];
            rec.StartDate   = Request.Form["textar3"];
            rec.EndDate     = Request.Form["textar4"];

            if (ModelState.IsValid)
            {
                //проверка на Ajax- запрос
                _datamanager.calendar.UpdateAppointment(eve);
                _datamanager.Record.UpdateRecord(rec);
                return(RedirectToAction("GetRecords"));
            }
            return(RedirectToAction("EditRecord"));
        }
Ejemplo n.º 34
0
        public async Task <List <PmsAppointment> > SearchAppointments(DateTime date, IList <DoctorRoomLabelMapping> roomMappings, IArrivalsLocalStorage storage)
        {
            List <PmsAppointment> result = new List <PmsAppointment>();

            result.AddRange(Appointments.Where(a => a.AppointmentStartTime.Date == date.Date));

            foreach (var appt in result)
            {
                // Check if the practitioner has a mapping already
                if (!roomMappings.Any(m => m.PractitionerFhirID == appt.PractitionerFhirID))
                {
                    // Add in an empty room mapping
                    roomMappings.Add(new DoctorRoomLabelMapping()
                    {
                        PractitionerFhirID = appt.PractitionerFhirID,
                        PractitionerName   = appt.PractitionerName
                    });
                }
                // And read in the extended content from storage
                await storage.LoadAppointmentStatus(appt);
            }

            return(result);
        }
Ejemplo n.º 35
0
        public IHttpActionResult CreateAppointment(AppointmentCustom appointment)
        {
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest(ModelState);
            //}

            // Validate if the patient already has appointments assigned for today
            Appointments patient = db.Appointments.Where(p => p.fk_idPatient == appointment.idPatient &&
                                                         p.AppointmentDateTime.Year == appointment.AppointmentDateTime.Year &&
                                                         p.AppointmentDateTime.Month == appointment.AppointmentDateTime.Month &&
                                                         p.AppointmentDateTime.Day == appointment.AppointmentDateTime.Day).FirstOrDefault();

            if (patient != null)
            {
                return(NotFound());
            }

            // Get type and doctors ID
            int typeId   = db.AppointmentsTypes.Where(at => at.name.ToLower() == appointment.appointmentType.ToLower()).FirstOrDefault().idAppointmentType;
            int doctorId = db.Doctors.Where(at => at.doctorName.ToLower() == appointment.doctorName.ToLower()).FirstOrDefault().idDoctor;

            Appointments _appointment = new Appointments {
                fk_idPatient         = appointment.idPatient,
                fk_idDoctor          = doctorId,
                fk_idAppointmentType = typeId,
                AppointmentDateTime  = appointment.AppointmentDateTime,
                isActive             = true
            };

            db.Appointments.Add(_appointment);
            db.SaveChanges();

            //return CreatedAtRoute("DefaultApi", new { id = _appointment.idAppointment }, _appointment);
            return(Ok());
        }
Ejemplo n.º 36
0
        public async Task <IActionResult> PutAppointments(int id, Appointments appointments)
        {
            appointments.Id = id;

            _context.Entry(appointments).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AppointmentsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 37
0
 public IActionResult AddEditAppointment([FromBody] Appointments model)
 {
     try
     {
         if (model.Id == 0)
         {
             var isBook = _appointment.GetSingle(x => x.pet_id == model.pet_id && x.appointmentDate.Date == model.appointmentDate.Date && x.appointmentSlot.Equals(model.appointmentSlot));
             if (isBook != null)
             {
                 return(_jsonResponse.GenerateJsonResult(0, "Appointment is already book"));
             }
             _appointment.Add(model);
             _appointment.Save();
             return(_jsonResponse.GenerateJsonResult(1, "Appointment save Successfully"));
         }
         else
         {
             var isBook = _appointment.GetSingle(x => x.Id != model.Id && x.pet_id == model.pet_id && x.appointmentDate.Date == model.appointmentDate.Date && x.appointmentSlot.Equals(model.appointmentSlot));
             if (isBook != null)
             {
                 return(_jsonResponse.GenerateJsonResult(0, "Appointment is already book"));
             }
             var edit = _appointment.GetSingle(x => x.Id == model.Id);
             edit.pet_id          = model.pet_id;
             edit.appointmentDate = model.appointmentDate;
             edit.appointmentSlot = model.appointmentSlot;
             _appointment.Update(edit);
             _appointment.Save();
             return(_jsonResponse.GenerateJsonResult(1, "Appointment update Successfully"));
         }
     }
     catch (Exception ex)
     {
         return(_jsonResponse.GenerateJsonResult(0, "UnhandledError"));
     }
 }
Ejemplo n.º 38
0
        ///<summary>Determines if the Task is in the Clinic's region.</summary>
        private bool IsTaskInRegionAndUnrestricted(Task task, Userod user)
        {
            bool        retVal             = false;
            Clinic      clinic             = Clinics.GetClinic(user.ClinicNum);
            List <long> listUserClinicNums = Clinics.GetAllForUserod(user).Select(x => x.ClinicNum).ToList();

            switch (task.ObjectType)
            {
            case TaskObjectType.Appointment:
                Appointment appt       = Appointments.GetOneApt(task.KeyNum);
                Clinic      clinicAppt = Clinics.GetClinic(appt.ClinicNum);
                //Is Appointment's clinic in the same region as passed in clinic, and user has permission to view the clinicAppt?
                //0 Region also allowed.
                if (clinicAppt.Region == 0 || (clinicAppt.Region == clinic.Region && listUserClinicNums.Any(x => x == clinicAppt.ClinicNum)))
                {
                    retVal = true;
                }
                break;

            case TaskObjectType.Patient:
                Patient pat       = Patients.GetPat(task.KeyNum);
                Clinic  clinicPat = Clinics.GetClinic(pat.ClinicNum);
                //Is Appointment's clinic in the same region as passed in clinic, and user has permission to view the clinicPat?
                //0 Region also allowed.
                if (clinicPat.Region == 0 || (clinicPat.Region == clinic.Region && listUserClinicNums.Any(x => x == clinicPat.ClinicNum)))
                {
                    retVal = true;
                }
                break;

            case TaskObjectType.None:
                retVal = true;
                break;
            }
            return(retVal);
        }
Ejemplo n.º 39
0
        public async Task <IActionResult> Edit(uint id, [Bind("Id,PatientFirstName,PatientLastName,PatientId,DoctorId,StartingTime")] Appointments appointments)
        {
            if (id != appointments.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                if (appointments.PatientId != null)
                {
                    appointments.PatientFirstName = _context.Patients.Where(p => p.Id == appointments.PatientId).FirstOrDefault().FirstName;
                    appointments.PatientLastName  = _context.Patients.Where(p => p.Id == appointments.PatientId).FirstOrDefault().LastName;
                }
                try
                {
                    _context.Update(appointments);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppointmentsExists(appointments.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DoctorId"]  = new SelectList(_context.Employees, "Id", "FirstName", appointments.DoctorId);
            ViewData["PatientId"] = new SelectList(_context.Patients, "Id", "FirstName", appointments.PatientId);
            return(View(appointments));
        }
        public void SetUp(int dayCount, int resourceCount, int appointmentsPerDay)
        {
            if (dayCount <= 0 || resourceCount <= 0 || appointmentsPerDay <= 0)
            {
                Clear();
                return;
            }
            bool appointmentsPerDayChanged = this.appointmentsPerDay != appointmentsPerDay;
            bool resourcesUpdated          = UpdateResources(resourceCount);

            if (appointmentsPerDayChanged)
            {
                this.appointmentsPerDay = appointmentsPerDay;
                Appointments.Clear();
                this.endDate = this.startDate;
                UpdateDayCount(dayCount);
                return;
            }
            UpdateDayCount(dayCount);
            if (resourcesUpdated)
            {
                UpdateAppointmentResources();
            }
        }
Ejemplo n.º 41
0
        [Authorize]// only the users with a token can access this method
        public async Task <ActionResult <Appointments> > createAppointment(CreateAppointmentDTO app)
        {
            if (await AppointmentDateExist(app.date))
            {
                if (await AppointmentHourExist(app.hour))
                {
                    return(BadRequest("This date is already used!"));
                }
            }
            var useremail = User.FindFirst(ClaimTypes.Email)?.Value;
            var user      = await _context.USERS.Where(p => p.email == useremail).FirstAsync();

            var Appointment = new Appointments
            {
                date   = app.date,
                hour   = app.hour,
                UserId = user.Id
            };

            _context.APPOINTMENTS.Add(Appointment);
            await _context.SaveChangesAsync();

            return(Ok(_mapper.Map <ReturnAppointmentsDTO>(Appointment)));
        }
Ejemplo n.º 42
0
        ///<summary>Update Appointment.Confirmed. Returns true if update was allowed. Returns false if it was prevented.</summary>
        public static bool UpdateAppointmentConfirmationStatus(long aptNum, long confirmDefNum, string commaListOfExcludedDefNums)
        {
            Appointment aptCur = Appointments.GetOneApt(aptNum);

            if (aptCur == null)
            {
                return(false);
            }
            List <long> preventChangeFrom = commaListOfExcludedDefNums.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();

            if (preventChangeFrom.Contains(aptCur.Confirmed))              //This appointment is in a confirmation state that can no longer be updated.
            {
                return(false);
            }
            //Keep the update small.
            Appointment aptOld = aptCur.Copy();

            aptCur.Confirmed = confirmDefNum;
            Appointments.Update(aptCur, aptOld);           //Appointments S-Class handles Signalods
            SecurityLogs.MakeLogEntry(Permissions.ApptConfirmStatusEdit, aptCur.PatNum, "Appointment confirmation status changed from "
                                      + Defs.GetName(DefCat.ApptConfirmed, aptOld.Confirmed) + " to " + Defs.GetName(DefCat.ApptConfirmed, aptCur.Confirmed)
                                      + " due to an eConfirmation.", aptCur.AptNum, LogSources.AutoConfirmations, aptOld.DateTStamp);
            return(true);
        }
Ejemplo n.º 43
0
        public IActionResult Edit(int id, AppointmentsDetailViewModel appointmentsDetailDv)
        {
            if (id != appointmentsDetailDv.Appointments.Id)
            {
                return(NotFound());
            }

            if (!ModelState.IsValid)
            {
                return(View(appointmentsDetailDv));
            }

            Appointments appointments = _db.Appointments.Find(id);

            if (appointments == null)
            {
                return(NotFound());
            }

            appointments.CustomerName    = appointmentsDetailDv.Appointments.CustomerName;
            appointments.AppointmentDate = appointmentsDetailDv.Appointments.AppointmentDate
                                           .AddHours(appointmentsDetailDv.Appointments.AppointmentTime.Hour)
                                           .AddMinutes(appointmentsDetailDv.Appointments.AppointmentTime.Minute)
                                           .AddSeconds(appointmentsDetailDv.Appointments.AppointmentTime.Second);
            appointments.CustomerPhoneNumber = appointmentsDetailDv.Appointments.CustomerPhoneNumber;
            appointments.CustomerEmail       = appointmentsDetailDv.Appointments.CustomerEmail;
            appointments.IsConfirmed         = appointmentsDetailDv.Appointments.IsConfirmed;
            if (User.IsInRole(SD.SuperAdminEndUser))
            {
                appointments.ApplicationUserId = appointmentsDetailDv.Appointments.ApplicationUserId;
            }

            _db.Appointments.Update(appointments);
            _db.SaveChanges();
            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 44
0
        private async Task GetAppointments()
        {
            if (Appointments == null)
            {
                var patientId = AuthenticationUtils.GetPatientId(HttpContext);
                if (patientId.HasValue)
                {
                    if (AuthenticationUtils.IsUserInRole(HttpContext, Role.Doctor))
                    {
                        IsShownForDoctor = true;
                        Appointments     = await appointmentsService.GetAllAppointmentsForDoctor(patientId.Value);
                    }
                    else
                    {
                        IsShownForDoctor = false;
                        Appointments     = await appointmentsService.GetAllAppointmentsForUser(patientId.Value);
                    }

                    if (Appointments != null)
                    {
                        var futureAppointments = Appointments.Where(apt => apt.AppointmentDate >= DateTime.UtcNow).ToList();
                        var pastAppointments   = Appointments.Where(apt => apt.AppointmentDate < DateTime.UtcNow).ToList();
                        futureAppointments = futureAppointments.OrderBy(apt => apt.AppointmentDate).ToList();
                        pastAppointments   = pastAppointments.OrderByDescending(apt => apt.AppointmentDate).ToList();
                        Appointments       = futureAppointments.Concat(pastAppointments).ToList();

                        LocalizedReasons = new Dictionary <int, string>();

                        Appointments.ForEach(appointment =>
                        {
                            LocalizedReasons.Add(appointment.AppointmentId, GetLozalizedReasons(appointment));
                        });
                    }
                }
            }
        }
Ejemplo n.º 45
0
    /// <summary>
    /// Loads the appointments.
    /// </summary>
    /// <param name="date">The date.</param>
    /// <returns></returns>
    public static List<Appointments> LoadAppointments(DateTime date)
    {
        List<Appointments> appts = new List<Appointments>();

        XmlDocument doc = new XmlDocument();
        doc.Load(HttpContext.Current.Server.MapPath("Appointments.xml"));

        string xpath = "appointments/year[@value='" + date.Year.ToString() + "']/" + ((Helper.Month)date.Month).ToString().ToLower();
        XmlNode node = doc.SelectSingleNode(xpath);

        if (node != null)
        {
            foreach (XmlNode childNode in node.ChildNodes)
            {
                Appointments appointment = new Appointments();
                appointment.Id = int.Parse(childNode.Attributes["id"].Value.ToString());
                appointment.Year = date.Year;
                appointment.Month = (Helper.Month)date.Month;
                appointment.Day = int.Parse(childNode.Attributes["day"].Value.ToString());
                appointment.Description = childNode.Attributes["description"].Value.ToString();
                appointment.AppointmentStart = childNode.Attributes["begin"].Value.ToString();
                appointment.AppointmentEnd = childNode.Attributes["end"].Value.ToString();
                appointment.PopupDescription = childNode.Attributes["popupdescription"].Value.ToString();
                appts.Add(appointment);
            }
        }

        appts.Sort(delegate(Appointments a, Appointments b) { return a.Day.CompareTo(b.Day); });
        return appts;
    }
Ejemplo n.º 46
0
    /// <summary>
    /// Loads the appointments.
    /// </summary>
    /// <returns></returns>
    public static List<Appointments> LoadAppointments()
    {
        List<Appointments> appts = new List<Appointments>();

        XmlDocument doc = new XmlDocument();
        doc.Load(HttpContext.Current.Server.MapPath("Appointments.xml"));
        XmlNode rootNode = doc.SelectSingleNode("appointments");

        foreach (XmlNode yearNode in rootNode.ChildNodes)
        {
            foreach (XmlNode monthNode in yearNode.ChildNodes)
            {
                foreach (XmlNode apptNode in monthNode.ChildNodes)
                {
                    Appointments appointment = new Appointments();
                    appointment.Id = int.Parse(apptNode.Attributes["id"].Value.ToString());
                    appointment.Year = int.Parse(yearNode.Attributes["value"].Value.ToString());
                    appointment.Month = (Helper.Month)Enum.Parse(typeof(Helper.Month), monthNode.Name, true);
                    appointment.Day = int.Parse(apptNode.Attributes["day"].Value.ToString());
                    appointment.Description = apptNode.Attributes["description"].Value.ToString();
                    appointment.AppointmentStart = apptNode.Attributes["begin"].Value.ToString();
                    appointment.AppointmentEnd = apptNode.Attributes["end"].Value.ToString();
                    appointment.PopupDescription = apptNode.Attributes["popupdescription"].Value.ToString();
                    appts.Add(appointment);
                }
            }
        }

        appts.Sort(delegate(Appointments a, Appointments b) { return a.SortExpression.CompareTo(b.SortExpression); });
        return appts;
    }
Ejemplo n.º 47
0
    /// <summary>
    /// Adds the appointment.
    /// </summary>
    /// <param name="appt">The appt.</param>
    /// <param name="apptDate">The appt date.</param>
    public static void AddAppointment(Appointments appt, DateTime apptDate)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load(HttpContext.Current.Server.MapPath("Appointments.xml"));

        string xpath = "appointments/year[@value='" + apptDate.Year.ToString() + "']/" + ((Helper.Month)apptDate.Month).ToString().ToLower();
        XmlNode node = doc.SelectSingleNode(xpath);

        if (node != null)
        {
            XmlNode childNode = doc.CreateNode(XmlNodeType.Element, "appt", "");

            XmlAttribute attribDay = doc.CreateAttribute("day");
            attribDay.Value = appt.Day.ToString();

            XmlAttribute attribBegin = doc.CreateAttribute("begin");
            attribBegin.Value = appt.AppointmentStart;

            XmlAttribute attribEnd = doc.CreateAttribute("end");
            attribEnd.Value = appt.AppointmentEnd;

            XmlAttribute attribDesc = doc.CreateAttribute("description");
            attribDesc.Value = appt.Description;

            XmlAttribute attribPopUpDesc = doc.CreateAttribute("popupdescription");
            attribPopUpDesc.Value = appt.PopupDescription;

            childNode.Attributes.Append(attribDay);
            childNode.Attributes.Append(attribBegin);
            childNode.Attributes.Append(attribEnd);
            childNode.Attributes.Append(attribDesc);
            childNode.Attributes.Append(attribPopUpDesc);

            node.AppendChild(childNode);
        }

        doc.Save(HttpContext.Current.Server.MapPath("Appointments.xml"));
    }
Ejemplo n.º 48
0
        public bool RejectAppointment(Appointments appointment)
        {
            DataLayer dtLayer = new DataLayer();

            return(dtLayer.RejectAppointment(appointment.Appointments_ID, appointment.Appointments_App_Status));
        }
Ejemplo n.º 49
0
        //public async void SetCurrentBand(string bandName)
        //{
        //    await _groezrockService.SetActiveBand(bandName);
        //    CurrentBand = _groezrockService.SelectedBand;
        //    LookForAppointment();
        //}

        private void LookForAppointment()
        {
            Appointments appts = new Appointments();

            //Identify the method that runs after the asynchronous search completes.
            appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);


            //Start the asynchronous search.
            appts.SearchAsync(CurrentBand.Starts, CurrentBand.Ends, 5, "Appointments "+CurrentBand.Name);
        }
        private void Set_alarm_Click(object sender, RoutedEventArgs e)
        {
            IEnumerable<ScheduledNotification> notifications = ScheduledActionService.GetActions<ScheduledNotification>();
            for (int i = 0; i < notifications.Count(); i++)
            {
                if (notifications.ElementAt(i).ExpirationTime.TimeOfDay > notifications.ElementAt(i).BeginTime.AddSeconds(1).TimeOfDay &&notifications.ElementAt(i).ExpirationTime.TimeOfDay < notifications.ElementAt(i).BeginTime.AddSeconds(5).TimeOfDay)
                {
                    ScheduledActionService.Remove(notifications.ElementAt(i).Name);
                }
            }

            Appointments appts = new Appointments();

            appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);

            DateTime start = DateTime.Now.AddDays(1);
            start = start.AddHours(-start.Hour);
            start = start.AddMinutes(-start.Minute);
            DateTime end = start.AddDays(7);

            appts.SearchAsync(start, end, "Appointments Test #1");
        }
Ejemplo n.º 51
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            EventsResult res = DataContext as EventsResult;

            Appointments appts = new Appointments();

            //Identify the method that runs after the asynchronous search completes.
            appts.SearchCompleted += appts_SearchCompleted;

            DateTime start = DateTime.Parse(res.event_date);
            DateTime end = DateTime.Parse(res.event_date).Add(TimeSpan.FromHours(double.Parse(res.duration)));
            int max = 20;

            //Start the asynchronous search.
            appts.SearchAsync(start, end, max, res);
        }
Ejemplo n.º 52
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (!IsolatedStorageSettings.ApplicationSettings.Contains("LocationConsent"))
            {
                MessageBoxResult result =
                    MessageBox.Show("This app accesses your phone's location. Is that ok?",
                    "Location",
                    MessageBoxButton.OKCancel);
                IsolatedStorageSettings.ApplicationSettings["LocationConsent"] = (result == MessageBoxResult.OK);
                IsolatedStorageSettings.ApplicationSettings.Save();
            }

            if ((bool)IsolatedStorageSettings.ApplicationSettings["LocationConsent"])
            {
                geolocator = new Geolocator();
                geolocator.DesiredAccuracy = PositionAccuracy.High;
                geolocator.MovementThreshold = 1; // The units are meters.

                geolocator.StatusChanged += (sender, args) =>
                {
                    status = args.Status;
                    ShowLoc();
                };
                geolocator.PositionChanged += (sender, args) =>
                {
                    coordinate = args.Position.Coordinate;
                    ShowLoc();
                };
            }

            if (Motion.IsSupported)
            {
                motion = new Motion();
                motion.TimeBetweenUpdates = TimeSpan.FromMilliseconds(20);
                motion.CurrentValueChanged += (sender, e2) => CurrentValueChanged(e2.SensorReading);

                // Try to start the Motion API.
                try
                {
                    motion.Start();
                }
                catch (Exception)
                {
                    MessageBox.Show("unable to start the Motion API.");
                }
            }

            Appointments appointments = new Appointments();
            appointments.SearchCompleted += (sender, e2) =>
            {
                DateList.ItemsSource = e2.Results.OrderBy(p => p.StartTime);
                Waiter(false);
            };
            appointments.SearchAsync(DateTime.Now, DateTime.Now.AddDays(7), null);
        }
Ejemplo n.º 53
0
 public void FillSpeachDataWithAppointments()
 {
     Appointments appo = new Appointments();
     appo.SearchCompleted += finishSearchAndAddSpeach;
     appo.SearchAsync(DateTime.Now, DateTime.Now.AddYears(1), 1000, null);
 }
Ejemplo n.º 54
0
        private void checkEvent(EventsResult res)
        {
            Appointments appts = new Appointments();

            //Identify the method that runs after the asynchronous search completes.
            appts.SearchCompleted += appts_SearchCompleted;

            DateTime start = DateTime.Parse(res.event_date);
            DateTime end = DateTime.Parse(res.event_date).Add(TimeSpan.FromHours(double.Parse(res.duration)));
            int max = 20;

            //Start the asynchronous search.
            appts.SearchAsync(start, end, max, res);
        }
Ejemplo n.º 55
0
 private async void SayAppintments()
 {
     Appointments appo = new Appointments();
     appo.SearchCompleted += finishSearch;
     appo.SearchAsync(DateTime.Now, DateTime.Now.Add(new TimeSpan(7, 0, 0, 0)), 1, null);
     onFinish.Invoke(new Task(o => { }, "Have Fun"));
 }
Ejemplo n.º 56
0
 public static Appointments CreateAppointments(global::System.Guid ID, string subject, global::System.DateTime start, global::System.DateTime end, long iD2)
 {
     Appointments appointments = new Appointments();
     appointments.ID = ID;
     appointments.Subject = subject;
     appointments.Start = start;
     appointments.End = end;
     appointments.ID2 = iD2;
     return appointments;
 }
Ejemplo n.º 57
0
 public void AddToAppointments(Appointments appointments)
 {
     base.AddObject("Appointments", appointments);
 }
Ejemplo n.º 58
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
#if WINDOWS_PHONE
            if (!IsolatedStorageSettings.ApplicationSettings.Contains("LocationConsent"))
            {
                MessageBoxResult result =
                    MessageBox.Show("This app accesses your phone's location. Is that ok?",
                    "Location",
                    MessageBoxButton.OKCancel);
                IsolatedStorageSettings.ApplicationSettings["LocationConsent"] = (result == MessageBoxResult.OK);
                IsolatedStorageSettings.ApplicationSettings.Save();
            }

            if ((bool)IsolatedStorageSettings.ApplicationSettings["LocationConsent"])
#endif
#if WINDOWS_PHONE || NETFX_CORE
            {
                geolocator = new Geolocator();
                geolocator.DesiredAccuracy = PositionAccuracy.High;
                geolocator.MovementThreshold = 1; // The units are meters.

                geolocator.StatusChanged += (sender, args) =>
                {
                    status = args.Status.ToString();
                    ShowLoc();
                };
                geolocator.PositionChanged += (sender, args) =>
                {
                    coordinate = new GeoCoord(args.Position.Coordinate.Latitude,
                        args.Position.Coordinate.Longitude,
                        args.Position.Coordinate.Accuracy);
                    ShowLoc();
                };
            }
#endif
#if WINDOWS_PHONE
            if (Motion.IsSupported)
            {
                motion = new Motion();
                motion.TimeBetweenUpdates = TimeSpan.FromMilliseconds(20);
                motion.CurrentValueChanged += (sender, e2) => CurrentValueChanged(e2.SensorReading);

                // Try to start the Motion API.
                try
                {
                    motion.Start();
                }
                catch (Exception)
                {
                    MessageBox.Show("unable to start the Motion API.");
                }
            }

            Appointments appointments = new Appointments();
            appointments.SearchCompleted += (sender, e2) =>
            {
                List<FakeAppointment> res = e2.Results.Select(p => new FakeAppointment(p)).ToList();
                if (res.Count == 0)
                {
                    res.Add(new FakeAppointment( "Zumo test Team meeting",  new DateTime(2013, 7, 25), "Conf Room 2/2063 (8) AV" ));
                }
                this.DateList.ItemsSource = res.OrderBy(p => p.StartTime);
                Waiter(false);
            };
            appointments.SearchAsync(DateTime.Now, DateTime.Now.AddDays(7), null);
#else
            List<FakeAppointment> res = new List<FakeAppointment>();
            if (res.Count == 0)
            {
                res.Add(new FakeAppointment("Zumo test Team meeting", new DateTime(2013, 7, 25), "Conf Room 2/2063 (8) AV"));
            }
            this.DateList.ItemsSource = res.OrderBy(p => p.StartTime);
            Waiter(false);
#endif
        }
Ejemplo n.º 59
0
 public static void DeleteAppointment(String AppointmentId)
 {
     Appointments[AppointmentId].cancel();
     Appointments.Remove(AppointmentId);
 }
Ejemplo n.º 60
0
        protected virtual void OnResolveAppointments(ResolveAppointmentsEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine("Resolve app");

            if (ResolveAppointments != null)
                ResolveAppointments(this, args);

            this.allDayEventsHeaderHeight = 0;

            // cache resolved appointments in hashtable by days.
            cachedAppointments.Clear();

            if ((selectedAppointmentIsNew) && (selectedAppointment != null))
            {
                if ((selectedAppointment.StartDate > args.StartDate) && (selectedAppointment.StartDate < args.EndDate))
                {
                    args.Appointments.Add(selectedAppointment);
                }
            }

            foreach (Appointment appointment in args.Appointments)
            {
                int key = -1;
                Appointments list;

                if (appointment.StartDate.Day == appointment.EndDate.Day)
                {
                    key = appointment.StartDate.Day;
                }
                else
                {
                    // use -1 for exceeding one more than day
                    key = -1;

                    /* ALL DAY EVENTS IS NOT COMPLETE
                    this.allDayEventsHeaderHeight += horizontalAppointmentHeight;
                     */
                }

                list = (Appointments)cachedAppointments[key];

                if (list == null)
                {
                    list = new Appointments();
                    cachedAppointments[key] = list;
                }

                list.Add(appointment);
            }
        }