public static string _fx_GetCongestionFactorByLinkIds(BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorByLinkIds congestionFactorByLinkIds, LoggingFramework.ILog iLog, string Usertag) { string Result = string.Empty; try { using (SqlConnection sqlConnection = DataAccess.Admin.DataAccessManager._fx_GetSqlConnection(iLog, string.Empty)) { SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("_spt_GetCongestionFactorByLinkIds", sqlConnection); sqlDataAdapter.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@_param_LinkIds", congestionFactorByLinkIds.LinkIds); sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@_param_TimePattern", congestionFactorByLinkIds.TimePattern); sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@_param_Direction", congestionFactorByLinkIds.Direction); using (DataTable dataTable = new DataTable()) { sqlDataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { Result = Newtonsoft.Json.JsonConvert.SerializeObject(dataTable); } } } } catch (Exception exception) { Result = exception.ToString(); iLog.WriteError(exception.ToString()); } finally { } return(Result); }
public static string _fx_GetCongestionFactorByLinkIds(BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorByLinkIds congestionFactorByLinkIds, LoggingFramework.ILog iLog, string Usertag) { string Result = string.Empty; try { Result = DataAccess.Operations.HERE_TrafficAnalytics._fx_GetCongestionFactorByLinkIds(congestionFactorByLinkIds, iLog, Usertag); } catch (Exception exception) { iLog.WriteError(exception.ToString()); } finally { } return(Result); }
public BusinessEntities.Entities.Common.GenericResponse InBoundRequest(RequestParams requestParams) { BusinessEntities.Entities.Common.GenericResponse genericResponse = null; try { if (requestParams != null && !string.IsNullOrEmpty(requestParams.Method)) { if (ValidateRequestUser(requestParams.User, requestParams.Token, string.Empty)) { //JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); switch (requestParams.Method.ToUpper()) { case "GETTOSPEEDDATABYLINKID": BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.ToSpeedDataByLinkIds toSpeedDataByLinkIds = Newtonsoft.Json.JsonConvert.DeserializeObject <BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.ToSpeedDataByLinkIds>(requestParams.Data.ToString()); genericResponse = this.GetToSpeedDataByLinkId(toSpeedDataByLinkIds); break; case "GETCONGESTIONFACTORBYLINKIDS": BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorByLinkIds congestionFactorByLinkIds = Newtonsoft.Json.JsonConvert.DeserializeObject <BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorByLinkIds>(requestParams.Data.ToString()); genericResponse = this.GetCongestionFactorByLinkIds(congestionFactorByLinkIds); break; case "GETCONGESTIONFACTORSBYLINKIDS": BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorsByLinkIds congestionFactorsByLinkIds = Newtonsoft.Json.JsonConvert.DeserializeObject <BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorsByLinkIds>(requestParams.Data.ToString()); genericResponse = this.GetCongestionFactorsByLinkIds(congestionFactorsByLinkIds); break; default: genericResponse = new BusinessEntities.Entities.Common.GenericResponse() { ResponseCode = ((int)HttpStatusCode.NotImplemented).ToString(), ResponseMessage = ("Method is not implemented"), ResponseData = string.Empty }; break; } } else { genericResponse = new BusinessEntities.Entities.Common.GenericResponse() { ResponseCode = ((int)HttpStatusCode.Unauthorized).ToString(), ResponseMessage = ("Unauthorized access"), ResponseData = string.Empty }; } } } catch (Exception exception) { ///log message /// Startup._iLog.WriteError(string.Format("Exception: {0}", exception.ToString())); genericResponse = new BusinessEntities.Entities.Common.GenericResponse() { ResponseCode = ((int)HttpStatusCode.InternalServerError).ToString(), ResponseMessage = (exception.ToString()), ResponseData = string.Empty }; } finally { } return(genericResponse); }
private BusinessEntities.Entities.Common.GenericResponse GetCongestionFactorByLinkIds(BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorByLinkIds congestionFactorByLinkIds) { ///log message /// Startup._iLog.WriteDebug("============================================= GetCongestionFactorByLinkIds ============================================="); //Startup._iLog.WriteDebug(string.Format("To Speed Data LinkIds: {0}", string.Join(",", toSpeedDataByLinkIds.LinkIds.ToArray()))); //Startup._iLog.WriteDebug(string.Format("Congestion Factor Params : {0}", Newtonsoft.Json.JsonConvert.SerializeObject(congestionFactorByLinkIds))); BusinessEntities.Entities.Common.GenericResponse genericResponse = null; try { if ( congestionFactorByLinkIds == null || string.IsNullOrEmpty(congestionFactorByLinkIds.LinkIds) || string.IsNullOrEmpty(congestionFactorByLinkIds.TimePattern) || string.IsNullOrEmpty(congestionFactorByLinkIds.Direction) ) { genericResponse = new BusinessEntities.Entities.Common.GenericResponse() { ResponseCode = ((int)HttpStatusCode.OK).ToString(), ResponseMessage = ("all request parameters are required."), ResponseData = string.Empty }; } else { genericResponse = new BusinessEntities.Entities.Common.GenericResponse() { ResponseCode = ((int)HttpStatusCode.OK).ToString(), ResponseMessage = ("WaliedCheetos : Hollla"), ResponseData = BusinessLogic.Operations.HERE_TrafficAnalytics._fx_GetCongestionFactorByLinkIds(congestionFactorByLinkIds, Startup._iLog, string.Empty) }; } } catch (Exception exception) { ///log message /// Startup._iLog.WriteError(string.Format("Exception: {0}", exception.ToString())); genericResponse = new BusinessEntities.Entities.Common.GenericResponse() { ResponseCode = ((int)HttpStatusCode.InternalServerError).ToString(), ResponseMessage = (exception.ToString()), ResponseData = string.Empty }; } finally { } return(genericResponse); }