Example #1
0
        public static async Task <Framework.Models.DataAccessLayerMessageOfBoolean> GetExistsMessageAsync <T>(IQueryable <T> _Query, int currentIndex, int pageSize, string logMessage)
        {
            //log.Info(string.Format("{0}: {1}", Framework.Models.LoggingOptions.Data_Access_Layer_Process_Started.ToString(), logMessage));
            Framework.Models.DataAccessLayerMessageOfBoolean _retMessage = new Framework.Models.DataAccessLayerMessageOfBoolean();
            try
            {
                bool _retval = await IQueryableHelper.AnyAsync(
                    _Query
                    , currentIndex
                    , pageSize
                    );

                _retMessage.DataAccessLayerMessageStatus = Framework.Models.DataAccessLayerMessageStatus.Success;
                _retMessage.Result = _retval;
            }
            catch (Exception ex)
            {
                _retMessage.DataAccessLayerMessageStatus = Framework.Models.DataAccessLayerMessageStatus.Fail;
                _retMessage.Result  = false;
                _retMessage.Message = ex.Message;
                //log.Error(string.Format("{0}: {1}", Framework.Models.LoggingOptions.Data_Access_Layer_Process_Failed.ToString(), logMessage), ex);
            }
            //log.Info(string.Format("{0}: {1}", Framework.Models.LoggingOptions.Data_Access_Layer_Process_Ended.ToString(), logMessage));
            return(_retMessage);
        }
Example #2
0
        /// <summary>
        /// Exists the of entity of EntityByIdentifier .
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns> Framework.Services.BusinessLogicLayerResponseMessageBoolean</returns>
        public async Task <Framework.Services.BusinessLogicLayerResponseMessageBoolean> ExistsOfEntityByIdentifier(
            Elmah.CommonBLLEntities.ElmahSourceRequestMessageUserDefinedOfIdentifier request)
        {
            //log.Info(string.Format("{0}: ExistsOfEntityByIdentifier", Framework.Models.LoggingOptions.Business_Logic_Layer_Process_Started.ToString()));
            if (!request.Criteria.CanQueryWhenNoQuery && !request.Criteria.HasQuery)
            {
                var failedResponse = new Framework.Services.BusinessLogicLayerResponseMessageBoolean();
                failedResponse.BusinessLogicLayerResponseStatus = Framework.Services.BusinessLogicLayerResponseStatus.NeedAtLeastOneSearchCondition;
                failedResponse.ServerErrorMessage = "Please enter at least one search condition";
                return(failedResponse);
            }
            Framework.Models.DataAccessLayerMessageOfBoolean _resultFromDAL = await this.DALClassInstance.ExistsOfEntityByIdentifier(
                request.Criteria.Identifier.Source
                , request.QueryPagingSetting.CurrentIndex
                , request.QueryPagingSetting.PageSize
                , request.QueryOrderBySettingCollection);

            Framework.Services.BusinessLogicLayerResponseMessageBoolean _retval = new Framework.Services.BusinessLogicLayerResponseMessageBoolean();

            _retval.BusinessLogicLayerRequestID = request.BusinessLogicLayerRequestID;
            Framework.Services.BusinessLogicLayerResponseMessageBaseHelper.MapDataAccessLayerMessageToBusinessLogicLayerResponseMessage <bool>(_resultFromDAL, _retval);
            //log.Info(string.Format("{0}: ExistsOfEntityByIdentifier", Framework.Models.LoggingOptions.Business_Logic_Layer_Process_Ended.ToString()));
            return(_retval);
        }