Exemplo n.º 1
0
        public void EmergencyCall(string username, string doctorid, EmergencyMesg mesg)
        {
            echelperDBEntities context = new echelperDBEntities();

            context.Refresh(System.Data.Objects.RefreshMode.StoreWins, context.Patient);
            context.Refresh(System.Data.Objects.RefreshMode.StoreWins, context.Doctor);
            Patient patient = context.Patient.First(p => p.LiveID == username);

            patient.Latitude  = mesg.latitude;
            patient.Longitude = mesg.longitude;
            context.SaveChanges();
            Doctor doctor = context.Doctor.First(p => p.LiveID == doctorid);

            string toastMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                                  "<wp:Notification xmlns:wp=\"WPNotification\">" +
                                  "<wp:Toast>" +
                                  "<wp:Text0>1</wp:Text0>" +
                                  "<wp:Text1>" + patient.Name + "</wp:Text1>" +
                                  "<wp:Text2>" + patient.Latitude + "</wp:Text2>" +
                                  "<wp:Text3>" + patient.Longitude + "</wp:Text3>" +
                                  "</wp:Toast>" +
                                  "</wp:Notification>";

            byte[] strBytes = new UTF8Encoding().GetBytes(toastMessage);
            if (doctor.Channel != null)
            {
                sendNotificationType(strBytes, doctor.Channel);
            }
        }
Exemplo n.º 2
0
        public void EmergencyCall(string username,string doctorid,EmergencyMesg mesg) {
            echelperDBEntities context = new echelperDBEntities();
            context.Refresh(System.Data.Objects.RefreshMode.StoreWins, context.Patient);
            context.Refresh(System.Data.Objects.RefreshMode.StoreWins, context.Doctor);
            Patient patient = context.Patient.First(p => p.LiveID == username);
            patient.Latitude = mesg.latitude;
            patient.Longitude = mesg.longitude;
            context.SaveChanges();
            Doctor doctor = context.Doctor.First(p=> p.LiveID == doctorid);

            string toastMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                        "<wp:Notification xmlns:wp=\"WPNotification\">" +
                           "<wp:Toast>" +
                              "<wp:Text0>1</wp:Text0>" +
                              "<wp:Text1>" + patient.Name + "</wp:Text1>" +
                              "<wp:Text2>" + patient.Latitude + "</wp:Text2>" +
                              "<wp:Text3>" + patient.Longitude + "</wp:Text3>" +
                           "</wp:Toast>" +
                        "</wp:Notification>";

            byte[] strBytes = new UTF8Encoding().GetBytes(toastMessage);
            if (doctor.Channel != null)
            {
                sendNotificationType(strBytes, doctor.Channel);
            }
        }