Untitled
unknown
plain_text
5 months ago
34 kB
4
Indexable
using DAL.Models; using DAL.UnitOfWork; using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Distributed; using System.Data; using System.Diagnostics.Metrics; using System.Text.RegularExpressions; namespace mPaymentsAPI.Services { public partial class CachingProvider : ICachingProvider { private static readonly SemaphoreSlim GetUsersSemaphore = new SemaphoreSlim(1, 1); private readonly IDistributedCache _cache; private IUnitOfWork _UnitOfWork; private readonly IConfiguration _configuration; private A2AmPaymentContext _A2AmPaymentContext; public bool LogDB { get; set; } public CachingProvider(IDistributedCache memoryCache, IUnitOfWork IUnitOfWork, IConfiguration configuration, A2AmPaymentContext a2AmPaymentContext) { _cache = memoryCache; _UnitOfWork = IUnitOfWork; _configuration = configuration; LogDB = _configuration.GetValue<bool>("GlobalSetting:LogDB"); _A2AmPaymentContext = a2AmPaymentContext; } /// <summary> /// Caching Configuration /// </summary> /// <returns></returns> private DistributedCacheEntryOptions CacheEntryOptions() { string sPeriod = _configuration["Cache:Unit"].ToString(); int nAbsoluteExpiration = int.Parse(_configuration["Cache:AbsoluteExpiration"].ToString()); int nSlidingExpiration = int.Parse(_configuration["Cache:SlidingExpiration"].ToString()); var cacheEntryOptions = new DistributedCacheEntryOptions(); switch (sPeriod.ToUpper()) { case "D": cacheEntryOptions.AbsoluteExpiration = DateTime.Now.AddDays(nAbsoluteExpiration); cacheEntryOptions.SlidingExpiration = TimeSpan.FromDays(nSlidingExpiration); break; case "H": cacheEntryOptions.AbsoluteExpiration = DateTime.Now.AddHours(nAbsoluteExpiration); cacheEntryOptions.SlidingExpiration = TimeSpan.FromHours(nSlidingExpiration); break; case "M": cacheEntryOptions.AbsoluteExpiration = DateTime.Now.AddMinutes(nAbsoluteExpiration); cacheEntryOptions.SlidingExpiration = TimeSpan.FromMinutes(nSlidingExpiration); break; case "S": cacheEntryOptions.AbsoluteExpiration = DateTime.Now.AddSeconds(nAbsoluteExpiration); cacheEntryOptions.SlidingExpiration = TimeSpan.FromSeconds(nSlidingExpiration); break; default: cacheEntryOptions.AbsoluteExpiration = DateTime.Now.AddDays(nAbsoluteExpiration); cacheEntryOptions.SlidingExpiration = TimeSpan.FromDays(nSlidingExpiration); break; } return cacheEntryOptions; } public void ClearAllAppCache() { var objList = _cache.Get("RegisterCacheKeys"); if (objList != null) { foreach (var item in objList.ToString().Split(',')) { if (!string.IsNullOrEmpty(item)) { _cache.Remove(item); } } } } public void ClearCache(string Key) { _cache.Remove(Key); } /*******************************************************************************************************/ //Services public async Task<IEnumerable<TblLookup>> GetLookups() { try { return await GetLookups(CacheKeys.TblLookup, GetUsersSemaphore); } catch { throw; } } public async Task<IEnumerable<TblLookupValue>> GetLookupsValues() { try { return await GetLookupsValues(CacheKeys.TblLookupValues, GetUsersSemaphore); } catch { throw; } } public async Task<IEnumerable<TblLUCurrency>> GetCurrencies() { try { return await GetCurrencies(CacheKeys.TblLucurrency, GetUsersSemaphore); } catch { throw; } } public async Task<IEnumerable<TblUserMsg>> GetUserMessages() { try { return await GetUserMessages(CacheKeys.TblLuuserMsg, GetUsersSemaphore); } catch { throw; } } public async Task<List<TblLUBankChannel>> GetUserBankChannel() { try { return await GetUserBankChannel(CacheKeys.TblLubankChannel, GetUsersSemaphore); } catch { throw; } } public async Task<List<TblBankTermsCondition>> GetTermsCondition() { try { return await GetTermsCondition(CacheKeys.TblLTermsCondition, GetUsersSemaphore); } catch { throw; } } public async Task<List<TblBankPrivacyPolicy>> GetPrivacyPolicy() { try { return await GetPrivacyPolicy(CacheKeys.TblBankPrivacyPolicy, GetUsersSemaphore); } catch { throw; } } public async Task<List<TblBank>> GetAllBank() { try { return await GetAllBank(CacheKeys.TblBank, GetUsersSemaphore); } catch { throw; } } public async Task<List<TblConactU>> GetConactUs() { try { return await GetConactUs(CacheKeys.TblLConactUs, GetUsersSemaphore); } catch { throw; } } public async Task<List<TblLUCountry>> GetCountry() { try { return await GetCountry(CacheKeys.TblCountry, GetUsersSemaphore); } catch { throw; } } public async Task<IEnumerable<TblSrvStepProfileDetail>> GetSrvStepProfileDetail() { try { return await GetSrvStepProfilDetaile(CacheKeys.TblSrvStepProfileDetail, GetUsersSemaphore); } catch { throw; } } public async Task<IEnumerable<TblSrvStepProfile>> GetSrvStepProfile() { try { return await GetSrvStepProfile(CacheKeys.TblSrvStepProfile, GetUsersSemaphore); } catch { throw; } } public async Task<IEnumerable<TblSrv>> GetSrvs() { try { return await GetSrvs(CacheKeys.TblSrv, GetUsersSemaphore); } catch { throw; } } public async Task<IEnumerable<TblSysParameter>> GetSysParameter() { try { return await GetSysParameter(CacheKeys.TblSysParameter, GetUsersSemaphore); } catch { throw; } } /*******************************************************************************************************/ private async Task<IEnumerable<TblLookup>> GetLookups(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblLookup> lookup); if (isAvaiable) return lookup; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out lookup); if (isAvaiable) return lookup; var oBank = _A2AmPaymentContext.TblBanks.Where(x => x.isDelete == false).Select(x => x.bankCode).AsNoTracking().ToList(); lookup = _A2AmPaymentContext.TblLookups.Where(x => oBank.Contains(x.bankCode)).AsNoTracking().ToList(); _cache.SetAsync(cacheKey, lookup, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return lookup; } private async Task<IEnumerable<TblLookupValue>> GetLookupsValues(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblLookupValue> lookupValues); if (isAvaiable) return lookupValues; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out lookupValues); if (isAvaiable) return lookupValues; //lookupValues = _UnitOfWork.TblLookupValue.QGet().Result.ToList(); lookupValues = _A2AmPaymentContext.TblLookupValues.AsNoTracking().ToList(); _cache.SetAsync(cacheKey, lookupValues, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return lookupValues; } private async Task<IEnumerable<TblLUCurrency>> GetCurrencies(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblLUCurrency> currency); if (isAvaiable) return currency; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out currency); if (isAvaiable) return currency; //currency = _UnitOfWork.TblLucurrency.QGet().Result.ToList(); currency = _A2AmPaymentContext.TblLUCurrencies.AsNoTracking().ToList(); _cache.SetAsync(cacheKey, currency, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return currency; } private async Task<IEnumerable<TblUserMsg>> GetUserMessages(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblUserMsg> userMsg); if (isAvaiable) return userMsg; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out userMsg); if (isAvaiable) return userMsg; var oBank = _A2AmPaymentContext.TblBanks.Where(x => x.isDelete == false).Select(x => x.bankCode).AsNoTracking().ToList(); userMsg = _A2AmPaymentContext.TblUserMsgs.Where(x => oBank.Contains(x.bankCode)).AsNoTracking().ToList(); _cache.SetAsync(cacheKey, userMsg, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return userMsg; } private async Task<List<TblLUBankChannel>> GetUserBankChannel(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblLUBankChannel> bankChannel); if (isAvaiable) return bankChannel; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out bankChannel); if (isAvaiable) return bankChannel; var oBank = _A2AmPaymentContext.TblBanks.Where(x => x.isDelete == false).Select(x => x.bankCode).AsNoTracking().ToList(); bankChannel = _A2AmPaymentContext.TblLUBankChannels.Where(x => oBank.Contains(x.bankCode)).AsNoTracking().ToList(); _cache.SetAsync(cacheKey, bankChannel, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return bankChannel; } private async Task<List<TblBankTermsCondition>> GetTermsCondition(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblBankTermsCondition> termsCondition); if (isAvaiable) return termsCondition; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out termsCondition); if (isAvaiable) return termsCondition; var oBank = _A2AmPaymentContext.TblBanks.Where(x => x.isDelete == false).Select(x => x.bankCode).AsNoTracking().ToList(); termsCondition = _A2AmPaymentContext.TblBankTermsConditions.Where(x => oBank.Contains(x.bankCode)).AsNoTracking().ToList(); _cache.SetAsync(cacheKey, termsCondition, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return termsCondition; } private async Task<List<TblBankPrivacyPolicy>> GetPrivacyPolicy(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblBankPrivacyPolicy> PrivacyPolicy); if (isAvaiable) return PrivacyPolicy; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out PrivacyPolicy); if (isAvaiable) return PrivacyPolicy; var oBank = _A2AmPaymentContext.TblBanks.Where(x => x.isDelete == false).Select(x => x.bankCode).AsNoTracking().ToList(); PrivacyPolicy = _A2AmPaymentContext.TblBankPrivacyPolicies.Where(x => oBank.Contains(x.bankCode)).AsNoTracking().ToList(); _cache.SetAsync(cacheKey, PrivacyPolicy, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return PrivacyPolicy; } private async Task<List<TblBank>> GetAllBank(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblBank> Banks); if (isAvaiable) return Banks; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out Banks); if (isAvaiable) return Banks; Banks = _A2AmPaymentContext.TblBanks.Where(x => x.isDelete == false && x.bankCode!= "Default").AsNoTracking().ToList(); _cache.SetAsync(cacheKey, Banks, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return Banks; } private async Task<List<TblConactU>> GetConactUs(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblConactU> contactus); if (isAvaiable) return contactus; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out contactus); if (isAvaiable) return contactus; var oBank = _A2AmPaymentContext.TblBanks.Where(x => x.isDelete == false).Select(x => x.bankCode).AsNoTracking().ToList(); contactus = _A2AmPaymentContext.TblConactUs.Where(x => oBank.Contains(x.bankCode)).AsNoTracking().ToList(); _cache.SetAsync(cacheKey, contactus, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return contactus; } private async Task<List<TblLUCountry>> GetCountry(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblLUCountry> Country); if (isAvaiable) return Country; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out Country); if (isAvaiable) return Country; Country = _A2AmPaymentContext.TblLUCountries.AsNoTracking().ToList(); _cache.SetAsync(cacheKey, Country, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return Country; } /*******************************************************************************************************/ #region Services private async Task<IEnumerable<TblSrv>> GetSrvs(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblSrv> Srv); if (isAvaiable) return Srv; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out Srv); if (isAvaiable) return Srv; Srv = _A2AmPaymentContext.TblSrvs.AsNoTracking().ToList(); _cache.SetAsync(cacheKey, Srv, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return Srv; } private async Task<IEnumerable<TblSrvStepProfile>> GetSrvStepProfile(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblSrvStepProfile> SrvStepProfile); if (isAvaiable) return SrvStepProfile; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out SrvStepProfile); if (isAvaiable) return SrvStepProfile; SrvStepProfile = _A2AmPaymentContext.TblSrvStepProfiles.AsNoTracking().ToList(); _cache.SetAsync(cacheKey, SrvStepProfile, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return SrvStepProfile; } private async Task<IEnumerable<TblSrvStepProfileDetail>> GetSrvStepProfilDetaile(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblSrvStepProfileDetail> SrvStepProfileDetail); if (isAvaiable) return SrvStepProfileDetail; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out SrvStepProfileDetail); if (isAvaiable) return SrvStepProfileDetail; SrvStepProfileDetail = _A2AmPaymentContext.TblSrvStepProfileDetails.AsNoTracking().ToList(); _cache.SetAsync(cacheKey, SrvStepProfileDetail, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return SrvStepProfileDetail; } #endregion private async Task<IEnumerable<TblSysParameter>> GetSysParameter(string cacheKey, SemaphoreSlim semaphore) { bool isAvaiable = _cache.TryGetValue(cacheKey, out List<TblSysParameter> sysParameter); if (isAvaiable) return sysParameter; try { await semaphore.WaitAsync(); isAvaiable = _cache.TryGetValue(cacheKey, out sysParameter); if (isAvaiable) return sysParameter; var oBank = _A2AmPaymentContext.TblBanks.Where(x => x.isDelete == false).Select(x => x.bankCode).AsNoTracking().ToList(); sysParameter = _A2AmPaymentContext.TblSysParameters.Where(x => oBank.Contains(x.bankCode)).AsNoTracking().ToList(); _cache.SetAsync(cacheKey, sysParameter, CacheEntryOptions()); } catch { throw; } finally { semaphore.Release(); } return sysParameter; } public async Task<Tuple<int, int>> WriteLogOnDB(string BankCode, string Channel, string SrvID, string SrvCode, string CorrelationID, string EDesc, string ADesc, string ErorCode, string CustID, string Request, string Response, int LogID, int LogDetID, string LoginID, string ActionID, string AccFrom = "", string AccTo = "", string Attr = "", decimal AmtFrom = 0, decimal AmtNorm = 0, string CardNo = "", string DateFrom = "", string DateTo = "", string Lang = "", string ReferanceNumber = "", string IPAddress = "", string SessionID = "", string DeviceType = "") { try { if (this.LogDB) if (LogID == 0) { Request = Regex.Replace(Request, @"(?<=\d{6})\d(?=\d{4})", new string('X', 1)); int _SrvID, _CustID; bool isNumeric = int.TryParse(SrvID, out _SrvID); isNumeric = int.TryParse(CustID, out _CustID); SqlParameter[] parameters = { new SqlParameter("@BankCode", BankCode), new SqlParameter("@ChannelCode", Channel), new SqlParameter("@CustID", _CustID), new SqlParameter("@SrvID", _SrvID), new SqlParameter("@SrvCode", SrvCode), new SqlParameter("@CorrelationID", CorrelationID), new SqlParameter("@ActionID", ActionID), new SqlParameter("@AccFrom", AccFrom), new SqlParameter("@AccTo", AccTo), new SqlParameter("@AmtFrom", AmtFrom), new SqlParameter("@AmtNorm", AmtNorm), new SqlParameter("@CardNo", CardNo), new SqlParameter("@EDesc", EDesc), new SqlParameter("@ADesc", ADesc), new SqlParameter("@DateFrom", (string.IsNullOrWhiteSpace(DateFrom) ? "" : Convert.ToDateTime(DateFrom))), new SqlParameter("@DateTo", (string.IsNullOrWhiteSpace(DateTo) ? "" : Convert.ToDateTime(DateTo))), new SqlParameter("@Lang", (!string.IsNullOrWhiteSpace(Lang) ? (Lang.Length >= 2 ? Lang.Substring(0,2):Lang ): "")), new SqlParameter("@ReferanceNumber", ReferanceNumber), new SqlParameter("@ErrCode", Convert.ToInt32( ErorCode)), new SqlParameter("@IPAddress", IPAddress), new SqlParameter("@SessionID", SessionID), new SqlParameter("@DeviceType", DeviceType), new SqlParameter("@LoginID", LoginID), new SqlParameter("@Attr", Attr), new SqlParameter("@Request", Request), new SqlParameter("@Response", Response), }; var result = _UnitOfWork.SaveLogCustAction.ExecSQL("SaveLogCustAction", parameters).FirstOrDefault(); if (result != null) { int nLogID = Convert.ToInt32(result.LogID); int nLogDetID = Convert.ToInt32(result.LogDetID); return Tuple.Create(nLogID, nLogDetID); } return Tuple.Create(0, 0); } else { // Update LogCustActionDetails Response = Regex.Replace(Response, @"(?<=\d{6})\d(?=\d{4})", new string('X', 1)); Request = Regex.Replace(Request, @"(?<=\d{6})\d(?=\d{4})", new string('X', 1)); SqlParameter[] parameters = { new SqlParameter("@LogID", LogDetID), new SqlParameter("@Request", Request), new SqlParameter("@Response", Response), }; var result = _UnitOfWork.UpdateLogCustAction.ExecSQL("UpdateLogCustAction", parameters).ToList(); } } catch (Exception ex) { } return Tuple.Create(0, 0); } //public async Task<Tuple<int, int>> WriteLogOnDB(string BankCode, string Channel, string SrvID, string SrvCode, string CorrelationID, string EDesc, string ADesc, string ErorCode, // string CustID, string Request, string Response, int LogID, // int LogDetID, string LoginID, string ActionID, string AccFrom = "", string AccTo = "", // string Attr = "", decimal AmtFrom = 0, decimal AmtNorm = 0, // string CardNo = "", string DateFrom = "", string DateTo = "", string Lang = "", // string ReferanceNumber = "", string IPAddress = "", string SessionID = "", // string DeviceType = "") //{ // try // { // if (this.LogDB) // if (LogID == 0) // { // Request = Regex.Replace(Request, @"(?<=\d{6})\d(?=\d{4})", new string('X', 1)); // int _SrvID, _CustID, _ActionID; // int.TryParse(SrvID, out _SrvID); // int.TryParse(CustID, out _CustID); // int.TryParse(ActionID, out _ActionID); // Lang = (!string.IsNullOrWhiteSpace(Lang) ? (Lang.Length >= 2 ? Lang.Substring(0, 2) : Lang) : ""); // var vBankCode = new SqlParameter("@BankCode", BankCode); // var vChannelCode = new SqlParameter("@ChannelCode", Channel); // var vCustID = new SqlParameter("@CustID", _CustID); // var vSrvID = new SqlParameter("@SrvID", _SrvID); // var vSrvCode = new SqlParameter("@SrvCode", SrvCode); // var vCorrelationID = new SqlParameter("@CorrelationID", CorrelationID); // var vActionID = new SqlParameter("@ActionID", _ActionID); // var vAccFrom = new SqlParameter("@AccFrom", AccFrom); // var vAccTo = new SqlParameter("@AccTo", AccTo); // var vAmtFrom = new SqlParameter("@AmtFrom", AmtFrom); // var vAmtNorm = new SqlParameter("@AmtNorm", AmtNorm); // var vCardNo = new SqlParameter("@CardNo", CardNo); // var vEDesc = new SqlParameter("@EDesc", EDesc); // var vADesc = new SqlParameter("@ADesc", ADesc); // var vDateFrom = new SqlParameter("@DateFrom", (string.IsNullOrWhiteSpace(DateFrom) ? "" : Convert.ToDateTime(DateFrom))); // var vDateTo = new SqlParameter("@DateTo", (string.IsNullOrWhiteSpace(DateTo) ? "" : Convert.ToDateTime(DateTo))); // var vLang = new SqlParameter("@Lang", Lang); // var vReferanceNumber = new SqlParameter("@ReferanceNumber", ReferanceNumber); // var vErrCode = new SqlParameter("@ErrCode", Convert.ToInt32(ErorCode)); // var vIPAddress = new SqlParameter("@IPAddress", IPAddress); // var vSessionID = new SqlParameter("@SessionID", SessionID); // var vDeviceType = new SqlParameter("@DeviceType", DeviceType); // var vLoginID = new SqlParameter("@LoginID", LoginID); // var vAttr = new SqlParameter("@Attr", Attr); // var vRequest = new SqlParameter("@Request", Request); // var vResponse = new SqlParameter("@Response", Response); // var vLogID = new SqlParameter // { // ParameterName = "@LogID", // Value = 0, // Direction = ParameterDirection.Output // }; // var vLogDetID = new SqlParameter // { // ParameterName = "@LogDetID", // Value = 0, // Direction = ParameterDirection.Output // }; // await _A2AmPaymentContext.Database.ExecuteSqlRawAsync("exec SaveLogCustAction @BankCode ,@ChannelCode ,@CustID ,@SrvID,@SrvCode,@CorrelationID,@ActionID,@AccFrom,@AccTo,@AmtFrom,@AmtNorm,@CardNo,@EDesc,@ADesc,@DateFrom,@DateTo,@Lang,@ReferanceNumber,@ErrCode,@IPAddress,@SessionID,@DeviceType,@LoginID,@Attr,@Request,@Response,@LogID OUT,@LogDetID OUT" // , vBankCode, vChannelCode, vCustID, vSrvID, vSrvCode, vCorrelationID, vActionID, vAccFrom, vAccTo, vAmtFrom, vAmtNorm, vCardNo, vEDesc, vADesc, vDateFrom, vDateTo, vLang, vReferanceNumber, vErrCode, vIPAddress, vSessionID, vDeviceType, vLoginID, vAttr, vRequest, vResponse, vLogID, vLogDetID // ); // var _vLogID = vLogID.Value.ToString(); // var _vLogDetID = vLogDetID.Value.ToString(); // int _vLogCustActionIDnum = string.IsNullOrWhiteSpace(_vLogID) ? 0 : Convert.ToInt32(_vLogID); // int _vLogCustActionDetIDnum = string.IsNullOrWhiteSpace(_vLogDetID) ? 0 : Convert.ToInt32(_vLogDetID); // return Tuple.Create(_vLogCustActionIDnum, _vLogCustActionDetIDnum); // } // else // { // Update LogCustActionDetails // Response = Regex.Replace(Response, @"(?<=\d{6})\d(?=\d{4})", new string('X', 1)); // Request = Regex.Replace(Request, @"(?<=\d{6})\d(?=\d{4})", new string('X', 1)); // SqlParameter[] parameters = { // new SqlParameter("@LogID", LogDetID), // new SqlParameter("@Request", Request), // new SqlParameter("@Response", Response), // }; // var result = _A2AmPaymentContext.Database.ExecuteSqlRaw( // "UpdateLogCustAction " + // " @LogID = {0}" + // ",@Request = {1}" + // ",@Response = {2}" // , parameters); // } // } // catch (Exception ex) // { // } // return Tuple.Create(0, 0); //} } }
Editor is loading...
Leave a Comment