/// <summary> /// Get the Demographics for a LID /// </summary> /// <param name="LidType"></param> /// <param name="Lid"></param> /// <returns></returns> public async Task <ICollection <Demographics> > GetDemographicsByLidType(Helper.LIDTypes LidType, string Lid) { return(await WithConnection(async d => { var p = new DynamicParameters(); p.Add("LIDType", LidType, DbType.Int32); p.Add("LID", Lid, DbType.String); var demographics = await d.QueryAsync <Demographics>(sql: "uspCISPlusGetDemographicsByLIdType", param: p, commandType: CommandType.StoredProcedure); return demographics.ToList(); })); }
public async Task <ApiResult <MemoList> > GetMemoResults(Helper.LIDTypes LIDtype, int LID) { ApiResult <MemoList> response = new ApiResult <MemoList>(); try { response.Result = await _memoRepository.GetMemoResults(LIDtype, LID); } catch (Exception) { throw; } return(response); }
public async Task <ICollection <BankingInformation> > GetBankingInfo(Helper.LIDTypes LidType, string Lid) { try { return(await this._connectionFactory.GetConnection(async c => { var p = new DynamicParameters(); p.Add("LIDType", LidType, DbType.Int32); p.Add("LID", Lid, DbType.String); var bankingInformation = await c.QueryAsync <BankingInformation>(sql: "CISPlus.uspCISPlusGetBankingInfo", param: p, commandType: CommandType.StoredProcedure); return bankingInformation.ToList(); })); } catch (Exception) { throw; } }
public async Task <IActionResult> GetBankingInfo(Helper.LIDTypes LIDType, string LID) { await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting GetBankingInfo " + LIDType + ", " + LID, "BankingController.cs", "GetBankingInfo"), CancellationToken.None); if (!ModelState.IsValid) { await _loggingFacade.LogAsync(new LogEntry(LogLevels.Error, ModelState.ToString(), "BankingController.cs", "GetBankingInfo"), CancellationToken.None); return(BadRequest(ModelState)); } try { string key = "bankingInfo_" + "_" + LIDType + "_" + LID.ToString(); var data = _operation.RetrieveCache(key, new List <Model.BankingInformation>()); if (data == null) { //since no data in cache, now get data from DB var result = await _bankingApi.GetBankingInfo(LIDType, LID); data = (List <BankingInformation>)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, "BankingController.cs", "GetBankingInfo"), CancellationToken.None); return(this.StatusCode((int)System.Net.HttpStatusCode.OK, msg)); } await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "GetBankingInfo Successful", "BankingController.cs", "GetBankingInfo"), 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 GetBankingInfo()", CancellationToken.None); return(this.StatusCode((int)System.Net.HttpStatusCode.InternalServerError, msg)); } }
public async Task <MemoList> GetMemoResults(Helper.LIDTypes LIDtype, int LID) { try { var memoList = new MemoList(); return(await this._connectionFactory.GetConnection(async c => { using (var multi = c.QueryMultiple("[CISPlus].[uspGetMemoInfoForSearchLynk] @LidType, @Lid", new { LidType = LIDtype, Lid = LID })) { memoList.customerMemo = multi.Read <Wp.CIS.LynkSystems.Model.MemoInfo>().ToList(); memoList.merchMemo = multi.Read <Wp.CIS.LynkSystems.Model.MemoInfo>().ToList(); memoList.termMemo = multi.Read <Wp.CIS.LynkSystems.Model.MemoInfo>().ToList(); memoList.groupMemo = multi.Read <Wp.CIS.LynkSystems.Model.MemoInfo>().ToList(); return memoList; } })); } catch (System.Exception) { throw; } }
/// <summary> /// /// </summary> /// <param name="LIDtype"></param> /// <param name="LID"></param> /// <returns></returns> async Task <ApiResult <DashboardInfo> > IDashboardInfoApi.GetDashboardSearchResults(Helper.LIDTypes LIDtype, int LID) { ApiResult <DashboardInfo> response = new ApiResult <DashboardInfo>(); try { response.Result = await _dashboardRepository.GetDashboardSearchResults(LIDtype, LID, this._optionsAccessor.Value.MaxNumberOfRecordsToReturn); } catch (System.Exception) { throw; } return(response); }
public async Task <Wp.CIS.LynkSystems.Model.DashboardInfo> GetDashboardSearchResults(Helper.LIDTypes LIDtype, int LID, int maxRecordCount) { try { string inputType = LIDtype.ToString(); string outputType = inputType.Replace("ID", "").Replace("Nbr", ""); Wp.CIS.LynkSystems.Model.DashboardInfo dbInfo = new Wp.CIS.LynkSystems.Model.DashboardInfo(); return(await this._connectionFactory.GetConnection(async c => { var p = new DynamicParameters(); p.Add("OutputType", outputType, DbType.String, ParameterDirection.Input); p.Add("LidType", LIDtype, DbType.Int32, ParameterDirection.Input); p.Add("Lid", LID, dbType: DbType.Int32, direction: ParameterDirection.Input); // p.Add("SelectTopMaxNumber", 500, dbType: DbType.Int32, direction: ParameterDirection.ReturnValue); p.Add("TotalCaseHistoryRecords", dbType: DbType.Int32, direction: ParameterDirection.Output); p.Add("TotalDemographicsRecords", dbType: DbType.Int32, direction: ParameterDirection.Output); p.Add("TotalMerchantRecords", dbType: DbType.Int32, direction: ParameterDirection.Output); using (var multi = c.QueryMultiple("CISPlus.uspCISPlusGetDashboardInfo", p, commandType: CommandType.StoredProcedure)) { switch (LIDtype) { case Helper.LIDTypes.TerminalNbr: case Helper.LIDTypes.TerminalID: dbInfo.TermInfo = multi.Read <TerminalInfo>().FirstOrDefault(); dbInfo.MerchInfo = multi.Read <MerchantInfo>().FirstOrDefault(); dbInfo.CustProfile = multi.Read <CustomerProfile>().FirstOrDefault(); break; case Helper.LIDTypes.MerchantID: case Helper.LIDTypes.MerchantNbr: dbInfo.MerchInfo = multi.Read <MerchantInfo>().FirstOrDefault(); dbInfo.CustProfile = multi.Read <CustomerProfile>().FirstOrDefault(); break; case Helper.LIDTypes.CustomerID: case Helper.LIDTypes.CustomerNbr: dbInfo.CustProfile = multi.Read <CustomerProfile>().FirstOrDefault(); break; default: break; } dbInfo.GroupInfo = multi.Read <Group>().FirstOrDefault(); dbInfo.ActvServices = multi.Read <ActiveServices>().FirstOrDefault(); dbInfo.DemographicsInfo = multi.Read <Demographics>().ToList(); dbInfo.MerchantsList = multi.Read <Merchant>().ToList(); dbInfo.CaseHistorysList = multi.Read <Wp.CIS.LynkSystems.Model.CaseHistory>().ToList(); dbInfo.TotalNumberOfCaseHistoryRecords = p.Get <int>("TotalCaseHistoryRecords"); } if (dbInfo.DemographicsInfo != null && dbInfo.DemographicsInfo.Count > 0) { dbInfo.DemographicsInfoCust = dbInfo.DemographicsInfo.Where(d => d.Level == "Customer").ToList(); dbInfo.DemographicsInfoMerch = dbInfo.DemographicsInfo.Where(d => d.Level == "Merchant").ToList(); dbInfo.DemographicsInfoTerm = dbInfo.DemographicsInfo.Where(d => d.Level == "Terminal").ToList(); } return dbInfo; })); } catch (Exception) { throw; } }
/// <summary> /// /// </summary> /// <param name="LIDType"></param> /// <param name="LID"></param> /// <returns></returns> public async Task <ApiResult <ICollection <BankingInformation> > > GetBankingInfo(Helper.LIDTypes LIDType, string LID) { ApiResult <ICollection <BankingInformation> > response = new ApiResult <ICollection <BankingInformation> >(); try { response.Result = await _bankingRepository.GetBankingInfo(LIDType, LID); } catch (System.Exception) { throw; } return(response); }