public HttpResponseMessage AddAccInfo(HttpRequestMessage reqObject) { int result = 0; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _AccInfo = JsonConvert.DeserializeObject <AccMaster>(_requestedDataObject.BusinessData); bool IsValid = ModelValidation.TryValidateModel(_AccInfo, out _modelErrorMsg); if (IsValid) { result = _IAccInfoService.AddAccInfo(_AccInfo); } } if (!string.IsNullOrWhiteSpace(_modelErrorMsg)) { _serviceResponse = _IDataManipulation.SetResponseObject(result, _modelErrorMsg); } else if (result == 1) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been added successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been added"); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public int AddAccInfo(AccMaster _AccInfo) { try { var _max = _IUoW.Repository <AccMaster>().GetMaxValue(x => x.AccountId) + 1; _AccInfo.AccountId = _max.ToString().PadLeft(3, '0'); _AccInfo.AuthStatusId = "U"; _AccInfo.LastAction = "ADD"; _AccInfo.MakeDT = System.DateTime.Now; _AccInfo.MakeBy = "prova"; var result = _IUoW.Repository <AccMaster>().Add(_AccInfo); #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; _IAuthLogService.AddAuthLog(_IUoW, null, _AccInfo, "ADD", "0001", _AccInfo.FunctionId, 1, "AccInfo", "MTK_ACC_INFO", "AccountId", _AccInfo.AccountId, _AccInfo.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } #endregion if (result == 1) { _IUoW.Commit(); } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddAccInfo(obj)", string.Empty); return(0); } }
public HttpResponseMessage GetBankAccInfoByWalletAccNo(HttpRequestMessage reqObject) { AccMaster _Acc_Info = new AccMaster(); string FromSystemAccountNo = string.Empty; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _AccInfo = JsonConvert.DeserializeObject <AccMaster>(_requestedDataObject.BusinessData); FromSystemAccountNo = _AccInfo.FromSystemAccountNo; } if (!string.IsNullOrWhiteSpace(FromSystemAccountNo)) { _Acc_Info = _IAccInfoService.GetBankAccInfoByWalletAccNo(_AccInfo); } if (_Acc_Info != null) { _serviceResponse = _IDataManipulation.SetResponseObject(_Acc_Info, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(_Acc_Info, "Account No. is not valid.."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public AccMaster GetBankAccInfoByWalletAccNo(AccMaster _AccInfo) { AccMaster _Acc_Info = new AccMaster(); CustomerAccProfile _CustomerAccProfile = new CustomerAccProfile(); try { var _accInfo = _IUoW.Repository <AccMaster>().GetBy(x => x.WalletAccountNo == _AccInfo.FromSystemAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); if (_accInfo != null) { if (_accInfo.AccTypeId == "004") { _CustomerAccProfile = _IUoW.Repository <CustomerAccProfile>().GetBy(x => x.SystemAccountNo == _accInfo.SystemAccountNo); if (_CustomerAccProfile != null) { _Acc_Info.FromSystemAccountNo = _CustomerAccProfile.BankAccountNo; } } } return(_Acc_Info); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetBankAccInfoByWalletAccNo(obj)", string.Empty); return(null); } }
public AccMaster GetAccInfo(AccMaster _AccInfo) { AccMaster Acc_Info1 = null; AccMaster Acc_Info2 = null; AccMaster Acc_Info3 = new AccMaster(); try { if (_AccInfo.FunctionId == "090107006") { Acc_Info1 = _IUoW.Repository <AccMaster>().GetBy(x => x.WalletAccountNo == _AccInfo.FromSystemAccountNo || x.BankAccountNo == _AccInfo.FromSystemAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); Acc_Info2 = _IUoW.Repository <AccMaster>().GetBy(x => x.WalletAccountNo == _AccInfo.ToSystemAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); } else { Acc_Info1 = _IUoW.Repository <AccMaster>().GetBy(x => x.WalletAccountNo == _AccInfo.FromSystemAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); Acc_Info2 = _IUoW.Repository <AccMaster>().GetBy(x => x.WalletAccountNo == _AccInfo.ToSystemAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); } if (Acc_Info1 != null && Acc_Info2 != null) { Acc_Info3.FromSystemAccountNo = Acc_Info1.SystemAccountNo; Acc_Info3.FromAccType = Acc_Info1.AccTypeId; Acc_Info3.ToSystemAccountNo = Acc_Info2.SystemAccountNo; Acc_Info3.ToAccType = Acc_Info2.AccTypeId; } return(Acc_Info3); } catch (Exception ex) { throw ex; } }
public HttpResponseMessage GetAccInfo(HttpRequestMessage reqObject) { try { var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; string WalletAccNo = string.Empty; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _AccInfo = JsonConvert.DeserializeObject <AccMaster>(_requestedDataObject.BusinessData, settings); WalletAccNo = _AccInfo.WalletAccountNo; } if (!string.IsNullOrWhiteSpace(WalletAccNo)) { _AccInfo = new AccMaster(); _AccInfo = _IAccInfoService.GetAccInfoForDetails(WalletAccNo); string accType = _AccInfo.AccTypeId; if (accType == "004") { _customerAccProfile = _IAccInfoService.GetCusAccInfoForDetails(WalletAccNo); } if (_customerAccProfile != null) { _serviceResponse = _IDataManipulation.SetResponseObject(_customerAccProfile, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(_customerAccProfile, "Data Not Found..."); } } //if (_AccInfo != null) //{ // _serviceResponse = _IDataManipulation.SetResponseObject(_AccInfo, "information has been fetched successfully"); //} //else //{ // _serviceResponse = _IDataManipulation.SetResponseObject(_AccInfo, "Data Not Found..."); //} _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); } catch (Exception ex) { } return(_response); }
public AccMaster GetAccMasterInfoByAccNo(AccMaster _AccMaster) { try { _AccMaster = _IUoW.Repository <AccMaster>().GetBy(x => x.WalletAccountNo == _AccMaster.FromSystemAccountNo || x.WalletAccountNo == _AccMaster.WalletAccountNo || x.SystemAccountNo == _AccMaster.FromSystemAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); return(_AccMaster); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetAccMasterInfoByAccNo(obj)", string.Empty); return(null); } }
public HttpResponseMessage GetAccMasterInfoByAccNo(HttpRequestMessage reqObject) { _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _AccMaster = JsonConvert.DeserializeObject <AccMaster>(_requestedDataObject.BusinessData); } if (!string.IsNullOrWhiteSpace(_AccMaster.FromSystemAccountNo) || !string.IsNullOrWhiteSpace(_AccMaster.WalletAccountNo)) { _AccMaster = _IChannelLedgerService.GetAccMasterInfoByAccNo(_AccMaster); } if (_AccMaster != null) { _serviceResponse = _IDataManipulation.SetResponseObject(_AccMaster, "information has been fetched successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(_AccMaster, "Account No. is not valid.."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public string AddCashIn(UserTransaction _UserTransaction, out mTaka.Utility.ISO20022.Camt054.Document document) { document = new Document(); var grpHdr = document.BkToCstmrDbtCdtNtfctn.GrpHdr; grpHdr.MsgId = mTaka.Utility.ISO.ISOHelper.RandomString(); grpHdr.CreDtTm = DateTime.Now; var ntfctn = document.BkToCstmrDbtCdtNtfctn.Ntfctn.FirstOrDefault(); var ntry = ntfctn?.Ntry.FirstOrDefault(); if (ntry != null) { ntry.Amt = new ActiveOrHistoricCurrencyAndAmount() { Ccy = "BDT", Value = _UserTransaction.Amount }; ntry.CdtDbtInd = CreditDebitCode.DBIT; ntry.Sts = new EntryStatus1Choice() { Item = "Other", ItemElementName = ItemChoiceType9.Prtry }; } grpHdr.MsgPgntn.LastPgInd = true; grpHdr.MsgPgntn.PgNb = "1"; int result = 0; _UserTransaction.TransDT = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy")); string split_result = string.Empty; string MainAuthFlag = string.Empty; AccMasterService _AccInfoService = new AccMasterService(); AccMaster _AccInfo_Post = new AccMaster(); AccMaster _AccInfo_Get = new AccMaster(); StatusWiseServiceService _StatusWiseServiceService = new StatusWiseServiceService(); StatusWiseService _StatusWiseService = new StatusWiseService(); int CheckStatusWiseService = 0; TransactionRulesService _TransactionRulesService = new TransactionRulesService(); TransactionRules _TransactionRules = new TransactionRules(); int CheckTransactionRules = 0; AccLimitSetupService _AccLimitSetupService = new AccLimitSetupService(); AccLimitSetup _AccLimitSetup = new AccLimitSetup(); string CheckAccLimit = string.Empty; try { #region Get SystemAccountNo by WalletAccountNo _AccInfo_Post.FromSystemAccountNo = _UserTransaction.FromSystemAccountNo; _AccInfo_Post.ToSystemAccountNo = _UserTransaction.ToSystemAccountNo; _AccInfo_Post.FunctionId = _UserTransaction.FunctionId; _AccInfo_Get = _AccInfoService.GetAccInfo(_AccInfo_Post); if (_AccInfo_Get == null || _AccInfo_Get.FromSystemAccountNo == null || _AccInfo_Get.ToSystemAccountNo == null) { split_result = result + ":" + "Account No. not valid.."; grpHdr.AddtlInf = "Account No. not valid.."; return(split_result); } #endregion #region Check StatusWiseService _StatusWiseService.ToSystemAccountNo = _AccInfo_Get.ToSystemAccountNo; _StatusWiseService.DefineServiceId = _UserTransaction.DefineServiceId; CheckStatusWiseService = _StatusWiseServiceService.CheckStatusWiseService(_StatusWiseService); if (CheckStatusWiseService == 0) { split_result = result + ":" + "Account No. is not active for this transaction.."; grpHdr.AddtlInf = "Account No. is not active for this transaction.."; return(split_result); } #endregion #region Check TransactionRules _TransactionRules.FromSystemAccountNo = _AccInfo_Get.FromSystemAccountNo; _TransactionRules.ToSystemAccountNo = _AccInfo_Get.ToSystemAccountNo; _TransactionRules.DefineServiceId = _UserTransaction.DefineServiceId; CheckTransactionRules = _TransactionRulesService.CheckTransactionRules(_TransactionRules); if (CheckTransactionRules == 0) { split_result = result + ":" + "Transaction is not allowed.."; grpHdr.AddtlInf = "Transaction is not allowed.."; return(split_result); } #endregion #region Check Limit _AccLimitSetup.FromSystemAccountNo = _AccInfo_Get.FromSystemAccountNo; _AccLimitSetup.FromAccType = _AccInfo_Get.FromAccType; _AccLimitSetup.ToSystemAccountNo = _AccInfo_Get.ToSystemAccountNo; _AccLimitSetup.ToAccType = _AccInfo_Get.ToAccType; _AccLimitSetup.DefineServiceId = _UserTransaction.DefineServiceId; _AccLimitSetup.Amount = _UserTransaction.Amount; _AccLimitSetup.TransDT = _UserTransaction.TransDT; CheckAccLimit = _AccLimitSetupService.CheckAccLimit(_AccLimitSetup); if (CheckAccLimit != "true") { split_result = result + ":" + CheckAccLimit; return(split_result); } #endregion if (_AccInfo_Get.FromSystemAccountNo != null && _AccInfo_Get.ToSystemAccountNo != null && CheckStatusWiseService != 0 && CheckTransactionRules != 0 && CheckAccLimit == "true") { var _max = _IUoW.Repository <UserTransaction>().GetMaxValue(x => x.SerialId) + 1; _UserTransaction.SerialId = _max.ToString().PadLeft(3, '0'); _UserTransaction.AuthStatusId = "U"; _UserTransaction.LastAction = "ADD"; _UserTransaction.MakeDT = System.DateTime.Now; _UserTransaction.MakeBy = "prova"; _UserTransaction.FromSystemAccountNo = _AccInfo_Get.FromSystemAccountNo; _UserTransaction.ToSystemAccountNo = _AccInfo_Get.ToSystemAccountNo; result = _IUoW.Repository <UserTransaction>().Add(_UserTransaction); #region Auth Log if (result == 1) { string url = ConfigurationManager.AppSettings["LgurdaService_server"] + "/GetAuthPermissionByFunctionId/" + _UserTransaction.FunctionId + "/" + _UserTransaction.FunctionName + "?format=json"; using (WebClient wc = new WebClient()) { TransactionRules OBJ_TransactionRules = new TransactionRules(); var json = wc.DownloadString(url); OBJ_TransactionRules = JsonConvert.DeserializeObject <TransactionRules>(json); MainAuthFlag = OBJ_TransactionRules.GetAuthPermissionByFunctionIdResult; } if (MainAuthFlag == "1") { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; result = _IAuthLogService.AddAuthLog(_IUoW, null, _UserTransaction, "ADD", "0001", _UserTransaction.FunctionId, 1, "CashIn", "MTK_USER_TXN", "SerialId", _UserTransaction.SerialId, "prova", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } if (MainAuthFlag == "0") { _IAuthLogService = new AuthLogService(); FTAuthLog _ObjAuthLog = new FTAuthLog(); _ObjAuthLog.TableNm = "MTK_USER_TXN"; _ObjAuthLog.AuthStatusId = "A"; _ObjAuthLog.LastAction = "ADD"; _ObjAuthLog.FunctionId = _UserTransaction.FunctionId; _ObjAuthLog.TablePkColVal = _UserTransaction.SerialId; result = _IAuthLogService.SetTableObject_FT <UserTransaction>(_IUoW, _ObjAuthLog, _UserTransaction); } } #endregion if (result == 1) { _IUoW.Commit(); split_result = result + ":" + "Saved Successfully"; grpHdr.AddtlInf = "Saved Successfully"; } else { split_result = result + ":" + "information hasn't been added"; grpHdr.AddtlInf = "information hasn't been added"; } } } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddCashIn(obj)", string.Empty); split_result = result + ":" + ""; grpHdr.AddtlInf = ""; } return(split_result); }
public string AddChannelAccProfile(ChannelAccProfile _ChannelAccProfile) { int result = 0; string MonitoringId = "2"; string MainResult = string.Empty; Random random = new Random(); ChannelAccProfileService OBJ_ChannelAccProfileService = new ChannelAccProfileService(); try { var duplicateCheck = OBJ_ChannelAccProfileService.IsChannelAccNumberExist(_ChannelAccProfile); if (duplicateCheck == "NotExist") { var _max = _IUoW.Repository <ChannelAccProfile>().GetMaxValue(x => x.AccountProfileId); if (_max > 0) { _ChannelAccProfile.AccountProfileId = (_max + 1).ToString(); } else { _ChannelAccProfile.AccountProfileId = MonitoringId + (_max + 1).ToString().PadLeft(8, '0'); } _ChannelAccProfile.SystemAccountNo = Guid.NewGuid().ToString(); _ChannelAccProfile.AuthStatusId = "U"; _ChannelAccProfile.LastAction = "ADD"; _ChannelAccProfile.AccountStatusId = "001"; _ChannelAccProfile.MakeDT = System.DateTime.Now; _ChannelAccProfile.MakeBy = "prova"; result = _IUoW.Repository <ChannelAccProfile>().Add(_ChannelAccProfile); #region Add Account Info if (result == 1) { _AccInfo = new AccMaster(); var _maxAccInfoId = _IUoW.Repository <AccMaster>().GetMaxValue(x => x.AccountId) + 1; _AccInfo.AccountId = _maxAccInfoId.ToString().PadLeft(3, '0'); //_AccInfo.AccProfileId = _ChannelAccProfile.AccountProfileId; _AccInfo.WalletAccountNo = _ChannelAccProfile.WalletAccountNo; _AccInfo.SystemAccountNo = _ChannelAccProfile.SystemAccountNo; _AccInfo.AccNm = _ChannelAccProfile.UserName; _AccInfo.AccTypeId = _ChannelAccProfile.AccountTypeId; _AccInfo.BankAccountNo = _ChannelAccProfile.BankAccountNo; _AccInfo.TransDT = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy")); _AccInfo.AccountStatusId = "001"; _AccInfo.AuthStatusId = "U"; _AccInfo.LastAction = "ADD"; _AccInfo.MakeDT = System.DateTime.Now; _AccInfo.MakeBy = "prova"; result = _IUoW.Repository <AccMaster>().Add(_AccInfo); //if (result == 1) //{ // _IAuthLogService = new AuthLogService(); // long _outMaxSlAuthLogDtl = 0; // result = _IAuthLogService.AddAuthLog(_IUoW, null, _ChannelAccProfile, "ADD", "0001", "090103002", 1, "MTK_ACC_CHANNEL_PROFILE", "AccountProfileId", _ChannelAccProfile.AccountProfileId, "prova", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); //} } #endregion #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; result = _IAuthLogService.AddAuthLog(_IUoW, null, _ChannelAccProfile, "ADD", "0001", _ChannelAccProfile.FunctionId, 1, "ChannelAccProfile", "MTK_ACC_CHANNEL_PROFILE", "AccountProfileId", _ChannelAccProfile.AccountProfileId, _ChannelAccProfile.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } #endregion if (result == 1) { _IUoW.Commit(); } MainResult = result + ":" + "Successfull"; return(MainResult); } else { MainResult = result + ":" + "Account number already exists.."; return(MainResult); } } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddChannelAccProfile(obj)", string.Empty); MainResult = result + ":" + "NotSuccessfull"; return(MainResult); } }
public int AddCustomer(CustomerAccProfile _Customer, APIServiceRequest _requestedDataObject) { try { string FunctionId = "090103003"; string FunctionName = "CustomerAccProfile"; string MainAuthFlag = string.Empty; string MonitoringId = "3"; var _max = _IUoW.Repository <CustomerAccProfile>().GetMaxValue(x => x.AccountProfileId); if (_max > 0) { _Customer.AccountProfileId = (_max + 1).ToString(); } else { _Customer.AccountProfileId = MonitoringId + (_max + 1).ToString().PadLeft(8, '0'); } if (_Customer.sameAsPeranent == "True") { _Customer.PermanentAddress1 = _Customer.PresentAddress1; _Customer.PermanentAddress2 = _Customer.PresentAddress2; _Customer.PermanentCountry = _Customer.CountryId; _Customer.PermanentDistrict = _Customer.PresentDistrict; _Customer.PermanentArea = _Customer.PresentArea; _Customer.PermanentCity = _Customer.PresentCity; _Customer.PermanentThana = _Customer.PresentThana; //_Customer.PermanentPhone = _Customer.PresentPhone; } //else { //_Customer.AuthStatusId = "U"; //_Customer.LastAction = "ADD"; //_Customer.AccountStatusId = "R"; //_Customer.MakeDT = Convert.ToDateTime(DateTime.Now.ToShortDateString()); //_Customer.MakeBy = "mtaka"; //} _Customer.SystemAccountNo = Guid.NewGuid().ToString(); _Customer.AuthStatusId = "U"; _Customer.LastAction = "ADD"; _Customer.AccountStatusId = "001"; _Customer.MakeDT = System.DateTime.Now; _Customer.MakeBy = "mtaka"; var result = _IUoW.Repository <CustomerAccProfile>().Add(_Customer); #region Auth Log if (result == 1) { string url = ConfigurationManager.AppSettings["LgurdaService_server"] + "/GetAuthPermissionByFunctionId/" + FunctionId + "/" + FunctionName + "?format=json"; using (WebClient wc = new WebClient()) { TransactionRules OBJ_TransactionRules = new TransactionRules(); var json = wc.DownloadString(url); OBJ_TransactionRules = JsonConvert.DeserializeObject <TransactionRules>(json); MainAuthFlag = OBJ_TransactionRules.GetAuthPermissionByFunctionIdResult; } if (MainAuthFlag == "1") { #region Data Store in Account Info if (result == 1) { _AccInfo = new AccMaster(); var _maxAccInfoId = _IUoW.Repository <AccMaster>().GetMaxValue(x => x.AccountId) + 1; _AccInfo.AccountId = _maxAccInfoId.ToString().PadLeft(3, '0'); //_AccInfo.AccProfileId = _Customer.AccountProfileId; _AccInfo.WalletAccountNo = _Customer.WalletAccountNo; _AccInfo.SystemAccountNo = _Customer.SystemAccountNo; //_AccInfo.AccNm = _Customer.CustomerNm; _AccInfo.AccTypeId = _Customer.AccTypeId; _AccInfo.BankAccountNo = _Customer.BankAccountNo; _AccInfo.TransDT = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy")); _AccInfo.AccountStatusId = "001"; _AccInfo.AuthStatusId = "U"; _AccInfo.LastAction = "ADD"; _AccInfo.MakeDT = System.DateTime.Now; _AccInfo.MakeBy = "mTaka"; _IUoW.Repository <AccMaster>().Add(_AccInfo); } #endregion _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; result = _IAuthLogService.AddAuthLog(_IUoW, null, _Customer, "ADD", "0001", _Customer.FunctionId, 1, "CustomerAccProfile", "MTK_ACC_CUSTOMER_ACC_PROFILE", "AccountProfileId", _Customer.AccountProfileId, _Customer.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } if (MainAuthFlag == "0") { _IAuthLogService = new AuthLogService(); AuthLog _ObjAuthLog = new AuthLog(); _ObjAuthLog.TableNm = "MTK_ACC_CUSTOMER_ACC_PROFILE"; _ObjAuthLog.AuthStatusId = "A"; _ObjAuthLog.LastAction = "ADD"; _ObjAuthLog.FunctionId = FunctionId; _ObjAuthLog.TablePkColVal = _Customer.AccountProfileId; _ObjAuthLog.MainAuthFlag = MainAuthFlag; //_Customer.AccIdofAccInfo = _AccInfo.AccountId; result = _IAuthLogService.SetTableObject <CustomerAccProfile>(_IUoW, _ObjAuthLog, _Customer); if (result == 1) //For Creating User in Lguarda { string _UserId = _Customer.WalletAccountNo; string _MakeBy = _requestedDataObject.UserId; string _UserClassificationId = "2"; string _UserAreaId = "5"; string _UserAreaIdValue = _Customer.SystemAccountNo; string _UserDescription = "null"; string _BranchId = "null"; string _CustomerFatherNm = string.IsNullOrWhiteSpace(_Customer.FatherName) ? "null" : _Customer.FatherName; string _CustomerMotherNm = string.IsNullOrWhiteSpace(_Customer.MotherName) ? "null" : _Customer.MotherName; //string _CustomerDOB = (_Customer.CustomerDOB == null) ? "null" : DateTime.ParseExact(_Customer.CustomerDOB.ToString(), "dd-MM-yyyy", CultureInfo.InvariantCulture).ToString(); string _CustomerDOB = "null"; string _AccNo = _Customer.WalletAccountNo; string _MailAddress = string.IsNullOrWhiteSpace(_Customer.Email) ? "null" : _Customer.Email; string _MobNo = string.IsNullOrWhiteSpace(_Customer.AlternativeMblNo) ? _Customer.WalletAccountNo : _Customer.AlternativeMblNo; string _AuthenticationId = "5"; string _WorkCriteria = "2"; string _RoleId = "29"; string _RequestClientIP = string.IsNullOrWhiteSpace(_requestedDataObject.RequestClientIP) ? "null" : _requestedDataObject.RequestClientIP; string _RequestAppId = string.IsNullOrWhiteSpace(_requestedDataObject.RequestAppId) ? "09" : _requestedDataObject.RequestAppId; string url1 = ConfigurationManager.AppSettings["LgurdaService_server"] + "/Add_UserProfile/" + _UserId + "/" + _MakeBy + "/" + _UserClassificationId + "/" + _UserAreaId + "/" + _UserAreaIdValue + "/" + _Customer.UserName + "/" + _UserDescription + "/" + _BranchId + "/" + _AccNo + "/" + _CustomerFatherNm + "/" + _CustomerMotherNm + "/" + _CustomerDOB + "/" + _MailAddress + "/" + _MobNo + "/" + _AuthenticationId + "/" + _RequestClientIP + "/" + "null" + "/" + "null" + "/" + _WorkCriteria + "/" + _RequestAppId + "/" + "A" + "/" + _RoleId + "?format=json"; string lg_result = PostParameter(url1); result = (!string.IsNullOrWhiteSpace(lg_result) && lg_result.ToLower() == "true") ? 1 : 0; } } } #endregion //#region Auth Log //if (result == 1) //{ // _IAuthLogService = new AuthLogService(); // long _outMaxSlAuthLogDtl = 0; // result = _IAuthLogService.AddAuthLog(_IUoW, null, _Customer, "ADD", "0001", "090103003", 1, "MTK_ACC_CUSTOMER_ACC_PROFILE", "AccountProfileId", _Customer.AccountProfileId, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); //} //#endregion if (result == 1) { _IUoW.Commit(); } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddCustomer(obj)", string.Empty); return(0); } }
public List <LedgerTxnHist> GetAllLedgerTxnforTopPerformerMonitoring(LedgerTxn _LedgerTxn) { try { List <LedgerTxn> _ListLedgerTxn = new List <LedgerTxn>(); List <LedgerTxnHist> _ListLedgerTxnHist = new List <LedgerTxnHist>(); AccMaster obj_AccInfo_SystemAccNo = null; obj_AccInfo_SystemAccNo = _IUoW.Repository <AccMaster>().GetBy(x => x.WalletAccountNo == _LedgerTxn.SystemAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); if (obj_AccInfo_SystemAccNo != null) { if (_LedgerTxn.FromDate != null && _LedgerTxn.ToDate == null) //10 { //DateTime FromDate = Convert.ToDateTime(_LedgerTxn.FromDate); //FromDate = Convert.ToDateTime(FromDate.ToString("dd/MM/yyyy")); _ListLedgerTxn = (List <LedgerTxn>)_IUoW.Repository <LedgerTxn>().Get(x => x.TransectionDate >= DbFunctions.TruncateTime(_LedgerTxn.FromDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); _ListLedgerTxnHist = (List <LedgerTxnHist>)_IUoW.Repository <LedgerTxnHist>().Get(x => x.TransectionDate >= DbFunctions.TruncateTime(_LedgerTxn.FromDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); } else if (_LedgerTxn.FromDate == null && _LedgerTxn.ToDate != null) //01 { _ListLedgerTxn = (List <LedgerTxn>)_IUoW.Repository <LedgerTxn>().Get(x => x.TransectionDate <= DbFunctions.TruncateTime(_LedgerTxn.ToDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); _ListLedgerTxnHist = (List <LedgerTxnHist>)_IUoW.Repository <LedgerTxnHist>().Get(x => x.TransectionDate <= DbFunctions.TruncateTime(_LedgerTxn.ToDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); } else if (_LedgerTxn.FromDate == null && _LedgerTxn.ToDate == null) // 00 { _ListLedgerTxn = (List <LedgerTxn>)_IUoW.Repository <LedgerTxn>().Get(x => x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); _ListLedgerTxnHist = (List <LedgerTxnHist>)_IUoW.Repository <LedgerTxnHist>().Get(x => x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); } else //11 { _ListLedgerTxn = (List <LedgerTxn>)_IUoW.Repository <LedgerTxn>().Get(x => x.TransectionDate >= DbFunctions.TruncateTime(_LedgerTxn.FromDate) && x.TransectionDate <= DbFunctions.TruncateTime(_LedgerTxn.ToDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); _ListLedgerTxnHist = (List <LedgerTxnHist>)_IUoW.Repository <LedgerTxnHist>().Get(x => x.TransectionDate >= DbFunctions.TruncateTime(_LedgerTxn.FromDate) && x.TransectionDate <= DbFunctions.TruncateTime(_LedgerTxn.ToDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); } if (_ListLedgerTxn != null) { var Type = AutoMapperCFG.SetListMapping <LedgerTxn, LedgerTxnHist>(_ListLedgerTxn); _ListLedgerTxnHist.AddRange(Type); } } if (_ListLedgerTxnHist != null) { IAccInfoService _IAccInfoService = new AccMasterService(); var _allAccInfo = _IAccInfoService.GetAllAccInfo(); foreach (var item in _ListLedgerTxnHist) { foreach (var item1 in _allAccInfo) { if (item.SystemAccountNo == item1.SystemAccountNo) { item.WalletAccountNo = item1.WalletAccountNo; break; } } } return(_ListLedgerTxnHist.OrderByDescending(x => x.TransectionDate).ThenByDescending(x => x.BatchNo).ThenByDescending(x => x.Sl).ToList()); } return(_ListLedgerTxnHist); } catch (Exception ex) { throw ex; } }
//#region Update for LedgerTxn //public int InsertLedgerTxn(IUnitOfWork _IUoW, LedgerTxn _LedgerTxn) //{ // int result = 0; // try // { // LedgerService OBJ_ChannelLedgerService = new LedgerService(); // int result1 = 0; // int result2 = 0; // int result_master = 0; // int result_master1 = 0; // #region UnKnown // if (_LedgerTxn.PaymentAmount == 0 || _LedgerTxn.ReceiveAmount == 0) // { // LedgerMaster Obj_Master = new LedgerMaster(); // Obj_Master.AccProfileId = _LedgerTxn.AccProfileId; // Obj_Master.AccountTypeId = _LedgerTxn.AccountTypeId; // Obj_Master.SystemAccountNo = _LedgerTxn.FromSystemAccountNo; // Obj_Master.OpeningBalance = _LedgerTxn.OpeningBalance; // Obj_Master.ClosingBalance = _LedgerTxn.ClosingBalance; // Obj_Master.PaymentAmount = _LedgerTxn.PaymentAmount; // Obj_Master.ReceiveAmount = _LedgerTxn.ReceiveAmount; // string ResultClosingBalance = OBJ_ChannelLedgerService.UpdateClosingBalance(_IUoW, Obj_Master); // var split = ResultClosingBalance.ToString().Split(':'); // result_master = Convert.ToInt32(split[0]); // _LedgerTxn.ClosingBalance = Convert.ToDecimal(split[1]); // if (result_master == 1) // { // LedgerTxn Obj_Txn = new LedgerTxn(); // Obj_Txn.BatchNo = _LedgerTxn.BatchNo; // Obj_Txn.TransectionId = _LedgerTxn.TransectionId; // Obj_Txn.AccProfileId = _LedgerTxn.AccProfileId; // Obj_Txn.AccountTypeId = _LedgerTxn.AccountTypeId; // Obj_Txn.FromSystemAccountNo = _LedgerTxn.FromSystemAccountNo; // Obj_Txn.ToSystemAccountNo = _LedgerTxn.ToSystemAccountNo; // Obj_Txn.PaymentAmount = _LedgerTxn.PaymentAmount; // Obj_Txn.ReceiveAmount = 0; // Obj_Txn.CurrentBalance = _LedgerTxn.ClosingBalance; // Obj_Txn.AccountTypeId = _LedgerTxn.FromAccountTypeId; // Obj_Txn.MakeBy = _LedgerTxn.MakeBy; // Obj_Txn.FunctionId = _LedgerTxn.FunctionId; // Obj_Txn.AmountId = _LedgerTxn.AmountId; // Obj_Txn.DefineServiceId = _LedgerTxn.DefineServiceId; // Obj_Txn.TransectionDate = _LedgerTxn.TransectionDate; // Obj_Txn.Narration = _LedgerTxn.Narration; // Obj_Txn.LastAction = "ADD"; // Obj_Txn.LastUpdateDT = null; // Obj_Txn.AuthStatusId = "A"; // Obj_Txn.MakeDT = System.DateTime.Now; // Obj_Txn.ProductId = _LedgerTxn.ProductId; // Obj_Txn.BranchId = _LedgerTxn.BranchId; // //Add NEW PK // //if (_LedgerTxn.TransectionParentId == null) // //{ // // Obj_Txn.TransectionParentId = "0"; // //} // //else // //{ // // Obj_Txn.TransectionParentId = _LedgerTxn.TransectionParentId; // //} // result = _IUoW.Repository<LedgerTxn>().Add(Obj_Txn); // } // } // #endregion // #region Transaction // if (_LedgerTxn.PaymentAmount > 0 && _LedgerTxn.ReceiveAmount > 0) // { // LedgerMaster Obj_Master = new LedgerMaster(); // Obj_Master.AccProfileId = _LedgerTxn.FromAccProfileId; // Obj_Master.AccountTypeId = _LedgerTxn.FromAccountTypeId; // Obj_Master.SystemAccountNo = _LedgerTxn.FromSystemAccountNo; // Obj_Master.OpeningBalance = _LedgerTxn.OpeningBalance; // Obj_Master.ClosingBalance = _LedgerTxn.ClosingBalance; // Obj_Master.PaymentAmount = _LedgerTxn.PaymentAmount; // Obj_Master.ReceiveAmount = 0; // string ResultClosingBalance = OBJ_ChannelLedgerService.UpdateClosingBalance(_IUoW, Obj_Master); // var split = ResultClosingBalance.ToString().Split(':'); // result_master = Convert.ToInt32(split[0]); // _LedgerTxn.ClosingBalance = Convert.ToDecimal(split[1]); // if (result_master == 1) // { // LedgerTxn Obj_Txn = new LedgerTxn(); // Obj_Txn.BatchNo = _LedgerTxn.BatchNo; // Obj_Txn.TransectionId = _LedgerTxn.FromTransectionId; // Obj_Txn.AccProfileId = _LedgerTxn.FromAccProfileId.ToString(); // Obj_Txn.AccountTypeId = _LedgerTxn.FromAccountTypeId; // Obj_Txn.FromSystemAccountNo = _LedgerTxn.FromSystemAccountNo; // Obj_Txn.ToSystemAccountNo = _LedgerTxn.ToSystemAccountNo; // Obj_Txn.PaymentAmount = _LedgerTxn.PaymentAmount; // Obj_Txn.ReceiveAmount = 0; // Obj_Txn.CurrentBalance = _LedgerTxn.ClosingBalance; // Obj_Txn.AccountTypeId = _LedgerTxn.FromAccountTypeId; // Obj_Txn.MakeBy = _LedgerTxn.MakeBy; // Obj_Txn.FunctionId = _LedgerTxn.FunctionId; // Obj_Txn.AmountId = _LedgerTxn.AmountId; // Obj_Txn.DefineServiceId = _LedgerTxn.DefineServiceId; // Obj_Txn.TransectionDate = _LedgerTxn.TransectionDate; // Obj_Txn.Narration = _LedgerTxn.Narration; // Obj_Txn.LastAction = "ADD"; // Obj_Txn.LastUpdateDT = null; // Obj_Txn.MakeDT = System.DateTime.Now; // Obj_Txn.AuthStatusId = "A"; // Obj_Txn.ProductId = _LedgerTxn.ProductId; // Obj_Txn.BranchId = _LedgerTxn.BranchId; // //Add NEW PK // //if (_LedgerTxn.TransectionParentId == null) // //{ // // Obj_Txn.TransectionParentId = "0"; // //} // //else // //{ // // Obj_Txn.TransectionParentId = _LedgerTxn.TransectionParentId; // //} // var split_date_row1 = _LedgerTxn.TransectionDate.ToString().Split(' '); // var split_date_row1_1 = split_date_row1[0].ToString().Split('/'); // //var TransectionCode_row1 = _LedgerTxn.FromTransectionId + split_date_row1_1[2] + split_date_row1_1[1] + split_date_row1_1[0] + _LedgerTxn.BatchNo; // var TransectionCode_row1 = _LedgerTxn.FromTransectionId + split_date_row1_1[2] + split_date_row1_1[1] + split_date_row1_1[0]; // var value_row1 = Convert.ToInt64(TransectionCode_row1); // Obj_Txn.TransectionCode = String.Format("{0:X}", value_row1); // result1 = _IUoW.Repository<LedgerTxn>().Add(Obj_Txn); // LedgerMaster Obj_Master1 = new LedgerMaster(); // Obj_Master1.AccProfileId = _LedgerTxn.ToAccProfileId; // Obj_Master1.AccountTypeId = _LedgerTxn.ToAccountTypeId; // Obj_Master1.SystemAccountNo = _LedgerTxn.ToSystemAccountNo; // Obj_Master1.OpeningBalance = _LedgerTxn.OpeningBalance; // Obj_Master1.ClosingBalance = _LedgerTxn.ClosingBalance; // Obj_Master1.PaymentAmount = 0; // Obj_Master1.ReceiveAmount = _LedgerTxn.ReceiveAmount; // string ResultClosingBalance1 = OBJ_ChannelLedgerService.UpdateClosingBalance(_IUoW, Obj_Master1); // var split1 = ResultClosingBalance1.ToString().Split(':'); // result_master1 = Convert.ToInt32(split1[0]); // _LedgerTxn.ClosingBalance = Convert.ToDecimal(split1[1]); // if (result_master1 == 1) // { // LedgerTxn Obj_Txn1 = new LedgerTxn(); // Obj_Txn1.BatchNo = _LedgerTxn.BatchNo; // Obj_Txn1.TransectionId = _LedgerTxn.ToTransectionId; // Obj_Txn1.AccProfileId = _LedgerTxn.ToAccProfileId; // Obj_Txn1.AccountTypeId = _LedgerTxn.ToAccountTypeId; // Obj_Txn1.FromSystemAccountNo = _LedgerTxn.ToSystemAccountNo; // Obj_Txn1.ToSystemAccountNo = _LedgerTxn.FromSystemAccountNo; // Obj_Txn1.PaymentAmount = 0; // Obj_Txn1.ReceiveAmount = _LedgerTxn.ReceiveAmount; // Obj_Txn1.CurrentBalance = _LedgerTxn.ClosingBalance; // Obj_Txn1.AccountTypeId = _LedgerTxn.ToAccountTypeId; // Obj_Txn1.MakeBy = _LedgerTxn.MakeBy; // Obj_Txn1.FunctionId = _LedgerTxn.FunctionId; // Obj_Txn1.AmountId = _LedgerTxn.AmountId; // Obj_Txn1.DefineServiceId = _LedgerTxn.DefineServiceId; // Obj_Txn1.TransectionDate = _LedgerTxn.TransectionDate; // Obj_Txn1.Narration = _LedgerTxn.Narration; // Obj_Txn1.LastAction = "ADD"; // Obj_Txn1.LastUpdateDT = null; // Obj_Txn1.MakeDT = System.DateTime.Now; // Obj_Txn1.AuthStatusId = "A"; // Obj_Txn1.ProductId = _LedgerTxn.ProductId; // Obj_Txn1.BranchId = _LedgerTxn.BranchId; // //Add NEW PK // //if (_LedgerTxn.TransectionParentId == null) // //{ // // Obj_Txn1.TransectionParentId = "0"; // //} // //else // //{ // // Obj_Txn1.TransectionParentId = _LedgerTxn.TransectionParentId; // //} // var split_date_row2 = _LedgerTxn.TransectionDate.ToString().Split(' '); // var split_date_row2_1 = split_date_row2[0].ToString().Split('/'); // //var TransectionCode_row2 = _LedgerTxn.ToTransectionId + split_date_row2_1[2] + split_date_row2_1[1] + split_date_row2_1[0] + _LedgerTxn.BatchNo; // var TransectionCode_row2 = _LedgerTxn.ToTransectionId + split_date_row2_1[2] + split_date_row2_1[1] + split_date_row2_1[0]; // var value_row2 = Convert.ToInt64(TransectionCode_row2); // Obj_Txn1.TransectionCode = String.Format("{0:X}", value_row2); // result2 = _IUoW.Repository<LedgerTxn>().Add(Obj_Txn1); // if (result1 == 1 && result2 == 1) // { // result = 1; // } // } // } // else // return result; // } // #endregion // #region UtilityBill // if (_LedgerTxn.PaymentAmount > 0 && _LedgerTxn.FunctionId== "0006031") // { // var _LedgerMasterInfo = _IUoW.Repository<LedgerMaster>().GetBy(x => x.SystemAccountNo == _LedgerTxn.FromSystemAccountNo); // LedgerMaster Obj_Master = new LedgerMaster(); // Obj_Master.AccProfileId = _LedgerTxn.AccProfileId; // Obj_Master.AccountTypeId = _LedgerTxn.AccountTypeId; // Obj_Master.SystemAccountNo = _LedgerTxn.FromSystemAccountNo; // Obj_Master.OpeningBalance = _LedgerTxn.OpeningBalance; // Obj_Master.ClosingBalance = _LedgerTxn.ClosingBalance; // Obj_Master.PaymentAmount = _LedgerTxn.PaymentAmount; // Obj_Master.ReceiveAmount = _LedgerTxn.ReceiveAmount; // _LedgerMasterInfo.ClosingBalance= _LedgerTxn.ClosingBalance; // result = _IUoW.Repository<LedgerMaster>().Update(_LedgerMasterInfo); // if (result == 1) // { // LedgerTxn Obj_Txn = new LedgerTxn(); // var _max = _IUoW.Repository<LedgerTxn>().GetMaxValue(x => x.TransectionId) + 1; // Obj_Txn.TransectionId = _max.ToString().PadLeft(3, '0'); // Obj_Txn.BatchNo = _LedgerTxn.BatchNo; // //Obj_Txn.TransectionId = _LedgerTxn.TransectionId; // Obj_Txn.AccProfileId = _LedgerTxn.AccProfileId; // Obj_Txn.AccountTypeId = _LedgerTxn.AccountTypeId; // Obj_Txn.FromSystemAccountNo = _LedgerTxn.FromSystemAccountNo; // Obj_Txn.ToSystemAccountNo = _LedgerTxn.FromSystemAccountNo; // Obj_Txn.PaymentAmount = _LedgerTxn.PaymentAmount; // Obj_Txn.ReceiveAmount = 0; // Obj_Txn.CurrentBalance = _LedgerTxn.ClosingBalance; // Obj_Txn.AccountTypeId = _LedgerTxn.FromAccountTypeId; // Obj_Txn.MakeBy = _LedgerTxn.MakeBy; // Obj_Txn.FunctionId = _LedgerTxn.FunctionId; // Obj_Txn.AmountId = _LedgerTxn.AmountId; // Obj_Txn.DefineServiceId = _LedgerTxn.DefineServiceId; // Obj_Txn.TransectionDate = _LedgerTxn.TransectionDate; // Obj_Txn.Narration = _LedgerTxn.Narration; // //Obj_Txn.TransectionParentId = "00154"; // Obj_Txn.LastAction = "ADD"; // Obj_Txn.LastUpdateDT = System.DateTime.Now; // Obj_Txn.AuthStatusId = "A"; // Obj_Txn.MakeDT = System.DateTime.Now; // Obj_Txn.ProductId = _LedgerTxn.ProductId; // Obj_Txn.BranchId = _LedgerTxn.BranchId; // result = _IUoW.Repository<LedgerTxn>().Add(Obj_Txn); // //Add NEW PK // if (result== 1) // { // return result; // } // else // { // return 0; // } // //result = _IUoW.Repository<LedgerTxn>().Add(Obj_Txn); // } // } // #endregion // return result; // } // catch (Exception ex) // { // _ObjErrorLogService = new ErrorLogService(); // _ObjErrorLogService.AddErrorLog(ex, string.Empty, "InsertLedgerTxn(obj)", string.Empty); // } // return result; //} //#endregion //#region Update for UpdateClosingBalance //public string UpdateClosingBalance(IUnitOfWork _IUoW, LedgerMaster _LedgerMaster) //{ // int result = 0; // string ResultClosingBalance = string.Empty; // decimal OpeningBalance = _LedgerMaster.OpeningBalance; // decimal ClosingBalance = _LedgerMaster.ClosingBalance; // try // { // if (!string.IsNullOrWhiteSpace(_LedgerMaster.AccProfileId)) // { // //#region Insert a new row // //if (OpeningBalance > 0) // //{ // // _LedgerMaster.OpeningBalance = OpeningBalance; // // _LedgerMaster.ClosingBalance = ClosingBalance; // // _LedgerMaster.LastAppliedDate = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy")); // // result = _IUoW.Repository<LedgerMaster>().Add(_LedgerMaster); // //} // //#endregion // #region Update Closing Balance // //if (OpeningBalance == 0) // //{ // decimal PmtAmt = Convert.ToDecimal(_LedgerMaster.PaymentAmount); // decimal RcvAmt = Convert.ToDecimal(_LedgerMaster.ReceiveAmount); // LedgerMaster Obj_LedgerMaster = new LedgerMaster(); // Obj_LedgerMaster = _IUoW.Repository<LedgerMaster>().GetBy(x => x.AccProfileId == _LedgerMaster.AccProfileId); // OpeningBalance = Obj_LedgerMaster.OpeningBalance; // ClosingBalance = Obj_LedgerMaster.ClosingBalance; // if (PmtAmt == 0) // { // ClosingBalance = ClosingBalance + RcvAmt; // } // if (RcvAmt == 0) // { // ClosingBalance = ClosingBalance - PmtAmt; // } // if (Obj_LedgerMaster.AccProfileId != null) // { // Obj_LedgerMaster.ClosingBalance = ClosingBalance; // Obj_LedgerMaster.LastAppliedDate = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy")); // result = _IUoW.Repository<LedgerMaster>().Update(Obj_LedgerMaster); // } // //} // #endregion // } // ResultClosingBalance = result + ":" + ClosingBalance; // return ResultClosingBalance; // } // catch (Exception ex) // { // _ObjErrorLogService = new ErrorLogService(); // _ObjErrorLogService.AddErrorLog(ex, string.Empty, "UpdateClosingBalance(obj)", string.Empty); // ResultClosingBalance = result + ":" + ClosingBalance; // return ResultClosingBalance; // } //} //#endregion #region GetAllLedgerTxnByAccNoandDate public List <LedgerTxnHist> GetAllLedgerTxnByAccNoandDate(LedgerTxn _LedgerTxn) { try { //DateTime txnDate1 = Convert.ToDateTime(NCORE_COB_EOD_MAP.GetTxnDate(CHANNEL_ID)); //int result = DateTime.Compare(fromTxnDate.Date, txnDate1.Date); //int result1 = DateTime.Compare(toTxnDate.Date, txnDate1.Date); List <LedgerTxn> _ListLedgerTxn = new List <LedgerTxn>(); List <LedgerTxnHist> _ListLedgerTxnHist = new List <LedgerTxnHist>(); AccMaster obj_AccInfo_SystemAccNo = null; obj_AccInfo_SystemAccNo = _IUoW.Repository <AccMaster>().GetBy(x => x.WalletAccountNo == _LedgerTxn.WalletAccountNo && x.AuthStatusId == "A" && x.LastAction != "DEL"); if (obj_AccInfo_SystemAccNo != null) { if (_LedgerTxn.FromDate != null && _LedgerTxn.ToDate == null) //10 { //DateTime FromDate = Convert.ToDateTime(_LedgerTxn.FromDate); //FromDate = Convert.ToDateTime(FromDate.ToString("dd/MM/yyyy")); _ListLedgerTxn = (List <LedgerTxn>)_IUoW.Repository <LedgerTxn>().Get(x => x.TransectionDate >= DbFunctions.TruncateTime(_LedgerTxn.FromDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); _ListLedgerTxnHist = (List <LedgerTxnHist>)_IUoW.Repository <LedgerTxnHist>().Get(x => x.TransectionDate >= DbFunctions.TruncateTime(_LedgerTxn.FromDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); } else if (_LedgerTxn.FromDate == null && _LedgerTxn.ToDate != null) //01 { _ListLedgerTxn = (List <LedgerTxn>)_IUoW.Repository <LedgerTxn>().Get(x => x.TransectionDate <= DbFunctions.TruncateTime(_LedgerTxn.ToDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); _ListLedgerTxnHist = (List <LedgerTxnHist>)_IUoW.Repository <LedgerTxnHist>().Get(x => x.TransectionDate <= DbFunctions.TruncateTime(_LedgerTxn.ToDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); } else if (_LedgerTxn.FromDate == null && _LedgerTxn.ToDate == null) //00 { _ListLedgerTxn = (List <LedgerTxn>)_IUoW.Repository <LedgerTxn>().Get(x => x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); _ListLedgerTxnHist = (List <LedgerTxnHist>)_IUoW.Repository <LedgerTxnHist>().Get(x => x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); } else //11 { _ListLedgerTxn = (List <LedgerTxn>)_IUoW.Repository <LedgerTxn>().Get(x => x.TransectionDate >= DbFunctions.TruncateTime(_LedgerTxn.FromDate) && x.TransectionDate <= DbFunctions.TruncateTime(_LedgerTxn.ToDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); //var aaa = _IUoW.Repository<UnionInfo>().GetBy(x => x.AuthStatusId == "A" && // x.LastAction != "DEL", n => new { n.UnionId, n.UnionNm, n.UnionShortNm, n.MakeDT, n.UpazilaId }); //var bbb = _IUoW.Repository<UpazilaInfo>().GetBy(x => x.AuthStatusId == "A" && // x.LastAction != "DEL", n => new { n.UpazilaId, n.UpazilaNm }); //List<UnionInfo> OBJ_LIST_UnionInfo = aaa.Join(bbb, p => p.UpazilaId, pc => pc.UpazilaId, (p, pc) => new UnionInfo //{ // UnionId = p.UnionId, // UnionNm = p.UnionNm, // UnionShortNm = p.UnionShortNm, // UpazilaNm = pc.UpazilaNm, // UpazilaId = p.UpazilaId, // MakeDT = p.MakeDT //}).ToList(); _ListLedgerTxnHist = (List <LedgerTxnHist>)_IUoW.Repository <LedgerTxnHist>().Get(x => x.TransectionDate >= DbFunctions.TruncateTime(_LedgerTxn.FromDate) && x.TransectionDate <= DbFunctions.TruncateTime(_LedgerTxn.ToDate) && x.SystemAccountNo == obj_AccInfo_SystemAccNo.SystemAccountNo); } if (_ListLedgerTxn != null) { var Type = AutoMapperCFG.SetListMapping <LedgerTxn, LedgerTxnHist>(_ListLedgerTxn); _ListLedgerTxnHist.AddRange(Type); } //GetAccMasterInfoByAccNo(new AccMaster { SystemAccountNo = obj_AccInfo_SystemAccNo.SystemAccountNo }); } if (_ListLedgerTxnHist != null) { IAccInfoService _IAccInfoService = new AccMasterService(); var _allAccInfo = _IAccInfoService.GetAllAccInfo(); foreach (var item in _ListLedgerTxnHist) { foreach (var item1 in _allAccInfo) { if (item.SystemAccountNo == item1.SystemAccountNo) { item.WalletAccountNo = item1.WalletAccountNo; break; } } } return(_ListLedgerTxnHist.OrderByDescending(x => x.TransectionDate).ThenByDescending(x => x.BatchNo).ThenByDescending(x => x.Sl).ToList()); } return(_ListLedgerTxnHist); } catch (Exception ex) { throw ex; } }
public int AddManager(ManagerAccProfile _Manager) { try { string MonitoringId = "1"; var _max = _IUoW.Repository <ManagerAccProfile>().GetMaxValue(x => x.ManId); if (_max > 0) { _Manager.ManId = (_max + 1).ToString(); } else { _Manager.ManId = MonitoringId + (_max + 1).ToString().PadLeft(8, '0'); } _Manager.ManagerSystemAccount = Guid.NewGuid().ToString(); if (_Manager.sameAsPresent == "True") { _Manager.AuthStatusId = "A"; _Manager.LastAction = "ADD"; _Manager.MakeBy = "mTaka"; _Manager.MakeDT = System.DateTime.Now; var tempDob = Convert.ToDateTime(_Manager.ManDOB.ToShortDateString()); var tempDoj = Convert.ToDateTime(_Manager.ManDOJ.ToShortDateString()); _Manager.ManDOB = tempDob.Date; _Manager.ManDOJ = tempDoj.Date; _Manager.ManagerAccType = "005"; _Manager.ManPermanentAddress1 = _Manager.ManPresentAddress1; _Manager.ManPermanentAddress2 = _Manager.ManPresentAddress2; _Manager.ManPermanentCity = _Manager.ManPresentCity; _Manager.ManPermanentCountry = _Manager.ManPresentCountry; _Manager.ManPermanentDistrict = _Manager.ManPresentDistrict; _Manager.ManPermanentPhone = _Manager.ManPresentPhone; _Manager.ManPermanentArea = _Manager.ManPresentArea; _Manager.ManPermanentThana = _Manager.ManPresentThana; _Manager.ManagerAccStatus = "001"; } else { _Manager.AuthStatusId = "A"; _Manager.LastAction = "ADD"; _Manager.MakeBy = "mTaka"; _Manager.MakeDT = System.DateTime.Now; _Manager.ManagerAccType = "005"; } var result = _IUoW.Repository <ManagerAccProfile>().Add(_Manager); #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; _IAuthLogService.AddAuthLog(_IUoW, null, _Manager, "ADD", "0001", _Manager.FunctionId, 1, "ManagerAccProfile", "MTK_ACC_MANAGER_PROFILE", "ManId", _Manager.ManId, _Manager.UserName, _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } #endregion #region Data Store in Account Info if (result == 1) { _AccInfo = new AccMaster(); var _maxAccInfoId = _IUoW.Repository <AccMaster>().GetMaxValue(x => x.AccountId) + 1; _AccInfo.AccountId = _maxAccInfoId.ToString().PadLeft(3, '0'); //_AccInfo.AccProfileId = _Manager.ManId; _AccInfo.WalletAccountNo = _Manager.WalletAccountNo; _AccInfo.SystemAccountNo = _Manager.ManagerSystemAccount; _AccInfo.AccNm = _Manager.ManNm; _AccInfo.AccTypeId = _Manager.ManagerAccType; _AccInfo.TransDT = Convert.ToDateTime(DateTime.Now.ToShortDateString()); _AccInfo.AccountStatusId = "001"; _AccInfo.AuthStatusId = "U"; _AccInfo.LastAction = "ADD"; _AccInfo.MakeDT = System.DateTime.Now; _AccInfo.MakeBy = "mTaka"; _IUoW.Repository <AccMaster>().Add(_AccInfo); } #endregion if (result == 1) { _IUoW.Commit(); } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddManager(obj)", string.Empty); return(0); } }
public string AddFundTransfer(FundTransfer _FundTransfer) { int result = 0; _FundTransfer.TransDT = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy")); string split_result = string.Empty; string MainAuthFlag = string.Empty; AccMasterService _AccInfoService = new AccMasterService(); AccMaster _AccInfo_Post = new AccMaster(); AccMaster _AccInfo_Get = new AccMaster(); StatusWiseServiceService _StatusWiseServiceService = new StatusWiseServiceService(); StatusWiseService _StatusWiseService = new StatusWiseService(); int CheckStatusWiseService = 0; TransactionRulesService _TransactionRulesService = new TransactionRulesService(); TransactionRules _TransactionRules = new TransactionRules(); int CheckTransactionRules = 0; AccLimitSetupService _AccLimitSetupService = new AccLimitSetupService(); AccLimitSetup _AccLimitSetup = new AccLimitSetup(); string CheckAccLimit = string.Empty; try { #region Get SystemAccountNo by WalletAccountNo _AccInfo_Post.FromSystemAccountNo = _FundTransfer.FromSystemAccountNo; _AccInfo_Post.ToSystemAccountNo = _FundTransfer.ToSystemAccountNo; _AccInfo_Post.FunctionId = _FundTransfer.FunctionId; _AccInfo_Get = _AccInfoService.GetAccInfo(_AccInfo_Post); if (_AccInfo_Get == null || _AccInfo_Get.FromSystemAccountNo == null || _AccInfo_Get.ToSystemAccountNo == null) { split_result = result + ":" + "Account No. not valid.."; return(split_result); } #endregion #region Check StatusWiseService _StatusWiseService.ToSystemAccountNo = _AccInfo_Get.ToSystemAccountNo; _StatusWiseService.DefineServiceId = _FundTransfer.DefineServiceId; CheckStatusWiseService = _StatusWiseServiceService.CheckStatusWiseService(_StatusWiseService); if (CheckStatusWiseService == 0) { split_result = result + ":" + "Account No. is not active for this transaction.."; return(split_result); } #endregion #region Check TransactionRules _TransactionRules.FromSystemAccountNo = _AccInfo_Get.FromSystemAccountNo; _TransactionRules.ToSystemAccountNo = _AccInfo_Get.ToSystemAccountNo; _TransactionRules.DefineServiceId = _FundTransfer.DefineServiceId; CheckTransactionRules = _TransactionRulesService.CheckTransactionRules(_TransactionRules); if (CheckTransactionRules == 0) { split_result = result + ":" + "Transaction is not allowed.."; return(split_result); } #endregion #region Check Limit _AccLimitSetup.FromSystemAccountNo = _AccInfo_Get.FromSystemAccountNo; _AccLimitSetup.FromAccType = _AccInfo_Get.FromAccType; _AccLimitSetup.ToSystemAccountNo = _AccInfo_Get.ToSystemAccountNo; _AccLimitSetup.ToAccType = _AccInfo_Get.ToAccType; _AccLimitSetup.DefineServiceId = _FundTransfer.DefineServiceId; _AccLimitSetup.Amount = _FundTransfer.Amount; _AccLimitSetup.TransDT = _FundTransfer.TransDT; CheckAccLimit = _AccLimitSetupService.CheckAccLimit(_AccLimitSetup); if (CheckAccLimit != "true") { split_result = result + ":" + CheckAccLimit; return(split_result); } #endregion if (_AccInfo_Get.FromSystemAccountNo != null && _AccInfo_Get.ToSystemAccountNo != null && CheckStatusWiseService != 0 && CheckTransactionRules != 0 && CheckAccLimit == "true") { var _max = _IUoW.Repository <FundTransfer>().GetMaxValue(x => x.FundTransferId) + 1; _FundTransfer.FundTransferId = _max.ToString().PadLeft(9, '0'); _FundTransfer.AuthStatusId = "U"; _FundTransfer.LastAction = "ADD"; _FundTransfer.MakeDT = System.DateTime.Now; _FundTransfer.MakeBy = "prova"; _FundTransfer.FromSystemAccountNo = _AccInfo_Get.FromSystemAccountNo; _FundTransfer.ToSystemAccountNo = _AccInfo_Get.ToSystemAccountNo; result = _IUoW.Repository <FundTransfer>().Add(_FundTransfer); #region Auth Log if (result == 1) { string url = ConfigurationManager.AppSettings["LgurdaService_server"] + "/GetAuthPermissionByFunctionId/" + _FundTransfer.FunctionId + "/" + _FundTransfer.FunctionName + "?format=json"; using (WebClient wc = new WebClient()) { TransactionRules OBJ_TransactionRules = new TransactionRules(); var json = wc.DownloadString(url); OBJ_TransactionRules = JsonConvert.DeserializeObject <TransactionRules>(json); MainAuthFlag = OBJ_TransactionRules.GetAuthPermissionByFunctionIdResult; } if (MainAuthFlag == "1") { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; result = _IAuthLogService.AddAuthLog(_IUoW, null, _FundTransfer, "ADD", "0001", _FundTransfer.FunctionId, 1, "FundTransfer", "MTK_TRN_FUND_TRANSFER", "FundTransferId", _FundTransfer.FundTransferId, "prova", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } if (MainAuthFlag == "0") { _IAuthLogService = new AuthLogService(); FTAuthLog _ObjAuthLog = new FTAuthLog(); _ObjAuthLog.TableNm = "MTK_TRN_FUND_TRANSFER"; _ObjAuthLog.AuthStatusId = "A"; _ObjAuthLog.LastAction = "ADD"; _ObjAuthLog.FunctionId = _FundTransfer.FunctionId; _ObjAuthLog.TablePkColVal = _FundTransfer.FundTransferId; result = _IAuthLogService.SetTableObject_FT <FundTransfer>(_IUoW, _ObjAuthLog, _FundTransfer); } } #endregion if (result == 1) { _IUoW.Commit(); split_result = result + ":" + "Saved Successfully"; } else { split_result = result + ":" + "information hasn't been added"; } } } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddFundTransfer(obj)", string.Empty); split_result = result + ":" + ""; } return(split_result); }