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); }
//#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 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; } }
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); }