// GET: api/Patients public IEnumerable<Patient> Get() { PatientsData patientsData = new PatientsData(); var queryString = this.Request.GetQueryNameValuePairs().ToList(); string filter = System.Web.Http.HttpRequestMessageExtensions.GetQueryString(Request, "filter.filters[0].value"); return patientsData.GetPatientListByID(filter); }
// POST: api/NewPatient public IHttpActionResult Post([FromBody]NewPatient newPatient) { string returnValue = string.Empty; PatientsData patients = new PatientsData(); string uniqueID = patients.RegisterANewPatient(newPatient); returnValue = "{ UniqueID : " + uniqueID + " }"; return Ok(uniqueID.ToString()); }
// POST: api/NewPatient public IHttpActionResult Post([FromBody]NewPatient newPatient) //public void Post([FromBody]string newPatient) { /// string s1 = newPatient; PatientsData patients = new PatientsData(); patients.CreateNewPatient(newPatient); return Ok(); }
// POST: api/ConfirmRegistration public void Post([FromBody]Registration registration) { bool confirmUpdate = false; bool createNewPatient = false; //Steps //1. Update unique id with unique from users table //2. Insert into patient table //3. Send out email with password. PatientsData patients = new PatientsData(); //Step 1 string urlForEmail = System.Configuration.ConfigurationManager.AppSettings["urlForEmail"]; string officeName = System.Configuration.ConfigurationManager.AppSettings["officeName"]; Patient registeredPatient = patients.GetPreRegistrationPatientInformationFromEmail(registration.Email); string uniqueId = patients.UniquePatientID(registration.Email); confirmUpdate = patients.UpdatePatientID(uniqueId, registration.Email); if (confirmUpdate) { createNewPatient = patients.CreatePatientFromPreRegistration(uniqueId); } patients.AddNewPatientPassword(registration); patients.UpdatePreRegisterationPatient(uniqueId); //registration. //registration. //Step 3 SendEmail.EmailFrom = "*****@*****.**"; //SendEmail.EmailFromFriendlyName = "Grove Hill Clinic"; SendEmail.EmailFromFriendlyName = "A Patient Connects"; SendEmail.EmailTo = registration.Email; SendEmail.EmailToFriendlyName = registeredPatient.FirstName + " " + registeredPatient.LastName; SendEmail.EmailSubject = "Confirming Registration"; SendEmail.EmailBody = "<p style= " + "\"" + "font-family: Arial;" + "\"" + ">" + registeredPatient.FirstName + " " + registeredPatient.LastName + "<br /><br />" + "This is an automated message from " + officeName + "<br /><br />" + "Your Registration for A Patient Connects has been approved" + "<br />" + " Your new User ID and Password are Below" + "<br /><br />" + " You will need to change your password after you first log in" + "<br /><br />" + " User ID = " + registeredPatient.Email + "<br />" + " Password = "******"<br /><br /><br />" + " Click on the link below to log in " + "<br /><br />" + "<a href=" + "\"" + urlForEmail + "\"" + ">Click here to Log in</a>" + "<br /><br /><br />" + " PLEASE DO NOT REPLY TO THIS EMAIL " + "<br /><br />" + "</p>" ; SendEmail.SmtpHost = "smtp.gmail.com"; SendEmail.SmtpHostUserName = "******"; SendEmail.SmtpHostPassword = "******"; SendEmail.IsSSL = true; SendEmail.SmtpPort = 465; SendEmail.IsHTML = true; SendEmail.SendAnEmail(); }
// POST: api/UpdatePassword public async Task<IHttpActionResult> Post([FromBody]UpdatePassword value) { string s1 = value.OldPassword; PatientsData patientsData = new PatientsData(); string uniqueUserID = patientsData.GetPatientIDFromUserName(value.UserId); if (!ModelState.IsValid) { return BadRequest(ModelState); } IdentityResult result = await UserManager.ChangePasswordAsync(uniqueUserID, value.OldPassword, value.NewPassword); if (!result.Succeeded) { return GetErrorResult(result); } patientsData.UpdatePatientFirstLogin(uniqueUserID); return Ok(); }
// GET: api/CheckUserFirstTime async public Task<IHttpActionResult> Get(string username, string password) { //ConfigurationValues.GroveHillConnection = "Server=23.25.228.34;Database=apatientconnects;Uid=root;Pwd=root;"; ApplicationUser user = await UserManager.FindAsync(username,password); if (user == null) { //context.SetError("invalid_grant", "The user name or password is incorrect."); return Ok("UserNameInvalid"); } PatientsData patients = new PatientsData(); bool firstLogin = patients.IsPatientFirstLogin(username); if (firstLogin) { return Ok("GreaterThanFirst"); } else { return Ok("First"); } }
// GET: api/PatientInformation public Patient Get(string email) { PatientsData patients = new PatientsData(); return patients.GetPatientInformation(email); }
// GET: api/Patient public IEnumerable<Patient> Get() { PatientsData patients = new PatientsData(); return patients.GetPatients(); }
// GET: api/CheckRegistration public ReturnStatus Get(string email) { //CheckRegistrationStatus PatientsData patientData = new PatientsData(); return patientData.CheckRegistrationStatus(email); }
// GET: api/PreRergistrerNewPatient public IEnumerable<NewPatient> Get() { PatientsData patients = new PatientsData(); return patients.GetPatientWhoHaveRegistered(); }