public void SaveRecord(GLInitialRepo GLRepo) { try { //Get connectoin var app = new AppSettings(); con = app.GetConnection(); var param = new DynamicParameters(); param.Add(name: "P_TRANS_DATE", value: GLRepo.Trans_Date, dbType: DbType.DateTime, direction: ParameterDirection.Input); param.Add(name: "P_AMOUNT", value: GLRepo.Amount, dbType: DbType.Decimal, direction: ParameterDirection.Input); param.Add(name: "P_SF_ID", value: GLRepo.Scheme_Fund_Id, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_GL_ACCOUNT_NO", value: GLRepo.Gl_Account_No, dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_REC_STATUS", value: "PENDING", dbType: DbType.String, direction: ParameterDirection.Input); param.Add(name: "P_TRANS_TYPE", value: GLRepo.Trans_Type, 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_INITIAL", 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_Initial(GLInitialRepo 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_REC_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_INITIAL", param, commandType: CommandType.StoredProcedure); //UPDATE GL_ACCOUNT TABLE AND GL_TRANSACTION TABLE DynamicParameters param_gl = new DynamicParameters(); param_gl.Add(name: "P_GL_ACCOUNT_NO", value: GLRepo.Gl_Account_No, dbType: DbType.String, direction: ParameterDirection.Input); param_gl.Add(name: "P_TRANS_TYPE", value: GLRepo.Trans_Type, 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_SF", value: GLRepo.Scheme_Fund_Id, 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: GLRepo.Trans_Date, dbType: DbType.DateTime, direction: ParameterDirection.Input); conn.Execute("REV_INITIAL_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(); } } } }