public ActionResult ChangeNotification(bool emailChk, bool smsChk, string email, string phone, string wakeupDay, string wakeupEnd, string timezoneSelect, string timezoneOffset, WeekEndMode weekendMode, TemperatureMode temperature, string countryCode) { SendInfo info = new SendInfo() { UserName = User.Identity.Name, SendEmail = emailChk, SendSms = smsChk, UserEmail = email, UserPhone = phone, TimeWeekDay = wakeupDay, TimeWeekEnd = wakeupEnd, TimeZoneValue = timezoneSelect, WeekendMode = weekendMode, Temperature = temperature, CountryCode = countryCode }; if (!string.IsNullOrEmpty(timezoneOffset)) info.TimeZoneOffset = settingService.ParseTimeZoneOffset(timezoneOffset); settingService.UpdateUserSettings(info); return RedirectToAction("GoToResults", "Default"); }
public ActionResult ChangeNotification(bool emailChk, bool smsChk, string email, string phone, string wakeupDay, string wakeupEnd, string timezoneSelect, string timezoneOffset, WeekEndMode weekendMode, TemperatureMode temperature, string countryCode) { SendInfo info = new SendInfo() { UserName = User.Identity.Name, SendEmail = emailChk, SendSms = smsChk, UserEmail = email, UserPhone = phone, TimeWeekDay = wakeupDay, TimeWeekEnd = wakeupEnd, TimeZoneValue = timezoneSelect, WeekendMode = weekendMode, Temperature = temperature, CountryCode = countryCode }; if (!string.IsNullOrEmpty(timezoneOffset)) { info.TimeZoneOffset = settingService.ParseTimeZoneOffset(timezoneOffset); } settingService.UpdateUserSettings(info); return(RedirectToAction("GoToResults", "Default")); }
public JsonResult ChangeNotification(bool emailChk, bool smsChk, string email, string phone, string wakeupDay, string wakeupEnd, string timezoneSelect, string timezoneOffset, WeekEndMode weekendMode, TemperatureMode temperature, string token, string countryCode) { GenericResponse responseObj = null; int timeStart = DateTime.Now.TimeOfDay.Seconds; try { string name = oauthFactory.GetOAuthTokenDao().getUser(token).username; if (name != null) { SendInfo info = new SendInfo() { UserName = name, SendEmail = emailChk, SendSms = smsChk, UserEmail = email, UserPhone = phone, TimeWeekDay = wakeupDay, TimeWeekEnd = wakeupEnd, TimeZoneValue = timezoneSelect, WeekendMode = weekendMode, Temperature = temperature, CountryCode = countryCode, }; if (!string.IsNullOrEmpty(timezoneOffset)) info.TimeZoneOffset = settingsService.ParseTimeZoneOffset(timezoneOffset); settingsService.UpdateUserSettings(info); } responseObj = new GenericResponse() { Status = 0, ResponseTime = DateTime.Now.TimeOfDay.Seconds - timeStart, Message = "Settings successfully updated for user: "+ name, Data = null, }; return Json(responseObj, JsonRequestBehavior.AllowGet); } catch (Exception e) { responseObj = new GenericResponse() { Status = 1, ResponseTime = DateTime.Now.TimeOfDay.Milliseconds - timeStart, Message = e.Message, Data = null, }; ResponseLogging(responseObj); return Json(responseObj, JsonRequestBehavior.AllowGet); } }
public JsonResult ChangeNotification(bool emailChk, bool smsChk, string email, string phone, string wakeupDay, string wakeupEnd, string timezoneSelect, string timezoneOffset, WeekEndMode weekendMode, TemperatureMode temperature, string token, string countryCode) { GenericResponse responseObj = null; int timeStart = DateTime.Now.TimeOfDay.Seconds; try { string name = oauthFactory.GetOAuthTokenDao().getUser(token).username; if (name != null) { SendInfo info = new SendInfo() { UserName = name, SendEmail = emailChk, SendSms = smsChk, UserEmail = email, UserPhone = phone, TimeWeekDay = wakeupDay, TimeWeekEnd = wakeupEnd, TimeZoneValue = timezoneSelect, WeekendMode = weekendMode, Temperature = temperature, CountryCode = countryCode, }; if (!string.IsNullOrEmpty(timezoneOffset)) { info.TimeZoneOffset = settingsService.ParseTimeZoneOffset(timezoneOffset); } settingsService.UpdateUserSettings(info); } responseObj = new GenericResponse() { Status = 0, ResponseTime = DateTime.Now.TimeOfDay.Seconds - timeStart, Message = "Settings successfully updated for user: " + name, Data = null, }; return(Json(responseObj, JsonRequestBehavior.AllowGet)); } catch (Exception e) { responseObj = new GenericResponse() { Status = 1, ResponseTime = DateTime.Now.TimeOfDay.Milliseconds - timeStart, Message = e.Message, Data = null, }; ResponseLogging(responseObj); return(Json(responseObj, JsonRequestBehavior.AllowGet)); } }