public bool closeOnBehalfClientTransaction(int TRANS_ID, int CURRENT_USR_ACCT_IND) { try { var getTrans = getOnBehalfClientTransaction(TRANS_ID); var getAcct = db.TACCT.Find(CURRENT_USR_ACCT_IND); if (getTrans == null || getAcct == null) { return(false); } getTrans.TRANS_SCD = "1"; db.Entry(getTrans).State = EntityState.Modified; decimal newBal = getAcct.ACCT_BAL + getTrans.CMSN_AMT; getAcct.ACCT_BAL = newBal; db.Entry(getAcct).State = EntityState.Modified; var acctHist = new AccountHistory(); string TRANS_PAY_SRC_CD = "2"; string TRANS_SRVC_TCD = "01"; string fromTRANS_DESC = "ThirdParty Transfer/Transfert Tiers Commission"; var acctHistory = acctHist.insertAccountHistory(getAcct.ACCT_ID, "1", TRANS_PAY_SRC_CD, TRANS_SRVC_TCD, newBal, getTrans.CMSN_AMT, fromTRANS_DESC); db.TACCT_HIST.Add(acctHistory); //save all db.SaveChanges(); return(true); } catch { return(false); } }
public AccountHistory insertAccountHistory(int ACCT_ID, string TRANS_TCD, string TRANS_PAY_SRC_CD, string TRANS_SRVC_TCD, decimal BAL_AFTR_TRANS, decimal TRANS_AMT, string TRANS_DESC) { try { var obj = new AccountHistory(); obj.ACCT_ID = ACCT_ID; obj.TRANS_TCD = TRANS_TCD; obj.TRANS_PAY_SRC_CD = TRANS_PAY_SRC_CD; obj.TRANS_SRVC_TCD = TRANS_SRVC_TCD; obj.BAL_AFTR_TRANS = BAL_AFTR_TRANS; obj.TRANS_AMT = TRANS_AMT; obj.TRANS_DESC = TRANS_DESC; return(obj); } catch { return(null); } }