Example #1
0
        public void GetSystemDate(EndOfYearRepo EOYRepo)
        {
            var app = new AppSettings();

            using (OracleConnection conp = new OracleConnection(app.conString()))
            {
                try
                {
                    //Get connection
                    var con   = new AppSettings();
                    var param = new DynamicParameters();
                    param.Add("P_DATE_NOW", "", DbType.Date, ParameterDirection.Output);
                    con.GetConnection().Execute("SEL_DATE_NOW", param, commandType: CommandType.StoredProcedure);
                    EOYRepo.System_Date = param.Get <DateTime>("P_DATE_NOW");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (conp.State == ConnectionState.Open)
                    {
                        conp.Close();
                        conp.Dispose();
                    }
                }
            }
        }
Example #2
0
        public void GetSchemeList(EndOfYearRepo EOYRepo)
        {
            var app = new AppSettings();

            using (OracleConnection conp = new OracleConnection(app.conString()))
            {
                try
                {
                    //Get connection
                    var con   = new AppSettings();
                    var param = new DynamicParameters();
                    param.Add("P_SCHEME_ID", EOYRepo.Scheme_Id, DbType.String, ParameterDirection.Input);
                    param.Add("VDATA", "", DbType.String, ParameterDirection.Output);
                    con.GetConnection().Execute("SEL_SCHEME_NAME", param, commandType: CommandType.StoredProcedure);
                    EOYRepo.Scheme_Name = param.Get <string>("VDATA");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    if (conp.State == ConnectionState.Open)
                    {
                        conp.Close();
                        conp.Dispose();
                    }
                }
            }
        }
Example #3
0
        public bool RunEOD(EndOfYearRepo EOYRepo)
        {
            var app = new AppSettings();


            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
                {
                    // check for pending transactions
                    //Remittance
                    var paramR = new DynamicParameters();
                    paramR.Add("P_SCHEME_ID", Scheme_Id, DbType.String, ParameterDirection.Input);
                    paramR.Add("VDATA", null, DbType.Int32, ParameterDirection.Output);
                    conn.Execute("EOD_PENDING_REMITTANCE", paramR, commandType: CommandType.StoredProcedure);
                    int paramoption = paramR.Get <int>("VDATA");
                    if (paramoption > 0)
                    {
                        return(false);
                    }

                    //Payment
                    var paramRe = new DynamicParameters();
                    paramRe.Add("P_SCHEME_ID", Scheme_Id, DbType.String, ParameterDirection.Input);
                    paramRe.Add("VDATA", null, DbType.Int32, ParameterDirection.Output);
                    conn.Execute("EOD_PENDING_PAYMENT", paramRe, commandType: CommandType.StoredProcedure);
                    int receipt = paramRe.Get <int>("VDATA");
                    if (receipt > 0)
                    {
                        return(false);
                    }

                    //Purchases
                    var paramPu = new DynamicParameters();
                    paramPu.Add("P_SCHEME_ID", Scheme_Id, DbType.String, ParameterDirection.Input);
                    paramPu.Add("VDATA", null, DbType.Int32, ParameterDirection.Output);
                    conn.Execute("EOD_PENDING_PURCHASE", paramPu, commandType: CommandType.StoredProcedure);
                    int purchase = paramPu.Get <int>("VDATA");
                    if (receipt > 0)
                    {
                        return(false);
                    }

                    // GL(Journal)

                    //check for securities maturity

                    //Apply investment interest

                    // Apply surchage on contribution due for surchage
                    DynamicParameters param = new DynamicParameters();
                    param.Add(name: "P_SCHEME_ID", value: Scheme_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                    conn.Execute("EOD_SURCHARGE_CON_LOG", param, commandType: CommandType.StoredProcedure);


                    //VALUATE ASSET

                    //ACCRUE FEES BEFORE NAV

                    // ACCRUE FEES AFTER NAV

                    //calculate unit price


                    // move today date to next date
                    DynamicParameters parama = new DynamicParameters();
                    parama.Add(name: "P_SCHEME_ID", value: Scheme_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                    conn.Execute("EOD_NEXT_DATE", parama, commandType: CommandType.StoredProcedure);

                    // log unit price

                    ts.Complete();

                    return(true);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    ts.Dispose();
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
        }