Ejemplo n.º 1
0
        public async Task <IActionResult> Get(int versionID, string startDate, string endDate)
        {
            try
            {
                var response = await _epsPetroAuditApi.GetEPSPetroAuditByVersion(versionID, startDate, endDate);

                if (response.IsSuccess)
                {
                    return(Ok(response.Result));
                }
                else
                {
                    var msg = this._localizer?[response.ErrorMessages?.FirstOrDefault()?.ToString()]?.Value;
                    await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, msg, "EPSPetroAuditController.cs", "Get"), CancellationToken.None);

                    return(this.StatusCode((int)System.Net.HttpStatusCode.BadRequest, msg));
                }
            }
            catch (Exception ex)
            {
                var msg = this._localizer?[EPSPetroAuditErrorCodes.GenericError.ToString()]?.Value;
                await _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in GetEPSPetroAuditByVersion()", CancellationToken.None);

                return(this.StatusCode((int)System.Net.HttpStatusCode.InternalServerError, msg));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="TerminalID"></param>
        /// <returns></returns>
        public async Task <ApiResult <GenericPaginationResponse <Terminal> > > GetTerminalListAsync(int merchantID, PaginationTerminal Page)
        {
            await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Terminal List GetTerminalListAsync for MerchantID - " + merchantID,
                                                       "TerminalListApi.cs", "GetTerminalListAsync"), CancellationToken.None);

            ApiResult <GenericPaginationResponse <Terminal> > response = new ApiResult <GenericPaginationResponse <Terminal> >();
            var errorkey = GlobalErrorCode.Succeeded;

            try
            {
                response.Result = await _terminalRepository.GetTerminalListAsync(merchantID, Page);

                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "fteched Terminal List resultset from DB for MerchantID - " + merchantID,
                                                           "TerminalListApi.cs", "GetTerminalListAsync"), CancellationToken.None);

                return(response);
            }
            catch (Exception ex)
            {
                errorkey = GlobalErrorCode.InternalServerError;
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, "Error Occured  for MerchantID - " + merchantID + " " + errorkey.ToString() + ex.Message, "TerminalListApi.cs",
                                                           "GetTerminalListAsync"), CancellationToken.None);

                response.AddErrorMessage(errorkey.ToString());
                return(response);
            }
        }
Ejemplo n.º 3
0
        public async Task <ICollection <Terminal> > GetTerminalListAsync(int merchantId)
        {
            try
            {
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Terminal List GetTerminalListAsync for MerchantID " + merchantId,
                                                           "TerminalListRepository.cs", "GetTerminalListAsync"), CancellationToken.None);

                return(await this._connectionFactory.GetConnection(async c =>
                {
                    var p = new DynamicParameters();
                    p.Add("MerchantID", merchantId, DbType.Int32);

                    await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Dapper Connection parameterized Query for Terminal List Repository  for MerchantID " + merchantId,
                                                               "TerminalListRepository.cs", "GetTerminalListAsync"), CancellationToken.None);

                    var terminalList = await c.QueryAsync <Terminal>(sql: "[CISPlus].[uspCISPlusGetTerminalListByMerchant]", param: p, commandType: CommandType.StoredProcedure);

                    await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Successful DB call for Terminal List Repository Query result for MerchantID " + merchantId,
                                                               "TerminalListRepository.cs", "GetTerminalListAsync"), CancellationToken.None);

                    return terminalList.ToList();
                }));
            }
            catch (Exception ex)
            {
                var msg = String.Format("{0}.GetTerminalListAsync() experienced an exception (not a timeout) for MerchantID " + merchantId, GetType().FullName);
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, msg + ex.ToString() + ex.Message, "TerminalListRepository.cs",
                                                           "GetTerminalListAsync"), CancellationToken.None);

                throw new Exception(String.Format("{0}.GetTerminalListAsync() experienced an exception (not a timeout)", GetType().FullName), ex);
            }
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> GetParameters(int?parameterId = null)
        {
            await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting GetParameters " + parameterId ?? "", "ParametersController.cs", "GetParameters"), CancellationToken.None);

            if (!ModelState.IsValid)
            {
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, ModelState.ToString(), "ParametersController.cs", "GetParameters"), CancellationToken.None);

                return(BadRequest(ModelState));
            }

            try
            {
                string key  = "parameters_" + Convert.ToString(parameterId);
                var    data = _operation.RetrieveCache(key, new List <Model.Parameters>());
                if (data == null)
                {
                    //since no data in cache, now get data from DB
                    var result = await _parametersApi.GetParameters(parameterId);

                    if (result.IsSuccess)
                    {
                        data = (List <Model.Parameters>)result.Result;
                        await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "ParametersController GetParameters Successful", "GetParametersController.cs", "GetParameters"), CancellationToken.None);

                        //Now add data to cache..
                        await _operation.AddCacheAsync(key, data);
                    }
                    else
                    {
                        var msg = this._localizer?["GenericError"]?.Value;
                        await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, msg, "ParametersController.cs", "Get"), CancellationToken.None);

                        return(this.StatusCode((int)System.Net.HttpStatusCode.InternalServerError, msg));
                    }
                }
                if (data == null)
                {
                    var msg = this._localizer["NoDataFound"]?.Value;
                    return(this.StatusCode((int)System.Net.HttpStatusCode.OK, msg));
                }
                return(Ok(data));
            }
            catch (Exception ex)
            {
                //return BadRequest(ex);
                var msg = this._localizer?["GenericError"]?.Value;
                await _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in ParametersController GetParameters( " + parameterId ?? "" + ")", CancellationToken.None);

                return(this.StatusCode((int)System.Net.HttpStatusCode.InternalServerError, msg));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        public ValuesController(IOptions <Settings> optionsAccessor, ILoggingFacade loggingFacade)
        {
            _loggingFacade = loggingFacade;
            _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting ValuesController", "ValuesController.cs", "ValuesController"), CancellationToken.None);

            this._optionsAccessor = optionsAccessor;
        }
Ejemplo n.º 6
0
 public MerchantListApi(IOptions <Settings> optionsAccessor, IMerchantListRepository merchantRepository,
                        ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Merchant List API Service",
                                          "MerchantListApi.cs", "MerchantListApi"), CancellationToken.None);
     _merchantRepository = merchantRepository;
 }
Ejemplo n.º 7
0
        public async Task <IActionResult> GetRecentStatement(string merchantNbr)
        {
            await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting GetRecentStatement " + merchantNbr, "RecentStatementController.cs", "GetRecentStatement"), CancellationToken.None);

            if (!ModelState.IsValid)
            {
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, ModelState.ToString(), "RecentStatementController.cs", "GetRecentStatement"), CancellationToken.None);

                return(BadRequest(ModelState));
            }
            try
            {
                string key  = "recentStatement_" + merchantNbr;
                var    data = _operation.RetrieveCache(key, new List <Model.RecentStatement>());
                if (data == null)
                {
                    //since no data in cache, now get data from DB
                    var result = await _recentStatementApi.GetRecentStatementAsync(merchantNbr);

                    if (result.Result != null && result.Result.Count > 0)
                    {
                        await _operation.AddCacheAsync(key, result.Result);

                        return(Ok(result.Result));
                    }
                    else
                    {
                        var msg = this._localizer["NoDataFound"]?.Value;
                        await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, msg + "GetRecentStatement Unsuccessful", "RecentStatementController.cs", "GetRecentStatement"), CancellationToken.None);

                        return(this.StatusCode((int)System.Net.HttpStatusCode.OK, msg));
                    }
                }
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "GetRecentStatement Successful", "RecentStatementController.cs", "GetRecentStatement"), CancellationToken.None);

                return(Ok(data));
            }
            catch (Exception ex)
            {
                var msg = this._localizer?["GenericError"]?.Value;
                await _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in GetRecentStatement()", CancellationToken.None);

                return(this.StatusCode((int)System.Net.HttpStatusCode.InternalServerError, msg));
            }
        }
Ejemplo n.º 8
0
        // private MyOptions  _settings;

        /// <summary>
        ///
        /// </summary>

        /// <param name="cache"></param>
        /// <param name="mprofileApi"></param>
        /// <param name="loggingFacade"></param>
        public MerchantProfileController(IDistributedCache cache, IMerchantProfileApi mprofileApi, ILoggingFacade loggingFacade)
        {
            //settings = settings.Value;
            _loggingFacade = loggingFacade;
            _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting MerchantProfileController", "MerchantProfileController.cs", "MerchantProfileController"), CancellationToken.None);

            _cache       = cache;
            _mprofileApi = mprofileApi;
        }
Ejemplo n.º 9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="epsmappingApi"></param>
 /// <param name="localizer"></param>
 /// <param name="operation"></param>
 /// <param name="loggingFacade"></param>
 public EPSMappingController(IDistributedCache cache, IEPSMappingApi epsmappingApi, IStringLocalizer <EPSMappingController> localizer, IOperation operation, ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting EPSMapping Controller", "EPSMappingController.cs", "EPSMappingController"), CancellationToken.None);
     this._cache         = cache;
     this._epsmappingApi = epsmappingApi;
     this._localizer     = localizer;
     this._operation     = operation;
 }
Ejemplo n.º 10
0
 public TransactionHistoryApi(IOptions <Settings> optionsAccessor,
                              ITransactionHistoryRepository transactionHistoryRepository,
                              ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Transaction History API Service",
                                          "TransactionHistoryApi.cs", "TransactionHistoryApi"), CancellationToken.None);
     _transactionHistoryRepository = transactionHistoryRepository;
 }
Ejemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="optionsAccessor"></param>
 /// <param name="terminalRepository"></param>
 public TerminalListApi(IOptions <Settings> optionsAccessor,
                        ITerminalListRepository terminalRepository,
                        ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Terminal List Controller",
                                          "TerminalListApi.cs", "TerminalListApi"), CancellationToken.None);
     _terminalRepository = terminalRepository;
 }
Ejemplo n.º 12
0
 public ContactListApi(IOptions <Settings> optionsAccessor,
                       IContactListRepository contactRepository,
                       ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Contact List API Service",
                                          "ContactListApi.cs", "ContactListApi"), CancellationToken.None);
     _contactRepository = contactRepository;
 }
Ejemplo n.º 13
0
        public async Task <IActionResult> Get(int LIDType, int LID)
        {
            await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting GetActiveServices " + LIDType + ", " + LID, "ActiveServicesController.cs", "GetActiveServices"), CancellationToken.None);

            if (!ModelState.IsValid)
            {
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, ModelState.ToString(), "ActiveServicesController.cs", "GetActiveServices"), CancellationToken.None);

                return(BadRequest(ModelState));
            }

            try
            {
                string key  = "activeservices_" + LID.ToString();
                var    data = _operation.RetrieveCache(key, new List <ActiveServices>());
                if (data == null)
                {
                    //since no data in cache, now get data from DB
                    var result = await _activeServicesApi.GetActiveServices(LIDType, LID);

                    data = (List <ActiveServices>)result.Result;
                    //Now add data to cache..
                    await _operation.AddCacheAsync(key, data);
                }
                if (data == null)
                {
                    var msg = this._localizer["NoDataFound"]?.Value;
                    await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, msg, "ActiveServicesController.cs", "GetActiveServices"), CancellationToken.None);

                    return(this.StatusCode((int)System.Net.HttpStatusCode.OK, msg));
                }
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "GetActiveServices Successful", "ActiveServicesController.cs", "GetActiveServices"), CancellationToken.None);

                return(Ok(data));
            }

            catch (Exception ex)
            {
                var msg = this._localizer?["GenericError"]?.Value;
                await _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in GetActiveServices()", CancellationToken.None);

                return(this.StatusCode((int)System.Net.HttpStatusCode.InternalServerError, msg));
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="bankingApi"></param>
 /// <param name="localizer"></param>
 /// <param name="operation"></param>
 /// <param name="loggingFacade"></param>
 public BankingController(IDistributedCache cache, IBankingApi bankingApi, IStringLocalizer <BankingController> localizer
                          , IOperation operation, ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Banking Controller", "BankingController.cs", "BankingController"), CancellationToken.None);
     _bankingApi = bankingApi;
     _cache      = cache;
     _localizer  = localizer;
     _operation  = operation;
 }
Ejemplo n.º 15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="optionsAccessor"></param>
 /// <param name="connectionFactory"></param>
 public TransactionHistoryRepository(IOptions <DataContext> optionsAccessor,
                                     IDatabaseConnectionFactory connectionFactory,
                                     ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Transaction History Repository",
                                          "TransactionHistoryApi.cs", "TransactionHistoryApi"), CancellationToken.None);
     this._connectionFactory = new BaseRepository(optionsAccessor.Value.TranHistoryConnectionString, optionsAccessor.Value.CommandTimeout);
     maxRecordCount          = optionsAccessor.Value.MaxNumberOfRecordsToReturn;
 }
Ejemplo n.º 16
0
        public async Task <IActionResult> GetBaseVersions()
        {
            try
            {
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Web Api call for GetBaseVersions", "CommanderVersionController.cs", "GetBaseVersions"),
                                              CancellationToken.None);

                var response = await _commanderVersionApi.GetBaseVersions();

                return(Ok(response.Result));
            }
            catch (Exception ex)
            {
                var msg = this._localizer?["CommanderGetBaseVersionsErrorMsg"]?.Value;
                await _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in GetBaseVersions()", CancellationToken.None);

                return(this.StatusCode((int)System.Net.HttpStatusCode.InternalServerError, msg));
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="dashboardInfo"></param>
 /// <param name="localizer"></param>
 /// <param name="operation"></param>
 /// <param name="loggingFacade"></param>
 public DashboardInfoController(IDistributedCache cache, IDashboardInfoApi dashboardInfo, IStringLocalizer <DashboardInfoController> localizer
                                , IOperation operation, ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Dashboard Info Controller", "DashboardInfoController.cs", "DashboardInfoController"), CancellationToken.None);
     _dashboardInfo = dashboardInfo;
     _cache         = cache;
     _localizer     = localizer;
     _operation     = operation;
 }
Ejemplo n.º 18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="terminalDetailsApi"></param>
 /// <param name="localizer"></param>
 /// <param name="operation"></param>
 /// <param name="loggingFacade"></param>
 public TerminalDetailsController(IDistributedCache cache, ITerminalDetailsApi terminalDetailsApi, IStringLocalizer <TerminalDetailsController> localizer
                                  , IOperation operation, ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Terminal Details Controller", "TerminalDetailsController.cs", "TerminalDetailsController"), CancellationToken.None);
     _terminalDetailsApi = terminalDetailsApi;
     _cache     = cache;
     _localizer = localizer;
     _operation = operation;
 }
Ejemplo n.º 19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="commanderVersionApi"></param>
 /// <param name="localizer"></param>
 /// <param name="operation"></param>
 /// <param name="loggingFacade"></param>
 public CommanderVersionController(IDistributedCache cache, ICommanderVersionApi commanderVersionApi, IStringLocalizer <CommanderVersionController> localizer
                                   , IOperation operation, ILoggingFacade loggingFacade)
 {
     _cache = cache;
     _commanderVersionApi = commanderVersionApi;
     _localizer           = localizer;
     _operation           = operation;
     _loggingFacade       = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting CommanderVersionController",
                                          "CommanderVersionController.cs", "CommanderVersionController"), CancellationToken.None);
 }
Ejemplo n.º 20
0
        public async Task <ApiResult <GenericPaginationResponse <TransactionHistory> > > GetTransactionHistoryAsync(string terminalID, PaginationTransactionHistory Page)
        {
            await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Transaction History API Service for TerminalID - " + terminalID,
                                                       "TransactionHistoryApi.cs", "TransactionHistoryApi"), CancellationToken.None);

            ApiResult <GenericPaginationResponse <TransactionHistory> > response = new ApiResult <GenericPaginationResponse <TransactionHistory> >();

            try
            {
                response.Result = await _transactionHistoryRepository.GetTransactionHistoryAsync(terminalID, Page);

                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Fetched the Transaction History resultset from DB for TerminalID - " + terminalID,
                                                           "TransactionHistoryApi.cs", "GetTransactionHistoryAsync"), CancellationToken.None);
            }
            catch (Exception)
            {
                throw;
            }
            return(response);
        }
Ejemplo n.º 21
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="localizer"></param>
 /// <param name="loggingFacade"></param>
 /// <param name="xmlApi"></param>
 public XmlController(IDistributedCache cache,
                      IStringLocalizer <XmlController> localizer,
                      ILoggingFacade loggingFacade,
                      IXmlApi xmlApi)
 {
     _xmlApi        = xmlApi;
     _cache         = cache;
     _localizer     = localizer;
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Xml Controller", "XmlController.cs", "XmlController"), CancellationToken.None);
 }
Ejemplo n.º 22
0
        /// <summary>
        /// CustomerId is input to retrieve the List of Merchant.
        /// </summary>
        /// <param name="CustId"></param>
        /// <returns></returns>

        public async Task <ApiResult <GenericPaginationResponse <Merchant> > > GetMerchantListAsync(int CustId, PaginationMerchant page)
        {
            await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Merchant List GetMerchantListAsync for CustomerID -" + CustId,
                                                       "MerchantListApi.cs", "GetMerchantListAsync"), CancellationToken.None);

            ApiResult <GenericPaginationResponse <Merchant> > response = new ApiResult <GenericPaginationResponse <Merchant> >();

            try
            {
                response.Result = await _merchantRepository.GetMerchantListAsync(CustId, page);

                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Fetched the  Merchant List resultset from DB for CustomerID -" + CustId,
                                                           "MerchantListApi.cs", "GetMerchantListAsync"), CancellationToken.None);
            }
            catch (Exception)
            {
                throw;
            }
            return(response);
        }
Ejemplo n.º 23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="activeServicesApi"></param>
 /// <param name="localizer"></param>
 /// <param name="operation"></param>
 /// <param name="loggingFacade"></param>
 public ActiveServicesController(IDistributedCache cache, IActiveServicesApi activeServicesApi
                                 , IStringLocalizer <ActiveServicesController> localizer
                                 , IOperation operation, ILoggingFacade loggingFacade)
 {
     _loggingFacade = loggingFacade;
     _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting ActiveServices Controller", "ActiveServicesController.cs", "ActiveServicesController"), CancellationToken.None);
     _cache             = cache;
     _activeServicesApi = activeServicesApi;
     _localizer         = localizer;
     _operation         = operation;
 }
Ejemplo n.º 24
0
        public async Task <ApiResult <GenericPaginationResponse <Demographics> > > GetContactListAsync(LidTypeEnum LIDType, string LID, PaginationDemographics page)
        {
            await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Contact List GetContactListAsync for " + LIDType.ToString() + ", Value - " + LID,
                                                       "ContactListApi.cs", "GetContactListAsync"), CancellationToken.None);

            ApiResult <GenericPaginationResponse <Demographics> > response = new ApiResult <GenericPaginationResponse <Demographics> >();

            try
            {
                response.Result = await _contactRepository.GetContactListAsync(LIDType, LID, page);

                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Fetched the Contact List resultset from DB for  " + LIDType.ToString() + ", Value - " + LID,
                                                           "ContactListApi.cs", "GetContactListAsync"), CancellationToken.None);
            }
            catch (Exception)
            {
                throw;
            }
            return(response);
        }
Ejemplo n.º 25
0
        public async Task <IActionResult> GetTableSchema([FromBody] string schemaDef)
        {
            try
            {
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting GetTableSchema ", "XmlController.cs", "GetTableSchema"), CancellationToken.None);

                TableProperty result = await Task.Run(() => _xmlApi.GetTableProperty(schemaDef));

                return(Ok(result));
            }
            catch (System.Exception ex)
            {
                await _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in XmlController GetTableSchema() ", CancellationToken.None);

                return(BadRequest(ex));
            }
        }
Ejemplo n.º 26
0
        public async Task <IActionResult> Get(string startDate, string endDate, int?LidType, string Lid)
        {
            await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting EPS Log Get " + startDate + ", " + endDate + "," + LidType + "," + Lid, "EPSLogController.cs", "Get"), CancellationToken.None);

            if (!ModelState.IsValid)
            {
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, ModelState.ToString(), "EPSLogController.cs", "Get"), CancellationToken.None);

                return(BadRequest(ModelState));
            }

            try
            {
                var result = await _epslogApi.GetEPSLogAsync(startDate, endDate, LidType, Lid);

                if (!result.IsSuccess)
                {
                    var msg = this._localizer?[result.ErrorMessages?.FirstOrDefault()?.ToString()]?.Value;
                    await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, msg + "GetEPSLog Unsuccessful", "EPSLogController.cs", "Get"), CancellationToken.None);

                    return(this.StatusCode((int)System.Net.HttpStatusCode.BadRequest, msg));
                }
                if (result.Result == null)
                {
                    var msg = this._localizer["NoDataFound"]?.Value;
                    await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, msg, "EPSLogController.cs", "Get"), CancellationToken.None);

                    return(this.StatusCode((int)System.Net.HttpStatusCode.OK, msg));
                }
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "GetEPSLog Successful", "EPSLogController.cs", "Get"), CancellationToken.None);

                return(Ok(result.Result));
            }
            catch (Exception ex)
            {
                var msg = this._localizer?[EPSLogErrorCodes.EPSLogError.ToString()]?.Value;
                await _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in EPSLogGet()", CancellationToken.None);

                return(this.StatusCode((int)System.Net.HttpStatusCode.InternalServerError, msg));
            }
        }
Ejemplo n.º 27
0
        public async Task <IActionResult> Get(int id)
        {
            await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting MerchantProfileController id: " + id, "MerchantProfileController.cs", "Get"), CancellationToken.None);

            if (!ModelState.IsValid)
            {
                await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, ModelState.ToString(), "MerchantProfileController.cs", "Get"), CancellationToken.None);

                return(BadRequest(ModelState));
            }
            try
            {
                //first check if the data is in cache..
                var data = new Operation(_cache).RetrieveCache(id.ToString(), new MerchantProfile());
                if (data == null)
                {
                    //since no data in cache, now get data from DB
                    data = await _mprofileApi.GetMerchantProfileGeneralInfoAsync(id);

                    if (data != null)
                    {
                        await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Get MerchantProfile Successful", "MerchantProfileController.cs", "Get"), CancellationToken.None);

                        //Now add data to cache..
                        await new Operation(_cache).AddCacheAsync(id.ToString(), data);
                    }
                }
                if (data == null)
                {
                    return(Ok(new string[] { "value1", "Not Found" }));
                }
                return(Ok(data));
            }
            catch (Exception ex)
            {
                await _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in MerchantProfileController Get(" + id + ")", CancellationToken.None);

                return(BadRequest(ex));
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// ParametersController
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="parametersApi"></param>
        /// <param name="localizer"></param>
        /// <param name="operation"></param>
        /// <param name="loggingFacade"></param>
        public ParametersController(IDistributedCache cache, IParametersApi parametersApi
                                    , IStringLocalizer <ParametersController> localizer
                                    , IOperation operation
                                    , ILoggingFacade loggingFacade)
        {
            _loggingFacade = loggingFacade;
            _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting ParametersController", "ParametersController.cs", "ParametersController"), CancellationToken.None);

            _cache         = cache;
            _parametersApi = parametersApi;
            _localizer     = localizer;
            _operation     = operation;
        }
Ejemplo n.º 29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="merchantListApi"></param>
        /// /// <param name="localizer"></param>
        /// <param name="operation"></param>
        /// <param name="loggingFacade"></param>

        public MerchantListController(IDistributedCache cache,
                                      IMerchantListApi merchantListApi,
                                      IStringLocalizer <MerchantListController> localizer,
                                      IOperation operation,
                                      ILoggingFacade loggingFacade)
        {
            _loggingFacade = loggingFacade;
            _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting Merchant List Controller",
                                                 "MerchantListController.cs", "MerchantListController"), CancellationToken.None);
            _cache           = cache;
            _merchantListApi = merchantListApi;
            _localizer       = localizer;
            _operation       = operation;
        }
Ejemplo n.º 30
0
        public IEnumerable <string> Get()
        {
            _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting get Value ", "ValueController.cs", "Get"), CancellationToken.None);
            if (!ModelState.IsValid)
            {
                _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, ModelState.ToString(), "ValuesController.cs", "Get"), CancellationToken.None);
                return(new string[] { System.Net.HttpStatusCode.InternalServerError.ToString() });
            }
            try {
                var result = new string[] { "Environment Name", this._optionsAccessor?.Value?.EnvironmentName };
                _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Get values Successful", "ValuesController.cs", "Get"), CancellationToken.None);

                return(result);
            }

            catch (Exception ex)
            {
                _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in ValuesController Get()", CancellationToken.None);

                string exceptionMsg = string.Format("Error,{0},{1}", ex.Message, ex.InnerException == null ? "" : ex.InnerException.Message);
                return(new string[] { exceptionMsg });
            }
        }