public static string _fx_GetToSpeedDataByLinkIds(BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.ToSpeedDataByLinkIds toSpeedDataByLinkIds, 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_GetToSpeedDataByLinkIds", sqlConnection);
                    sqlDataAdapter.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;

                    sqlDataAdapter.SelectCommand.Parameters.AddWithValue("@_param_LINKIDs", toSpeedDataByLinkIds.LinkIds);

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

            try
            {
                Result = DataAccess.Operations.HERE_TrafficAnalytics._fx_GetToSpeedDataByLinkIds(toSpeedDataByLinkIds, iLog, Usertag);
            }
            catch (Exception exception)
            {
                iLog.WriteError(exception.ToString());
            }
            finally
            { }
            return(Result);
        }
Beispiel #3
0
        private BusinessEntities.Entities.Common.GenericResponse GetToSpeedDataByLinkId(BusinessEntities.Entities.HERE_TrafficAnalyticsRequests.ToSpeedDataByLinkIds toSpeedDataByLinkIds)
        {
            ///log message
            ///
            Startup._iLog.WriteDebug("============================================= GetToSpeedDataByLinkId =============================================");
            //Startup._iLog.WriteDebug(string.Format("To Speed Data LinkIds: {0}", string.Join(",", toSpeedDataByLinkIds.LinkIds.ToArray())));
            Startup._iLog.WriteDebug(string.Format("To Speed Data LinkIds: {0}", toSpeedDataByLinkIds.LinkIds));

            BusinessEntities.Entities.Common.GenericResponse genericResponse = null;
            try
            {
                //if (toSpeedDataByLinkIds == null || toSpeedDataByLinkIds.LinkIds.Count == 0)
                if (toSpeedDataByLinkIds == null || string.IsNullOrEmpty(toSpeedDataByLinkIds.LinkIds))
                {
                    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_GetToSpeedDataByLinkIds(toSpeedDataByLinkIds, 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);
        }
Beispiel #4
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);
        }