public bool Disapprove_Journal(GLJournalRepo GLRepo) { var app = new AppSettings(); // get the pending purchase record GLRepo.GetJournalPendingList(TID); TransactionOptions tsOp = new TransactionOptions(); tsOp.IsolationLevel = System.Transactions.IsolationLevel.Snapshot; TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, tsOp); tsOp.Timeout = TimeSpan.FromMinutes(20); using (OracleConnection conn = new OracleConnection(app.conString())) // { try { // UPDATE GL_JOURNAL_LOG TABLE DynamicParameters param = new DynamicParameters(); param.Add(name: "P_TID", value: TID, dbType: DbType.Decimal, direction: ParameterDirection.Input); param.Add(name: "P_JOURNAL_STATUS", value: "DISAPPROVED", dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_AUTH_STATUS", value: "DISAPPROVED", dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_AUTH_ID", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_AUTH_DATE", value: GlobalValue.Scheme_Today_Date, dbType: DbType.Date, direction: ParameterDirection.Input); conn.Execute("APP_JOURNAL", param, commandType: CommandType.StoredProcedure); ts.Complete(); return(true); } catch (Exception ex) { string xx = ex.ToString(); throw; } finally { ts.Dispose(); if (con.State == ConnectionState.Open) { conn.Close(); } } } }
//GET GL DEBIT ACCOUNT BALANCE FROM GL ACCOUNT TABLE public void Get_Balance(GLJournalRepo GLRepo) { try { //Get connection var con = new AppSettings(); var param = new DynamicParameters(); param.Add("P_DEBIT_GL_NO", GLRepo.Debit_Gl_No, DbType.String, ParameterDirection.Input); param.Add("VDATA", null, DbType.Decimal, ParameterDirection.Output); con.GetConnection().Execute("SEL_GL_DEBITBALANCE", param, commandType: CommandType.StoredProcedure); GLRepo.Debit_Gl_Balance = param.Get <decimal>("VDATA"); } catch (Exception ex) { throw ex; } }
public void SaveRecord(GLJournalRepo GLJournal) { try { //Get connectoin var app = new AppSettings(); con = app.GetConnection(); var param = new DynamicParameters(); param.Add(name: "P_TRANS_DATE", value: GLJournal.Trans_Date, dbType: DbType.DateTime, direction: ParameterDirection.Input); param.Add(name: "P_AMOUNT", value: GLJournal.Amount, dbType: DbType.Decimal, direction: ParameterDirection.Input); param.Add(name: "P_SF_ID", value: GLJournal.Scheme_Fund_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_DEBIT_GL_NO", value: GLJournal.Debit_Gl_No, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_CREDIT_GL_NO", value: GLJournal.Credit_Gl_No, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_JOURNAL_STATUS", value: "PENDING", dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_TRANS_TYPE", value: GLJournal.Trans_Type, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_NARRATION", value: GLJournal.Narration, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_MAKER_ID", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_MAKE_DATE", value: GlobalValue.Scheme_Today_Date, dbType: DbType.DateTime, direction: ParameterDirection.Input); int result = con.Execute(sql: "ADD_JOURNAL", param: param, commandType: CommandType.StoredProcedure); } catch (Exception ex) { throw ex; } finally { if (con.State == ConnectionState.Open) { con.Close(); if (con != null) { con = null; } } } }
public bool Reverse_Journal(GLJournalRepo GLRepo) { var app = new AppSettings(); // get the pending purchase record GLRepo.GetJournalPendingList(TID); TransactionOptions tsOp = new TransactionOptions(); tsOp.IsolationLevel = System.Transactions.IsolationLevel.Snapshot; TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, tsOp); tsOp.Timeout = TimeSpan.FromMinutes(20); using (OracleConnection conn = new OracleConnection(app.conString())) // { try { // UPDATE GL_JOURNAL_LOG TABLE DynamicParameters param = new DynamicParameters(); param.Add(name: "P_TID", value: TID, dbType: DbType.Decimal, direction: ParameterDirection.Input); param.Add(name: "P_JOURNAL_STATUS", value: "REVERSED", dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_AUTH_STATUS", value: "AUTHORIZED", dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_REVERSAL_REASON", value: Reversal_Reason, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_REVERSAL_ID", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_REVERSAL_DATE", value: GlobalValue.Scheme_Today_Date, dbType: DbType.Date, direction: ParameterDirection.Input); conn.Execute("REV_JOURNAL", param, commandType: CommandType.StoredProcedure); //UPDATE GL_ACCOUNT TABLE AND GL_TRANSACTION TABLE DynamicParameters param_gl = new DynamicParameters(); param_gl.Add(name: "P_DEBIT_NO", value: GLRepo.Debit_Gl_No, dbType: DbType.String, direction: ParameterDirection.Input); param_gl.Add(name: "P_CREDIT_NO", value: GLRepo.Credit_Gl_No, dbType: DbType.String, direction: ParameterDirection.Input); param_gl.Add(name: "P_AMOUNT", value: GLRepo.Amount, dbType: DbType.Decimal, direction: ParameterDirection.Input); param_gl.Add(name: "P_NARRATION", value: GLRepo.Narration, dbType: DbType.String, direction: ParameterDirection.Input); param_gl.Add(name: "P_TID", value: GLRepo.TID, dbType: DbType.Decimal, direction: ParameterDirection.Input); param_gl.Add(name: "P_AUTH_ID", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input); param_gl.Add(name: "P_AUTH_DATE", value: GlobalValue.Scheme_Today_Date, dbType: DbType.DateTime, direction: ParameterDirection.Input); param_gl.Add(name: "P_TRANS_DATE", value: GlobalValue.Scheme_Today_Date, dbType: DbType.DateTime, direction: ParameterDirection.Input); param_gl.Add(name: "P_SCHEMEFUND", value: GLRepo.Scheme_Fund_Id, dbType: DbType.String, direction: ParameterDirection.Input); conn.Execute("REV_JOURNAL_GL_TRANS", param_gl, commandType: CommandType.StoredProcedure); ts.Complete(); return(true); } catch (Exception ex) { string xx = ex.ToString(); throw; } finally { ts.Dispose(); if (con.State == ConnectionState.Open) { conn.Close(); } } } }