public static string _fx_GetCongestionFactorsByLinkIds(BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorsByLinkIds congestionFactorsByLinkIds, 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_GetCongestionFactorsByLinkIds", sqlConnection);
                    sqlDataAdapter.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;

                    sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@_param_LinkIds", congestionFactorsByLinkIds.LinkIds);
                    sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@_param_TimePattern", congestionFactorsByLinkIds.TimePattern);

                    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_GetCongestionFactorsByLinkIds(BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorsByLinkIds congestionFactorsByLinkIds, LoggingFramework.ILog iLog, string Usertag)
        {
            string Result = string.Empty;

            try
            {
                Result = DataAccess.Operations.HERE_TrafficAnalytics._fx_GetCongestionFactorsByLinkIds(congestionFactorsByLinkIds, iLog, Usertag);
            }
            catch (Exception exception)
            {
                iLog.WriteError(exception.ToString());
            }
            finally
            { }
            return(Result);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        private BusinessEntities.Entities.Common.GenericResponse GetCongestionFactorsByLinkIds(BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.CongestionFactorsByLinkIds congestionFactorsByLinkIds)
        {
            ///log message
            ///
            Startup._iLog.WriteDebug("============================================= GetCongestionFactorsByLinkIds =============================================");
            //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(congestionFactorsByLinkIds)));

            BusinessEntities.Entities.Common.GenericResponse genericResponse = null;
            try
            {
                if (
                    congestionFactorsByLinkIds == null
                    ||
                    string.IsNullOrEmpty(congestionFactorsByLinkIds.LinkIds)
                    ||
                    string.IsNullOrEmpty(congestionFactorsByLinkIds.TimePattern)
                    )
                {
                    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_GetCongestionFactorsByLinkIds(congestionFactorsByLinkIds, 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);
        }