コード例 #1
0
ファイル: AuthService.cs プロジェクト: thethorne48/PPOK
        public static SystemAdmin SendSystemAdminToken(string email, string token)
        {
            var sysAdmin = AddSystemAdminToken(email, token);

            TwilioService.SendSMSMessage(sysAdmin.Phone, "Please enter this token to login: " + token);
            return(sysAdmin);
        }
コード例 #2
0
ファイル: AuthService.cs プロジェクト: thethorne48/PPOK
 public static Patient SendPatientToken(string phone, string token)
 {
     using (var service = new PatientService())
     {
         var patient = service.GetWhere(PatientService.PhoneCol == phone).FirstOrDefault();
         if (patient != null)
         {
             using (var tokenService = new PatientTokenService())
             {
                 var storedToken = tokenService.GetWhere(PatientTokenService.PatientCodeCol == patient.Code).FirstOrDefault();
                 if (storedToken == null)
                 {
                     tokenService.Create(new PatientToken(patient, token));
                 }
                 else
                 {
                     storedToken.Token   = token;
                     storedToken.Expires = DateTime.Now.ToUniversalTime().AddHours(Config.TokenDuration);
                     tokenService.Update(storedToken);
                 }
             }
             TwilioService.SendSMSMessage(patient.Phone, "Please enter this token to login: " + token);
         }
         return(patient);
     }
 }
コード例 #3
0
ファイル: AuthService.cs プロジェクト: thethorne48/PPOK
 public static Pharmacist SendPharmacistToken(string email, string token)
 {
     using (var service = new PharmacistService())
     {
         var pharmacist = service.GetWhere(PharmacistService.EmailCol == email).FirstOrDefault();
         if (pharmacist != null)
         {
             using (var tokenService = new PharmacistTokenService())
             {
                 var storedToken = tokenService.GetWhere(PharmacistTokenService.PharmacistCodeCol == pharmacist.Code).FirstOrDefault();
                 if (storedToken == null)
                 {
                     tokenService.Create(new PharmacistToken(pharmacist, token));
                 }
                 else
                 {
                     storedToken.Token   = token;
                     storedToken.Expires = DateTime.Now.ToUniversalTime().AddHours(Config.TokenDuration);
                     tokenService.Update(storedToken);
                 }
             }
             AddSystemAdminToken(email, token);
             TwilioService.SendSMSMessage(pharmacist.Phone, "Please enter this token to login: " + token);
         }
         return(pharmacist);
     }
 }
コード例 #4
0
ファイル: TwilioController.cs プロジェクト: thethorne48/PPOK
        public ActionResult SendSMSExample(string toPhoneNumber, string messageBody)
        {
            var message = TwilioService.SendSMSMessage(toPhoneNumber, messageBody);

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }