Beispiel #1
0
        // merge employee accounts
        public bool Approve_Unit_Merge(Remit_Unit_TransferRepo Unit_TransferRepo)
        {
            var app = new AppSettings();

            // get the pending purchase record
            Unit_TransferRepo.GetPendingUTList(Unit_TransferRepo);

            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
                {
                    DynamicParameters param = new DynamicParameters();

                    param.Add(name: "P_FROM_ESF_ID", value: Unit_TransferRepo.From_ESF_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                    param.Add(name: "P_TO_ESF_ID", value: Unit_TransferRepo.To_ESF_Id, 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.Date, direction: ParameterDirection.Input);
                    param.Add(name: "P_REASON_TRANSFER", value: Unit_TransferRepo.Reason_Transfer, dbType: DbType.String, direction: ParameterDirection.Input);
                    param.Add(name: "P_FROM_NAME", value: Unit_TransferRepo.From_Surname + " " + Unit_TransferRepo.From_First_Name, dbType: DbType.String, direction: ParameterDirection.Input);
                    param.Add(name: "P_TO_NAME", value: Unit_TransferRepo.To_Surname + " " + Unit_TransferRepo.To_First_Name, dbType: DbType.String, direction: ParameterDirection.Input);
                    conn.Execute("ADD_REMIT_UNIT_MERGE_EMP", param, commandType: CommandType.StoredProcedure);



                    ts.Complete();

                    return(true);
                }
                catch (Exception ex)
                {
                    string xx = ex.ToString();
                    throw;
                }
                finally
                {
                    ts.Dispose();
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
        }
Beispiel #2
0
        public bool Approve_Unit_Transfer(Remit_Unit_TransferRepo Unit_TransferRepo)
        {
            var app = new AppSettings();

            // get the pending purchase record
            Unit_TransferRepo.GetPendingUTList(Unit_TransferRepo);

            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 remit_unit_transfer table
                    DynamicParameters param = new DynamicParameters();
                    param.Add(name: "P_TID", value: TID, dbType: DbType.String, direction: ParameterDirection.Input);
                    param.Add(name: "P_REC_STATUS", value: "ACTIVE", dbType: DbType.String, direction: ParameterDirection.Input);
                    param.Add(name: "P_AUTH_STATUS", value: "AUTHORIZED", 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_REMIT_UNIT_TRANSFER", param, commandType: CommandType.StoredProcedure);


                    //Update remit_unit_purchase_trans table
                    DynamicParameters param_conl = new DynamicParameters();
                    param_conl.Add(name: "P_PURCHASE_LOG_ID", value: Purchase_Log_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                    param_conl.Add(name: "P_PURCHASE_TYPE", value: Purchase_Type, dbType: DbType.String, direction: ParameterDirection.Input);
                    param_conl.Add(name: "P_FROM_ESF_ID", value: From_ESF_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                    param_conl.Add(name: "P_TO_ESF_ID", value: To_ESF_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                    param_conl.Add(name: "P_EMPLOYER_AMT", value: Unit_TransferRepo.Employer_Amt, dbType: DbType.Decimal, direction: ParameterDirection.Input);
                    param_conl.Add(name: "P_EMPLOYEE_AMT", value: Unit_TransferRepo.Employee_Amt, dbType: DbType.Decimal, direction: ParameterDirection.Input);
                    conn.Execute("UPD_REMIT_UNIT_PUR_TRANS_UT", param_conl, commandType: CommandType.StoredProcedure);


                    //Update Employee_Scheme_Fund table
                    DynamicParameters param_cash = new DynamicParameters();
                    param_cash.Add(name: "P_FROM_ESF_ID", value: From_ESF_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                    param_cash.Add(name: "P_TO_ESF_ID", value: To_ESF_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                    param_cash.Add(name: "P_EMPLOYER_AMT", value: Unit_TransferRepo.Employer_Amt, dbType: DbType.Decimal, direction: ParameterDirection.Input);
                    param_cash.Add(name: "P_EMPLOYEE_AMT", value: Unit_TransferRepo.Employee_Amt, dbType: DbType.Decimal, direction: ParameterDirection.Input);
                    param_cash.Add(name: "P_EMPLOYER_UNITS", value: Unit_TransferRepo.Employer_Units, dbType: DbType.Decimal, direction: ParameterDirection.Input);
                    param_cash.Add(name: "P_EMPLOYEE_UNITS", value: Unit_TransferRepo.Employee_Units, dbType: DbType.Decimal, direction: ParameterDirection.Input);
                    conn.Execute("UPD_REMIT_ESF_TRANSFER", param_cash, commandType: CommandType.StoredProcedure);


                    ts.Complete();

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