コード例 #1
0
        public Pharmacy getPharmacy()
        {
            var pharm = DatabasePharmacyService.GetByIdActive(this.PharmacyId);

            pharm.GetTemplates();
            return(pharm);
        }
コード例 #2
0
        public string MakePhoneCall()
        {
            TwilioApi twilio = new TwilioApi(DatabasePharmacyService.GetById(1));

            twilio.MakePhoneCall(new Notification());
            return("Calling");
        }
コード例 #3
0
        public ActionResult UploadRecalls()
        {
            var pharm = DatabasePharmacyService.GetById((long)Session["pharm_id"]);

            pharm.GetTemplates();
            return(View(pharm));
        }
コード例 #4
0
        public ActionResult Refill(long id)
        {
            var      n   = DatabaseNotificationService.GetById(id);
            var      pat = DatabasePatientService.GetById(n.PatientId);
            Pharmacy p   = DatabasePharmacyService.GetById(pat.PharmacyId);

            p.GetTemplates();
            string message = p.GetRefillTemplate().TemplatePhone;
            var    xml     = new XDocument(
                new XElement("Response",
                             new XElement("Gather",
                                          new XAttribute("timeout", "10"),
                                          new XAttribute("numDigits", "1"),
                                          new XAttribute("action", "https://ocharambe.localtunnel.me/twilioresponse/refillresponse/" + id),
                                          new XElement("Say",
                                                       message
                                                       )
                                          ),
                             new XElement("Say",
                                          "We didn't recieve any input, Goodbye!")
                             )
                );

            return(new XmlActionResult(xml));
        }
コード例 #5
0
        public ActionResult RecallResponse(long id)
        {
            var    notification = DatabaseNotificationService.GetById(id);
            var    user         = DatabasePatientService.GetById(notification.PatientId);
            string digits       = Request["Digits"];

            System.Diagnostics.Debug.WriteLine(digits);
            if (digits.Contains("9"))
            {
                var xml = new XDocument(
                    new XElement("Response",
                                 new XElement("Say",
                                              "Connecting you to a pharmacist."),
                                 new XElement("Dial",
                                              DatabasePharmacyService.GetById(user.PharmacyId).PharmacyPhone)
                                 )
                    );
                return(new XmlActionResult(xml));
            }
            else
            {
                var xml = new XDocument(
                    new XElement("Response",
                                 new XElement("Say",
                                              "Unrecognized Input, Goodbye")
                                 )
                    );
                return(new XmlActionResult(xml));
            }
        }
コード例 #6
0
        public ActionResult RefillResponse(long id)
        {
            string digits = Request["Digits"];

            System.Diagnostics.Debug.WriteLine(Request["To"]);
            var notification = DatabaseNotificationService.GetById(id);
            var user         = DatabasePatientService.GetById(notification.PatientId);

            if (digits.Contains("1"))
            {
                XDocument xml = null;
                if (user != null)
                {
                    notification.NotificationResponse = Request["digits"];
                    DatabaseNotificationService.Update(notification);
                    var refill = DatabaseRefillService.GetByPrescriptionId(DatabasePrescriptionService.GetByPatientId(user.PatientId).PrescriptionId);
                    refill.RefillIt = true;
                    DatabaseRefillService.Update(refill);
                    xml = new XDocument(
                        new XElement("Response",
                                     new XElement("Say",
                                                  "Your refill will be ready shortly.")
                                     )
                        );
                }
                else
                {
                    xml = new XDocument(
                        new XElement("Response",
                                     new XElement("Say",
                                                  "couldn't find refill")
                                     )
                        );
                }
                return(new XmlActionResult(xml));
            }
            else if (digits.Contains("9"))
            {
                var xml = new XDocument(
                    new XElement("Response",
                                 new XElement("Say",
                                              "Connecting you to a pharmacist."),
                                 new XElement("Dial",
                                              DatabasePharmacyService.GetById(user.PharmacyId).PharmacyPhone)
                                 )
                    );
                return(new XmlActionResult(xml));
            }
            else
            {
                var xml = new XDocument(
                    new XElement("Response",
                                 new XElement("Say",
                                              "Unrecognized Input, Goodbye")
                                 )
                    );
                return(new XmlActionResult(xml));
            }
        }
コード例 #7
0
        public ActionResult Admin()
        {
            var id       = DatabasePharmacistService.GetByUserId((long)Session[Login.UserIdSession]).PharmacyId;
            var pharmacy = DatabasePharmacyService.GetById(id);

            pharmacy.GetTemplates();

            return(View(pharmacy));
        }
コード例 #8
0
        public ActionResult UploadRecalls(HttpPostedFileBase upload, string recallMessage)
        {
            var pharm = DatabasePharmacyService.GetById((long)Session["pharm_id"]);

            pharm.GetTemplates();
            if (ModelState.IsValid)
            {
                if (upload != null && upload.ContentLength > 0)
                {
                    if (upload.FileName.EndsWith(".csv"))
                    {
                        var stream   = upload.InputStream;
                        var csvTable = new DataTable();
                        using (var csvReader =
                                   new CsvReader(new StreamReader(stream), true))
                        {
                            csvTable.Load(csvReader);
                        }
                        foreach (DataRow row in csvTable.Rows)
                        {
                            var patient = new Patient {
                                FirstName           = row["PatientFirstName"].ToString(),
                                LastName            = row["PatientLastName"].ToString(),
                                Phone               = row["Phone"].ToString(),
                                PharmacyId          = 1,
                                DateOfBirth         = DateTime.Now,
                                Email               = "*****@*****.**",
                                ContactMethod       = Patient.PrimaryContactMethod.Call,
                                PreferedContactTime = DateTime.Now,
                                PersonCode          = row["PersonCode"].ToString()
                            };
                            var id = DatabaseUserService.Insert(patient);
                            patient.UserId    = id;
                            patient.PatientId = DatabasePatientService.Insert(patient);
                            var notification = new Notification(DateTime.Now, patient.PatientId, Notification.NotificationType.Recall, recallMessage);
                            DatabasePatientService.Disable(patient.PatientId);
                            DatabaseNotificationService.Insert(notification);
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("File", "This file format is not supported");
                        return(View(pharm));
                    }
                }
                else
                {
                    ModelState.AddModelError("File", "Please Upload Your file");
                }
            }
            return(View(pharm));
        }
コード例 #9
0
        public ActionResult AddorEditPharmacy(
            string refillTextTemplate, string refillPhoneTemplate, string refillEmailTemplate,
            string pickupTextTemplate, string pickupPhoneTemplate, string pickupEmailTemplate,
            string recallTextTemplate, string recallPhoneTemplate, string recallEmailTemplate,
            string birthdayTextTemplate, string birthdayPhoneTemplate, string birthdayEmailTemplate,
            string notificationDisabledTextTemplate, string notificationDisabledPhoneTemplate, string notificationDisabledEmailTemplate,
            string pharmacyName, string pharmacyPhone, string pharmacyAddress, long pharmacyId)
        {
            Pharmacy pharmacy;

            if (pharmacyId != 0)
            {
                pharmacy = DatabasePharmacyService.GetById(pharmacyId);
                pharmacy.GetTemplates();
            }
            else
            {
                pharmacy = new Pharmacy();
                pharmacy.Fill();
                pharmacy.PharmacyId = DatabasePharmacyService.Insert(pharmacy);
                pharmacy.InsertDefaultTemplateData();
                pharmacy.SaveNewTemplates();
            }

            pharmacy.PharmacyName    = pharmacyName;
            pharmacy.PharmacyPhone   = pharmacyPhone;
            pharmacy.PharmacyAddress = pharmacyAddress;

            pharmacy.TemplateRefill.TemplateText  = refillTextTemplate;
            pharmacy.TemplateRefill.TemplatePhone = refillPhoneTemplate;
            pharmacy.TemplateRefill.TemplateEmail = refillEmailTemplate;

            pharmacy.TemplateReady.TemplateText  = pickupTextTemplate;
            pharmacy.TemplateReady.TemplatePhone = pickupPhoneTemplate;
            pharmacy.TemplateReady.TemplateEmail = pickupEmailTemplate;

            pharmacy.TemplateRecall.TemplateText  = recallTextTemplate;
            pharmacy.TemplateRecall.TemplatePhone = recallPhoneTemplate;
            pharmacy.TemplateRecall.TemplateEmail = recallEmailTemplate;

            pharmacy.TemplateBirthday.TemplateText  = birthdayTextTemplate;
            pharmacy.TemplateBirthday.TemplatePhone = birthdayPhoneTemplate;
            pharmacy.TemplateBirthday.TemplateEmail = birthdayEmailTemplate;

            DatabasePharmacyService.Update(pharmacy);
            pharmacy.SaveTemplates();

            return(Redirect("/PpokAdmin/PharmacyListView"));
        }
コード例 #10
0
        public ActionResult PharmacyDisplay(long id)
        {
            Pharmacy          pharmacy    = DatabasePharmacyService.GetById(id);
            List <Pharmacist> pharmacists = DatabasePharmacistService.GetAll();
            Pharmacist        pharmacist  = new Pharmacist();

            foreach (Pharmacist p in pharmacists)
            {
                if (p.Enabled && p.IsAdmin)
                {
                    pharmacist = p;
                }
            }
            return(View(new System.Tuple <Pharmacy, Pharmacist>(pharmacy, pharmacist)));
        }
コード例 #11
0
        public ActionResult AddorEditPharmacy(long id = 0)
        {
            var pharmacy = DatabasePharmacyService.GetById(id);

            if (pharmacy == null)
            {
                pharmacy = new Pharmacy();
                pharmacy.InsertDefaultTemplateData();
            }
            else
            {
                pharmacy.GetTemplates();
            }

            return(View("~/Views/Pharmacy/Admin.cshtml", pharmacy));
        }
コード例 #12
0
        public static long FakeDataFill()
        {
            var pharmacy = new Pharmacy {
                PharmacyAddress = "Some Pharmacy\nSome Address\nSome City, OK 73008",
                PharmacyName    = "Fake Pharmacy",
                PharmacyPhone   = "+18065703539"
            };

            pharmacy.PharmacyId = DatabasePharmacyService.Insert(pharmacy);

            pharmacy.InsertDefaultTemplateData();

            pharmacy.SaveNewTemplates();
            DatabasePharmacyService.InsertOrUpdate(pharmacy);

            return(pharmacy.PharmacyId);
        }
コード例 #13
0
        public ActionResult Admin(
            string refillTextTemplate, string refillPhoneTemplate, string refillEmailTemplate,
            string pickupTextTemplate, string pickupPhoneTemplate, string pickupEmailTemplate,
            string recallTextTemplate, string recallPhoneTemplate, string recallEmailTemplate,
            string birthdayTextTemplate, string birthdayPhoneTemplate, string birthdayEmailTemplate,
            string notificationDisabledTextTemplate, string notificationDisabledPhoneTemplate, string notificationDisabledEmailTemplate,
            string pharmacyName, string pharmacyPhone, string pharmacyAddress, long pharmacyId)
        {
            var pharmacy = DatabasePharmacyService.GetById(pharmacyId);

            pharmacy.GetTemplates();

            pharmacy.PharmacyName    = pharmacyName;
            pharmacy.PharmacyPhone   = pharmacyPhone;
            pharmacy.PharmacyAddress = pharmacyAddress;

            pharmacy.TemplateRefill.TemplateText  = refillTextTemplate;
            pharmacy.TemplateRefill.TemplatePhone = refillPhoneTemplate;
            pharmacy.TemplateRefill.TemplateEmail = refillEmailTemplate;

            pharmacy.TemplateReady.TemplateText  = pickupTextTemplate;
            pharmacy.TemplateReady.TemplatePhone = pickupPhoneTemplate;
            pharmacy.TemplateReady.TemplateEmail = pickupEmailTemplate;

            pharmacy.TemplateRecall.TemplateText  = recallTextTemplate;
            pharmacy.TemplateRecall.TemplatePhone = recallPhoneTemplate;
            pharmacy.TemplateRecall.TemplateEmail = recallEmailTemplate;

            pharmacy.TemplateBirthday.TemplateText  = birthdayTextTemplate;
            pharmacy.TemplateBirthday.TemplatePhone = birthdayPhoneTemplate;
            pharmacy.TemplateBirthday.TemplateEmail = birthdayEmailTemplate;

            DatabasePharmacyService.Update(pharmacy);
            pharmacy.SaveTemplates();


            return(View(pharmacy));
        }
コード例 #14
0
        // returned view for seeing a list of pharmacies
        // can add to list
        // can select edit/view/delete from list
        //[HttpPost]
        public ActionResult PharmacyListView()
        {
            var pharamcies = DatabasePharmacyService.GetAllActive();

            return(View(pharamcies));
        }
コード例 #15
0
 public ActionResult DeletePharmacy(long id)
 {
     DatabasePharmacyService.Disable(id);
     return(Redirect("/PpokAdmin/PharmacyListView"));
 }