/// <summary> /// Maps the data access layer message to business logic layer response message. /// </summary> /// <typeparam name="T">any type</typeparam> /// <typeparam name="TList">The type of the list.</typeparam> /// <param name="from">From.</param> /// <param name="to">To.</param> public static void MapDataAccessLayerMessageToBusinessLogicLayerResponseMessage <T, TList>( Framework.DataSourceEntities.DataAccessLayerMessageBase <T> from, BusinessLogicLayerResponseMessageBase <TList> to , Framework.DataServiceTypes dataServiceType , Framework.IDataStreamServiceProviderBase <TList, T> dataStreamServiceProvider) where TList : List <T>, new() where T : class, new() { if (from.DataAccessLayerMessageStatus == Framework.DataSourceEntities.DataAccessLayerMessageStatus.Success) { to.BusinessLogicLayerResponseStatus = BusinessLogicLayerResponseStatus.MessageOK; if (from.QueryPagingResult != null) { to.QueryPagingResult = from.QueryPagingResult.Clone(); } TList fromList = new TList(); fromList.Add(from.Result); to.DataStreamServiceResult = dataStreamServiceProvider.BuildResult(fromList, dataServiceType); } else if (from.DataAccessLayerMessageStatus == Framework.DataSourceEntities.DataAccessLayerMessageStatus.SuccessButNoResult) { to.BusinessLogicLayerResponseStatus = BusinessLogicLayerResponseStatus.NoValueFromDataSource; TList fromList = new TList(); fromList.Add(from.Result); to.DataStreamServiceResult = dataStreamServiceProvider.BuildResult(fromList, dataServiceType); } else { to.BusinessLogicLayerResponseStatus = BusinessLogicLayerResponseStatus.MessageErrorDetected; to.ServerErrorMessage = from.Message; } }
/// <summary> /// Maps the data access layer message to business logic layer response message. /// </summary> /// <typeparam name="T">any type</typeparam> /// <typeparam name="TList">The type of the list.</typeparam> /// <param name="from">From.</param> /// <param name="to">To.</param> public static void MapDataAccessLayerMessageToBusinessLogicLayerResponseMessage <T, TList>( Framework.DataSourceEntities.DataAccessLayerMessageBase <T> from, BusinessLogicLayerResponseMessageBase <TList> to) where TList : IList <T>, new() where T : class, new() { if (from.DataAccessLayerMessageStatus == Framework.DataSourceEntities.DataAccessLayerMessageStatus.Success) { to.BusinessLogicLayerResponseStatus = BusinessLogicLayerResponseStatus.MessageOK; to.Message = new TList(); to.Message.Add(from.Result); } else if (from.DataAccessLayerMessageStatus == Framework.DataSourceEntities.DataAccessLayerMessageStatus.SuccessButNoResult) { to.BusinessLogicLayerResponseStatus = BusinessLogicLayerResponseStatus.NoValueFromDataSource; } else { to.BusinessLogicLayerResponseStatus = BusinessLogicLayerResponseStatus.MessageErrorDetected; to.ServerErrorMessage = from.Message; } }
/// <summary> /// Maps the data access layer message to business logic layer response message. /// </summary> /// <typeparam name="T">any type</typeparam> /// <param name="from">From.</param> /// <param name="to">To.</param> public static void MapDataAccessLayerMessageToBusinessLogicLayerResponseMessage <T>( Framework.DataSourceEntities.DataAccessLayerMessageBase <T> from, BusinessLogicLayerResponseMessageBase <T> to) { if (from.DataAccessLayerMessageStatus == Framework.DataSourceEntities.DataAccessLayerMessageStatus.Success) { to.BusinessLogicLayerResponseStatus = BusinessLogicLayerResponseStatus.MessageOK; to.Message = from.Result; if (from.QueryPagingResult != null) { to.QueryPagingResult = from.QueryPagingResult.Clone(); } } else if (from.DataAccessLayerMessageStatus == Framework.DataSourceEntities.DataAccessLayerMessageStatus.SuccessButNoResult) { to.BusinessLogicLayerResponseStatus = BusinessLogicLayerResponseStatus.NoValueFromDataSource; } else { to.BusinessLogicLayerResponseStatus = BusinessLogicLayerResponseStatus.MessageErrorDetected; to.ServerErrorMessage = from.Message; } }