コード例 #1
0
ファイル: Y_022.cs プロジェクト: AakanxuShah/SecureBankSystem
 private int processTransaction(string connectionString, String acc_no, Int32 initPvg, String loginAc)
 {
     tx = new Cp_Txnm(connectionString, TXID, dberr);
     // Check if TXNM fetch for transaction type "010" is successful. Return if error encountered
     if (dberr.ifError())
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     //Check if it is a Banker initiated transaction
     if (Validation.employeeInitiatedTxn(connectionString, loginAc) == 0)
     {
         this.newInitiator = true;
     }
     if (this.newInitiator)
     {
         //Check if Customer is Active (Enabled)
         if (!Validation.isActiveCustomerUsingAcc(connectionString, acc_no))
         {
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
     }
     else
     {
         //Check if Customer is Active (Enabled)
         if (!Validation.isActiveCustomer(connectionString, loginAc))
         {
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
         //Check if logged user is a Merchant
         if (Validation.isMerchant(connectionString, loginAc))
         {
             //CHANGED 1103
             /*if (Validation.validateCustomerSelfAccount(connectionString, loginAc, acc_no) != 0)
             {
                 dberr.setError(Mnemonics.DbErrorCodes.TXERR_INTERNAL_TFR_EMP_FROM_TO_ACC_DIFF_CUS);
                 resultP = dberr.getErrorDesc(connectionString);
                 return -1;
             }*/
         }
         else
         {
             //To account should NOT belong to the logged in customer
             if (Validation.validateCustomerSelfAccount(connectionString, loginAc, acc_no) == 0)
             {
                 dberr.setError(Mnemonics.DbErrorCodes.TXERR_INTERNAL_TFR_EMP_FROM_TO_ACC_DIFF_CUS);
                 resultP = dberr.getErrorDesc(connectionString);
                 return -1;
             }
         }
     }
     String initEmpNumber = "0";
     String initCustomer = "0";
     if (this.newInitiator)
     {
         initEmpNumber = loginAc;
         Cp_Empm cpEmpm = new Cp_Empm(connectionString, loginAc, dberr);
         pvg = new Privilege(tx.txnmP.tran_pvga, tx.txnmP.tran_pvgb, cpEmpm.empmP.emp_pvg);
     }
     else
     {
         //this.acct = this.acct;
         initCustomer = loginAc; // this.acct_init.actmP.cs_no1;
         Cp_Actm cpActm = new Cp_Actm(connectionString, acc_no, dberr);
         pvg = new Privilege(tx.txnmP.tran_pvga, tx.txnmP.tran_pvgb, cpActm.actmP.ac_pvg);
     }
     if (!pvg.verifyInitPrivilege(dberr))
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     if (!pvg.verifyApprovePrivilege())
     {
         String inData = this.TXID + "|" + acc_no + "| |" + this.changeAmount.ToString();
         if (pvg.writeToPendingTxns(
             connectionString,               /* connection string */
             acc_no,                         /* account 1 */
             "0",                            /* account 2 */
             initCustomer,                   /* customer number */
             tx.txnmP.tran_pvgb.ToString(),  /* transaction approve privilege */
             tx.txnmP.tran_desc,             /* transaction description */
             initEmpNumber,                  /* initiating employee number */
             0,                              /* debit amount */
             this.changeAmount,              /* credit amount */
             tx.txnmP.tran_id,               /* transaction id (not tran code) */
             inData,                         /* incoming transaction string in XSwitch */
             dberr                           /* error tracking object */
             ) != 0)
         {
             resultP = dberr.getErrorDesc(connectionString);
             error = true;
             return -1;
         }
         resultP = Mnemonics.DbErrorCodes.MSG_SENT_FOR_AUTH;
         error = true;
         return 0;
     }
     //}
     else
     {
         this.pvgBypassedP = true;
     }
     // Update new balance in ACTM
     acct = new Cp_Actm(connectionString, acc_no, dberr);
     acct.addBalance(connectionString, this.changeAmount, dberr);
     if (dberr.ifError())
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     if (!this.TXID.Equals(Mnemonics.TxnCodes.TX_TRANSFER_CREDIT))
     {
         acct.updateBalance(connectionString, dberr);
         //acct.addBalance(connectionString, this.changeAmount, dberr);
         if (dberr.ifError())
         {
             result = dberr.getErrorDesc(connectionString);
             return -1;
         }
         // Store transaction in hisory table. Determine which history table to store in based on tx.txnmP.tran_fin_type
         if (tx.txnmP.tran_fin_type.Equals("Y"))
         {
             // Write to FINHIST table
             Entity.Finhist fhist = new Entity.Finhist(acc_no, "0", this.tx.txnmP.tran_desc,
                 changeAmount, 0, Convert.ToString(this.acct.actmP.ac_bal), "0", "0", "0");
             Data.FinhistD.Create(connectionString, fhist, dberr);
         }
         else
         {
             // Write to NFINHIST table
             Entity.Nfinhist nFhist = new Entity.Nfinhist(acc_no, "0", this.tx.txnmP.tran_desc, "0", "0", this.acct.actmP.cs_no1);
             Data.NfinhistD.Create(connectionString, nFhist, dberr);
         }
         if (dberr.ifError())
         {
             result = dberr.getErrorDesc(connectionString);
             return -1;
         }
         Entity.Cstm cstm = Data.CstmD.Read(connectionString, acct.actmP.cs_no1, dberr);
         if (dberr.ifError())
         {
             result = dberr.getErrorDesc(connectionString);
             return -1;
         }
         String mailResponse = "";
         if (!Security.OTPUtility.SendMail("SBS", "*****@*****.**", cstm.cs_fname + cstm.cs_mname + cstm.cs_lname,
             cstm.cs_email, "Update from SBS", tx.txnmP.tran_desc + acct.actmP.ac_bal))
         {
             mailResponse = "Mail sent.";
         }
         // -----------------------------------------
         resultP = "Transaction Successful. Your new account balance is $" + acct.actmP.ac_bal + " " + mailResponse;
     }
     //-------------------------------------------
     return 0; // remove later
 }
コード例 #2
0
ファイル: Y_030.cs プロジェクト: AakanxuShah/SecureBankSystem
 private int processTransaction(string connectionString, String ac1, String ac2, Decimal amount, String loginAc)
 {
     tx = new Cp_Txnm(connectionString, TXID, dberr);
     // Check if TXNM fetch for transaction type "010" is successful. Return if error encountered
     if (dberr.ifError())
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     //Check if it is a Banker initiated transaction
     if(Validation.employeeInitiatedTxn(connectionString, loginAc)==0)
     {
         this.newInitiator = true;
     }
     //From account and To account cannot be the same
     if(Validation.validateFromToAccSame(ac1, ac2)!=0)
     {
         dberr.setError(Mnemonics.DbErrorCodes.TXERR_FROM_TO_AC_SAME);
         resultP = dberr.getErrorDesc(connectionString);
         return -1;
     }
     //Validations if Banker processes the txn
     if (this.newInitiator)
     {
         //From Account and To Account should NOT belong to the same customer
         if (Validation.accountsBelongToSameCus(connectionString, ac1, ac2) == 0)
         {
             dberr.setError(Mnemonics.DbErrorCodes.TXERR_INTERNAL_TFR_EMP_FROM_TO_ACC_DIFF_CUS);
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
         //Check if from Customer is Active (Enabled)
         if (!Validation.isActiveCustomerUsingAcc(connectionString, ac1))
         {
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
         //Check if to Customer is Active (Enabled)
         if (!Validation.isActiveCustomerUsingAcc(connectionString, ac2))
         {
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
     }
     //Validations if customer processes the transaction.
     else
     {
         if (Validation.isMerchant(connectionString, loginAc))
         {
             //From account should belong to the Merchant
             if (Validation.validateCustomerSelfAccount(connectionString, loginAc, ac1) != 0)
             {
                 dberr.setError(Mnemonics.DbErrorCodes.TXERR_INTERNAL_TFR_EMP_FROM_TO_ACC_DIFF_CUS);
                 resultP = dberr.getErrorDesc(connectionString);
                 return -1;
             }
             //To account should NOT belong to the merchant
             if (Validation.validateCustomerSelfAccount(connectionString, loginAc, ac2) == 0)
             {
                 dberr.setError(Mnemonics.DbErrorCodes.TXERR_EXTERNAL_TFR_EMP_TO_ACC_SAME_CUS);
                 resultP = dberr.getErrorDesc(connectionString);
                 return -1;
             }
         }
         else
         {
             //From account must belong the customer who has logged in
             if (Validation.validateCustomerSelfAccount(connectionString, loginAc, ac1) != 0)
             {
                 dberr.setError(Mnemonics.DbErrorCodes.TXERR_INTERNAL_TFR_FROM_DIFF_CUS);
                 resultP = dberr.getErrorDesc(connectionString);
                 return -1;
             }
             //To account must NOT belong to the logged in customer
             if (Validation.validateCustomerSelfAccount(connectionString, loginAc, ac2) == 0)
             {
                 dberr.setError(Mnemonics.DbErrorCodes.TXERR_EXTERNAL_TFR_EMP_TO_ACC_SAME_CUS);
                 resultP = dberr.getErrorDesc(connectionString);
                 return -1;
             }
         }
     }
     String initEmpNumber = "0";
     String initCustomer = "0";
     if (this.newInitiator)
     {
         initEmpNumber = loginAc;
         Cp_Empm cpEmpm = new Cp_Empm(connectionString, loginAc, dberr);
         pvg = new Privilege(tx.txnmP.tran_pvga, tx.txnmP.tran_pvgb, cpEmpm.empmP.emp_pvg);
     }
     else
     {
         //this.acct_init = this.acct1;
         initCustomer = loginAc; // this.acct_init.actmP.cs_no1;
         Cp_Actm cpActm = new Cp_Actm(connectionString, ac1, dberr);
         pvg = new Privilege(tx.txnmP.tran_pvga, tx.txnmP.tran_pvgb, cpActm.actmP.ac_pvg);
     }
     // Verify if account has the privilege to execute the transaction
     //pvg = new Privilege(tx.txnmP.tran_pvga, tx.txnmP.tran_pvgb, acct_init.actmP.ac_pvg);
     if (!pvg.verifyInitPrivilege(dberr))
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     if (!pvg.verifyApprovePrivilege())
     {
         String inData = this.TXID + "|" + ac1 + "|" + ac2 + "|" + this.changeAmount.ToString();
         if (pvg.writeToPendingTxns(
             connectionString,               /* connection string */
             ac1,                            /* account 1 */
             ac2,                            /* account 2 */
             initCustomer,                   /* initiating customer number */
             tx.txnmP.tran_pvgb.ToString(),  /* transaction approve privilege */
             tx.txnmP.tran_desc,             /* transaction description */
             initEmpNumber,                  /* initiating employee number */
             this.changeAmount,              /* debit amount */
             0,                              /* credit amount */
             tx.txnmP.tran_id,               /* transaction id (not tran code) */
             inData,                         /* incoming transaction string in XSwitch */
             dberr                           /* error tracking object */
             ) != 0)
         {
             resultP = dberr.getErrorDesc(connectionString);
             error = true;
             return -1;
         }
         resultP = Mnemonics.DbErrorCodes.MSG_SENT_FOR_AUTH;
         error = true;
         return 0;
     }
     else
     {
         this.pvgBypassedP = true;
     }
     resultP = "Transaction Processed!";
     
     return 0; // remove later
 }
コード例 #3
0
ファイル: Y_010.cs プロジェクト: AakanxuShah/SecureBankSystem
 public DataSet fetchMultipleAccounts(String connectionString, String cusno)
 {
     Cp_Actm ac = new Cp_Actm();
     this.resultSet = ac.fetchAccountsFromCusNo(connectionString, cusno, this.tx.txnmP.tran_pvga, dberr);
     if (dberr.ifError())
     {
         result = dberr.getErrorDesc(connectionString);
         errorBoolP = true;
         return (new DataSet(result));
     }
     if (this.resultSet == null)
     {
         dberr.setError(Mnemonics.DbErrorCodes.TXERR_NO_USER);
         result = dberr.getErrorDesc(connectionString);
         errorBoolP = true;
         return (new DataSet(result));
     }
     return resultSet;
 }
コード例 #4
0
ファイル: Y_010.cs プロジェクト: AakanxuShah/SecureBankSystem
 private int processTransaction(string connectionString, String acc_no, Data.Dber dberr)
 {
     tx = new Cp_Txnm(connectionString, TXID, dberr);
     // Check if TXNM fetch for transaction type "010" is successful. Return if error encountered
     if (dberr.ifError())
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     acct = new Cp_Actm(connectionString, acc_no, dberr);
     // Check if ACTM fetch for account number acc_no is successful. Return if error encountered
     if (dberr.ifError())
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     // Verify if account has the privilege to execute the transaction
     pvg = new Privilege(tx.txnmP.tran_pvga, tx.txnmP.tran_pvgb, acct.actmP.ac_pvg);
     if(!pvg.verifyInitPrivilege(dberr))
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     if (!pvg.verifyApprovePrivilege())
     {
         String inData = this.TXID + "|" + acct.actmP.ac_no;
         if (pvg.writeToPendingTxns(connectionString, acct.actmP.ac_no, "0", acct.actmP.cs_no1, tx.txnmP.tran_pvgb.ToString(),
             tx.txnmP.tran_desc, "0", 0, 0, tx.txnmP.tran_id, inData, dberr) != 0)
         {
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
         resultP = Mnemonics.DbErrorCodes.MSG_SENT_FOR_AUTH;
         return 0;
     }
     // Store transaction in hisory table. Determine which history table to store in based on tx.txnmP.tran_fin_type
     if (tx.txnmP.tran_fin_type.Equals("Y"))
     {
         // Write to FINHIST table
         Entity.Finhist fhist = new Entity.Finhist(this.acct.actmP.ac_no, "0", this.tx.txnmP.tran_desc,
             0, 0, Convert.ToString(this.acct.actmP.ac_bal), "0", "0","0");
         Data.FinhistD.Create(connectionString, fhist, dberr);
     }
     else
     {
         // Write to NFINHIST table
         Entity.Nfinhist nFhist = new Entity.Nfinhist(this.acct.actmP.ac_no, "0", this.tx.txnmP.tran_desc, "0", "0","0");
         Data.NfinhistD.Create(connectionString, nFhist, dberr);
     }
     resultP = Convert.ToString(acct.actmP.ac_bal - acct.actmP.ac_hold);
     return 0;
 }
コード例 #5
0
ファイル: Y_025.cs プロジェクト: AakanxuShah/SecureBankSystem
        private int processTransaction(String connectionString, String loginAc, String acType, 
            String dummyAc, String dummyAccess, String refno, Data.Dber dberr)
        {
            tx = new Cp_Txnm(connectionString, TXID, dberr);
            // Check if TXNM fetch for transaction type "010" is successful. Return if error encountered
            if (dberr.ifError())
            {
                result = dberr.getErrorDesc(connectionString);
                return -1;
            }
            cstm = Data.CstmD.Read(connectionString, loginAc, dberr);
            if (dberr.ifError())
            {
                dberr = new Data.Dber();
                empm = Data.EmpmD.Read(connectionString, loginAc, dberr);
                if (dberr.ifError())
                {
                    result = dberr.getErrorDesc(connectionString);
                    return -1;
                }
                else
                {
                    employee = true;
                }
            }
            if (employee)
            {
                pvg = new Privilege(this.tx.txnmP.tran_pvga, this.tx.txnmP.tran_pvgb, Convert.ToInt32(this.empm.emp_pvg));
            }
            else
            {
                pvg = new Privilege(this.tx.txnmP.tran_pvga, this.tx.txnmP.tran_pvgb, Convert.ToInt32(this.cstm.cs_type));
            }
            if (!pvg.verifyInitPrivilege(dberr))
            {
                 result = dberr.getErrorDesc(connectionString);
                 return -1;
            }
            if (!pvg.verifyApprovePrivilege())
            {
                String inData = this.TXID + "|" + acType + "|" + loginAc;
                    if (pvg.writeToPendingTxns(
                        connectionString,               /* connection string */
                        "0",                            /* account 1 */
                        "0",                            /* account 2 */
                        this.cstm.cs_no,                /* customer number */
                        tx.txnmP.tran_pvgb.ToString(),  /* transaction approve privilege */
                        tx.txnmP.tran_desc,             /* transaction description */
                        "0",                            /* initiating employee number */
                        0,                              /* debit amount */
                        0,                              /* credit amount */
                        tx.txnmP.tran_id,               /* transaction id (not tran code) */
                        inData,                         /* incoming transaction string in XSwitch */
                        dberr                           /* error tracking object */
                        ) != 0)
                    {
                        resultP = dberr.getErrorDesc(connectionString);
                        return -1;
                    }
                    resultP = Mnemonics.DbErrorCodes.MSG_SENT_FOR_AUTH;
                    return 0;
            }

            actm = new Cp_Actm(connectionString, dummyAc, "0", acType, 0, 0, 1, "Y", "Y", DateTime.Now.ToString(), true);
            if (dberr.ifError())
            {
                result = dberr.getErrorDesc(connectionString);
                return -1;
            }
            int retCode = Data.ActmD.Create(connectionString, actm.actmP, dberr);
            if (dberr.ifError())
            {
                result = dberr.getErrorDesc(connectionString);
                return -1;
            }
            if (!Data.PendtxnD.Delete(connectionString, refno))
            {
                dberr.setError(Mnemonics.DbErrorCodes.DBERR_PENDTXN_DELETE);
                result = dberr.getErrorDesc(connectionString);
                return -1;
            }
            //retCode
            //Entity.Cstm cstm = Data.CstmD.Read(connectionString, acct.actmP.cs_no1, dberr);
            Entity.Cstm cstm1 = Data.CstmD.Read(connectionString, retCode.ToString(), dberr);
            if (dberr.ifError())
            {
                result = dberr.getErrorDesc(connectionString);
                return -1;
            }
            String mailResponse = "";
            if (!Security.OTPUtility.SendMail("SBS", "*****@*****.**",
                cstm1.cs_fname + cstm1.cs_mname + cstm1.cs_lname, cstm1.cs_email,
                "Update from SBS", "new account created for you is " + retCode.ToString()))
            {
                mailResponse = "Mail sent.";
            }
            //-------------------------------
            resultP = "Successful!" + mailResponse;
            return 0;
        }