public ServiceResponse CreateBulkStations() { result = new ServiceResponse(); try { Guid systemSession = DevelopmentManagerFactory.GetSystemSession(); IDevelopmentManager developmentManager = DevelopmentManagerFactory.GetDevelopmentManager(systemSession); result.StatusCode = (int)HttpStatusCode.OK; result.Response = developmentManager.CommonManager.SaveStations(); } catch { result.StatusCode = (int)HttpStatusCode.MethodNotAllowed; result.Response = 0; } return result; }
public ServiceResponse CreateNewReading(Reading model) { result = new ServiceResponse(); try { if (ModelState.IsValid) { if (HttpRequestMessageExtensions.GetCookie(Request, "Wnreg") == model.Captcha) // validate the CAPTCHA { WindSpeedDao speedDao = new WindSpeedDao { City = model.City, State = model.State, StationCode = model.StationCode, ActualSpeed = model.ActualSpeed, PredictedSpeed = model.PredictedSpeed, Date = model.ReadingDate, Variance = model.Variance }; Guid systemSession = DevelopmentManagerFactory.GetSystemSession(); IDevelopmentManager developmentManager = DevelopmentManagerFactory.GetDevelopmentManager(systemSession); result.StatusCode = (int)HttpStatusCode.OK; result.Response = developmentManager.CommonManager.CreateNewReading(speedDao); } else { result.StatusCode = (int)HttpStatusCode.Forbidden; result.Response = 0; } } else { result.StatusCode = (int)HttpStatusCode.BadRequest; result.Response = 0; } } catch { result.StatusCode = (int)HttpStatusCode.MethodNotAllowed; result.Response = 0; } return result; }
public ServiceResponse GeneratingCaptchaCookie(CaptchaModel jobj) { result = new ServiceResponse(); try { if (ModelState.IsValid) { result.StatusCode = (int)HttpStatusCode.OK; GenerateCaptchaCookie(jobj.Location); result.Response = true; } } catch { result.StatusCode = (int)HttpStatusCode.MethodNotAllowed; result.Response = 0; } return result; }
public ServiceResponse GetPredictedSpeed([FromBody]JObject jobj) { result = new ServiceResponse(); try { Guid systemSession = DevelopmentManagerFactory.GetSystemSession(); IDevelopmentManager developmentManager = DevelopmentManagerFactory.GetDevelopmentManager(systemSession); result.StatusCode = (int)HttpStatusCode.OK; result.Response = developmentManager.CommonManager.GetPredictedSpeed((string)jobj["StationId"]); } catch { result.StatusCode = (int)HttpStatusCode.MethodNotAllowed; result.Response = 0; } return result; }
public ServiceResponse GetHistoricalData(int days) { result = new ServiceResponse(); try { Guid systemSession = DevelopmentManagerFactory.GetSystemSession(); IDevelopmentManager developmentManager = DevelopmentManagerFactory.GetDevelopmentManager(systemSession); result.StatusCode = (int)HttpStatusCode.OK; result.Response = developmentManager.CommonManager.GetHistoricalData(days); } catch { result.StatusCode = (int)HttpStatusCode.MethodNotAllowed; result.Response = 0; } return result; }
public ServiceResponse GetCurrentTime(int id) { result = new ServiceResponse(); try { result.StatusCode = (int)HttpStatusCode.OK; result.Response = DateTime.Now; } catch { result.StatusCode = (int)HttpStatusCode.MethodNotAllowed; result.Response = 0; } return result; }