Exemple #1
0
        public void EmergencyConfirm(string username, string patientid, EmergencyConfirm mesge)
        {
            echelperDBEntities context = new echelperDBEntities();

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

            doctor.Latitude  = mesge.latitude;
            doctor.Longitude = mesge.longitude;
            context.SaveChanges();
            Patient patient      = context.Patient.First(p => p.LiveID == patientid);
            string  toastMessage = "";

            if (mesge.confirm == "yes")
            {
                toastMessage = "<EmergencyConfirm>" +
                               "<Type>1</Type>" +
                               "<doctorName>" + doctor.Name + "</doctorName>" +
                               "<latitude>" + doctor.Longitude + "</latitude>" +
                               "<longitude>" + doctor.Latitude + "</longitude>" +
                               "<reply>true</reply>" +
                               "</EmergencyConfirm>";
            }
            else
            {
                toastMessage = "<EmergencyConfirm>" +
                               "<Type>1</Type>" +
                               "<doctorName>" + doctor.Name + "</doctorName>" +
                               "<latitude>" + doctor.Longitude + "</latitude>" +
                               "<longitude>" + doctor.Latitude + "</longitude>" +
                               "<reply>false</reply>" +
                               "</EmergencyConfirm>";
            }
            byte[] strBytes = new UTF8Encoding().GetBytes(toastMessage);
            if (patient.Channel != null)
            {
                sendWinNotificationType(strBytes, patient.Channel);
            }
        }
Exemple #2
0
        public void EmergencyConfirm(string username, string patientid, EmergencyConfirm mesge)
        {
            echelperDBEntities context = new echelperDBEntities();
            context.Refresh(System.Data.Objects.RefreshMode.StoreWins, context.Patient);
            context.Refresh(System.Data.Objects.RefreshMode.StoreWins, context.Doctor);
            Doctor doctor = context.Doctor.First(p => p.LiveID == username);
            doctor.Latitude = mesge.latitude;
            doctor.Longitude = mesge.longitude;
            context.SaveChanges();
            Patient patient = context.Patient.First(p => p.LiveID == patientid);
            string toastMessage="";
            if (mesge.confirm=="yes")
            {
                toastMessage = "<EmergencyConfirm>" +
                            "<Type>1</Type>"+
                              "<doctorName>" + doctor.Name + "</doctorName>" +
                               "<latitude>" + doctor.Longitude + "</latitude>" +
                               "<longitude>" + doctor.Latitude + "</longitude>" +
                               "<reply>true</reply>" +
                        "</EmergencyConfirm>";

            }
            else {
                toastMessage = "<EmergencyConfirm>" +
                                "<Type>1</Type>" +
                              "<doctorName>" + doctor.Name + "</doctorName>" +
                               "<latitude>" + doctor.Longitude + "</latitude>" +
                               "<longitude>" + doctor.Latitude + "</longitude>" +
                               "<reply>false</reply>" +
                        "</EmergencyConfirm>";
            }
            byte[] strBytes = new UTF8Encoding().GetBytes(toastMessage);
            if (patient.Channel != null)
            {
                sendWinNotificationType(strBytes, patient.Channel);
            }
        }