Пример #1
0
 private int processTransaction(String connectionString, String cus_no, String pwd, Data.Dber dberr)
 {
     Cp_Txnm 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;
     }
     if(Validation.employeeInitiatedTxn(connectionString, cus_no) == 0)
     {
         Cp_Empm cpEmpm = new Cp_Empm(connectionString, cus_no, dberr);
         if(dberr.ifError())
         {
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
         if(cpEmpm.empmP.emp_pvg == 5)
         {
             dberr.setError(Mnemonics.DbErrorCodes.TXERR_ADMIN_PWD_NOCHANGE);
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
         if(!Data.EmpmD.UpdatePassword(connectionString, cus_no, pwd, dberr))
         {
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
         resultP = "Password Changed successfully!";
         return 0;
     }
     Cp_Cstm cstm = new Cp_Cstm(connectionString, cus_no, dberr);
     if (cstm.cstmP != null)
         cstm.updatePassword(connectionString, cus_no, pwd, dberr);
     if (dberr.ifError())
     {
         dberr = new Data.Dber();
         if(!Data.EmpmD.UpdatePassword(connectionString, cus_no, pwd, dberr))
         {
             dberr.setError(Mnemonics.DbErrorCodes.TXERR_PWD_NOUPDATE);
             resultP = dberr.getErrorDesc(connectionString);
             return -1;
         }
     }
     //------------------------------
     //Entity.Cstm cstm = Data.CstmD.Read(connectionString, acct.actmP.cs_no1, dberr);
     String mailResponse = "";
     if (!Security.OTPUtility.SendMail("SBS", "*****@*****.**",
         cstm.cstmP.cs_fname + cstm.cstmP.cs_mname + cstm.cstmP.cs_lname, cstm.cstmP.cs_email,
         "Update from SBS", "Password updated via transaction: "+ tx.txnmP.tran_desc))
     {
         mailResponse = "Mail sent.";
     }
     //-------------------------------
     resultP = "Password Changed successfully!" + mailResponse;
     //resultP = "Password Updated Successfully!";
     return 0;
 }
Пример #2
0
 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;
 }
Пример #3
0
 public Y_010(String connectionString, String txid)
 {
     dberr = new Dber();
     this.TXID = txid;
     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);
         errorBoolP = true;
         resultSetP = null;
     }
 }
Пример #4
0
 private int processTransaction(String connectionString, String a, String b, String c, String d, String e,
     String f, String g, String h, String i, string j, String k, String l, String m, String n, String o, String p, String q,
     String r, String s, String t, String loginAc)
 {
     this.tx = new Cp_Txnm(connectionString, this.TXID, dberr);
     if (dberr.ifError())
     {
         resultP = dberr.getErrorDesc(connectionString);
         return -1;
     }
     empm.emp_no = a;
     empm.emp_fname = b;
     empm.emp_mname = c;
     empm.emp_lname = d;
     empm.emp_addr1 = e;
     empm.emp_addr2 = f;
     empm.emp_zip = g;
     empm.emp_city = h;
     empm.emp_state = i;
     empm.emp_brnch = j;
     empm.emp_phn = k;
     empm.emp_email = l;
     empm.emp_mngr = m;
     empm.emp_pvg = Convert.ToInt32(n);
     empm.emp_secq1 = o;
     empm.emp_ans1 = p;
     empm.emp_secq2 = q;
     empm.emp_ans2 = r;
     empm.emp_pass = t;
     int empId = Data.EmpmD.Create(connectionString, empm, dberr);
     if (dberr.ifError())
     {
         resultP = dberr.getErrorDesc(connectionString);
         return -1;
     }
     String mailResponse = "";
     if (!Security.OTPUtility.SendMail("SBS", "*****@*****.**", empm.emp_fname + empm.emp_mname + empm.emp_lname,
         empm.emp_email, "Update from SBS",  "your new User Id with us is: " + empId.ToString()))
     {
         mailResponse = "Mail sent.";
     }
     //-------------------------------
     resultP = "Successful!" + mailResponse;
     //resultP = "Successful!";
     return 0;
 }
Пример #5
0
 private int processTransaction(String connectionString, String cusno)
 {
     this.tx = new Cp_Txnm(connectionString, TXID, dberr);
     // Check if TXNM fetch for transaction type "019" is successful. Return if error encountered
     if (dberr.ifError())
     {
         resultP = dberr.getErrorDesc(connectionString);
         return -1;
     }
     cs = new Cp_Cstm(connectionString, cusno, dberr);
     if (dberr.ifError())
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     /*
     if (tx.txnmP.tran_fin_type.Equals("Y"))
     {
         // Write to FINHIST table
         Entity.Finhist fhist = new Entity.Finhist(cs.cstmP.cs_no, "0", this.tx.txnmP.tran_desc,
             0, 0, "0", "0", "0", "0");
         Data.FinhistD.Create(connectionString, fhist, dberr);
     }
     else
     {
         // Write to NFINHIST table
         Entity.Nfinhist nFhist = new Entity.Nfinhist(cs.cstmP.cs_no, "0", this.tx.txnmP.tran_desc, "0", "0", "0");
         Data.NfinhistD.Create(connectionString, nFhist, dberr);
     }*/
     resultP = cs.cstmP.cs_no + "|" + cs.cstmP.cs_type + "|" + cs.cstmP.cs_fname + "|" + cs.cstmP.cs_mname + "|" + cs.cstmP.cs_lname
          + "|" + cs.cstmP.cs_addr1 + "|" + cs.cstmP.cs_addr2 + "|" + cs.cstmP.cs_city + "|" + cs.cstmP.cs_state + "|" + cs.cstmP.cs_zip
           + "|" + cs.cstmP.cs_branch + "|" + cs.cstmP.cs_phn + "|" + cs.cstmP.cs_email + "|" + cs.cstmP.cs_uid
           + "|" + cs.cstmP.cs_secq1 + "|" + cs.cstmP.cs_ans1 + "|" + cs.cstmP.cs_secq2 + "|" + cs.cstmP.cs_ans2 + "|"
           + cs.cstmP.cs_secq3 + "|" + cs.cstmP.cs_ans3 + "|" + cs.cstmP.cs_access+"|"+cs.cstmP.cs_uname+"|"+cs.cstmP.cs_pass;
     return 0;
 }
Пример #6
0
 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
 }
Пример #7
0
 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
 }
Пример #8
0
 private int processTransaction(String connectionString, String usr, String pwd)
 {
     /*
      * initiate select query on CSTM, to fetch cus_no for the usr and pwd combination
      * "select cus_no from CSTM where user = usr and pwd = pwd"
      * Using the retrieved cus_no, fetch all account numbers from cstm, and store the retrieved acc nos. 
      * as "|" delimited string in result. For errors, update error with "true"
     */
     /*Entity.Cstm cs = Data.CstmD.Read(connectionString, usr, pwd, dberr);
     if (dberr.ifError())
     {
         Cp_Empm empm = new Cp_Empm(connectionString, usr, pwd, dberr);
         if (dberr.ifError())
         {
             result = dberr.getErrorDesc(connectionString);
             return -1;
         }
     }
     else
     {
         Cp_Actm ac = new Cp_Actm();
         this.resultSet = ac.fetchAccountsFromCusNo(connectionString, cs.cs_no, dberr);
         if (dberr.ifError())
         {
             result = dberr.getErrorDesc(connectionString);
             return -1;
         }
         if(this.resultSet == null)
         {
             dberr.setError(Mnemonics.DbErrorCodes.TXERR_NO_USER);
             result = dberr.getErrorDesc(connectionString);
             return -1;
         }
     }
     return 0;*/
     txnm = new Cp_Txnm(connectionString, this.TXID, dberr);
     if (dberr.ifError())
     {
         resultP = dberr.getErrorDesc(connectionString);
         return -1;
     }
     cstm = new Cp_Cstm(connectionString, usr, pwd, dberr);
     if (dberr.ifError())
     {
         dberr = new Dber();
         Cp_Empm empm = new Cp_Empm(connectionString, usr, pwd, dberr);
         if (dberr.ifError())
         {
             result = dberr.getErrorDesc(connectionString);
             return -1;
         }
         if (txnm.txnmP.tran_fin_type.Equals("Y"))
         {
             // Write to FINHIST table
             Entity.Finhist fhist = new Entity.Finhist("0", "0", this.txnm.txnmP.tran_desc,
                 0, 0, "0", empm.empmP.emp_no, "0", "0");
             Data.FinhistD.Create(connectionString, fhist, dberr);
         }
         else
         {
             // Write to NFINHIST table
             Entity.Nfinhist nFhist = new Entity.Nfinhist("0", "0", 
                 this.txnm.txnmP.tran_desc, empm.empmP.emp_no, "0", "0");
             Data.NfinhistD.Create(connectionString, nFhist, dberr);
         }
         String empNo = empm.empmP.emp_no;
         String pvgLevel = Convert.ToString(empm.empmP.emp_pvg);
         String empFname = empm.empmP.emp_fname;
         String empLname = empm.empmP.emp_lname;
         resultP = empNo + "|" + empFname + "|" + empLname + "|" + pvgLevel + "|" + empm.empmP.emp_email;
         return 0;
     }
     //-----------
     if (cstm.cstmP.cs_type.Equals("0"))
     {
         dberr.setError(Mnemonics.DbErrorCodes.TXERR_INACTIVE_CUSTOMER);
         resultP = dberr.getErrorDesc(connectionString);
         return -1;
     }
     //--------------
     if (txnm.txnmP.tran_fin_type.Equals("Y"))
     {
         // Write to FINHIST table
         Entity.Finhist fhist = new Entity.Finhist("0", "0", this.txnm.txnmP.tran_desc,
             0, 0, "0", "0", "0", this.cstm.cstmP.cs_no);
         Data.FinhistD.Create(connectionString, fhist, dberr);
     }
     else
     {
         // Write to NFINHIST table
         Entity.Nfinhist nFhist = new Entity.Nfinhist("0", "0", this.txnm.txnmP.tran_desc, "0", "0", this.cstm.cstmP.cs_no);
         Data.NfinhistD.Create(connectionString, nFhist, dberr);
     }
     if (dberr.ifError())
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     String cusNo = cstm.cstmP.cs_no;
     String csPvgLevel = cstm.cstmP.cs_type;
     String csFname = cstm.cstmP.cs_fname;
     String csLname = cstm.cstmP.cs_lname;
     resultP = cusNo + "|" + csFname + "|" + csLname + "|" + csPvgLevel + "|" + cstm.cstmP.cs_email;
     return 0;
 }
Пример #9
0
 private int processTransaction(String connectionString, Entity.Cstm cstm)
 {
     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;
     }
     //if (!verifyInputType(1, cstm.cs_no))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSNO);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(2, cstm.cs_type))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSTYPE);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(2, cstm.cs_fname))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSFNAME);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(2, cstm.cs_mname))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSMNAME);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(2, cstm.cs_lname))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSLNAME);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_addr1))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSADDR1);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_addr2))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSADDR2);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_city))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSCITY);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(2, cstm.cs_state))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSSTATE);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(1, cstm.cs_zip))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSZIP);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(1, cstm.cs_branch))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSBRNCH);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(1, cstm.cs_phn))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSPHN);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_email))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSEMAIL);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(1, cstm.cs_uid))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSUID);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_secq1))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSSECQ1);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_ans1))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSANS1);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_secq2))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSSECQ2);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_ans2))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSANS2);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_secq3))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSSECQ3);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     //if (!verifyInputType(3, cstm.cs_ans3))
     //{
     //    this.dberr.setError(Mnemonics.DbErrorCodes.TXERR_FMT_CUSANS3);
     //    result = dberr.getErrorDesc(connectionString);
     //    return -1;
     //}
     Data.CstmD.Update(connectionString, this.cstm, this.dberr);
     if (dberr.ifError())
     {
         result = dberr.getErrorDesc(connectionString);
         return -1;
     }
     if (tx.txnmP.tran_fin_type.Equals("Y"))
     {
         // Write to FINHIST table
         Entity.Finhist fhist = new Entity.Finhist(this.cstm.cs_no, "0", this.tx.txnmP.tran_desc,
             0, 0, "0", "0", "0", "0");
         Data.FinhistD.Create(connectionString, fhist, dberr);
     }
     else
     {
         // Write to NFINHIST table
         Entity.Nfinhist nFhist = new Entity.Nfinhist(this.cstm.cs_no, "0", this.tx.txnmP.tran_desc, "0", "0", this.cstm.cs_no);
         Data.NfinhistD.Create(connectionString, nFhist, dberr);
     }
     //------------------------------
     //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: you profile has been updated via trnasaction: ", tx.txnmP.tran_desc))
     {
         mailResponse = "Mail sent.";
     }
     //-------------------------------
     result = "Successful!" + mailResponse;
     return 0;
 }
Пример #10
0
        private int processTransaction(String connectionString, String a1, String a2, String a3, String a4, String a5, String a6,
            String a7, String a8, String a9, String a10, String a11, String a12, String a13, String a14, String a15, String a16,
            String a17, String a18, String a19, String a20, String a21, String a22, String a23, String dummyAc, String dummyRef, String loginAc)
        {
            int cusPvg = 0;
            this.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.cs_no = a1;
            cstm.cs_type = a2;
            cstm.cs_fname = a3;
            cstm.cs_mname = a4;
            cstm.cs_lname = a5;
            cstm.cs_addr1 = a6;
            cstm.cs_addr2 = a7;
            cstm.cs_zip = a8;
            cstm.cs_city = a9;
            cstm.cs_state = a10;
            cstm.cs_phn = a11;
            cstm.cs_email = a12;
            cstm.cs_uid = a13;
            cstm.cs_branch = a14;
            cstm.cs_secq1 = a15;
            cstm.cs_ans1 = a16;
            cstm.cs_secq2 = a17;
            cstm.cs_ans2 = a18;
            cstm.cs_secq3 = a19;
            cstm.cs_ans3 = a20;
            cstm.cs_access = a21;
            cstm.cs_uname = a22;
            cstm.cs_pass = a23;
            cstm.cs_merch = " ";
            // Fetch data from CSTM. if CS_ACCESS = 'N', registration can be done, else fail txn
            //Entity.Cstm cstm = Data.CstmD.Read(connectionString, this.cusNo, dberr);
            //if (dberr.ifError())
            //{
            //    result = dberr.getErrorDesc(connectionString);
            //    return -1;
            //}
            //if (!cstm.cs_access.Equals("N"))
            //{
            //    dberr.setError(Mnemonics.DbErrorCodes.TXERR_EXISTING_USER);
            //    return -1;
            //}
            empm = Data.EmpmD.Read(connectionString, loginAc, dberr);
            if (!dberr.ifError())
            {
                employee = true;
                dberr = new Data.Dber();
            }
            else
            {
                dberr = new Data.Dber();
                if (cstm.cs_type.Equals("A") || cstm.cs_type.Equals("1") || cstm.cs_type.Equals(" "))
                {
                    cusPvg = 1;
                }
                if (cstm.cs_type.Equals("B") || cstm.cs_type.Equals("2"))
                {
                    cusPvg = 2;
                }
            }
            if(employee)
            {
                pvg = new Privilege(this.txnPvga, this.txnPvgb, empm.emp_pvg);
            }
            else
            {
                pvg = new Privilege(this.txnPvga, this.txnPvgb, cusPvg);
            }
            if (!pvg.verifyInitPrivilege(dberr))
            {
                    result = dberr.getErrorDesc(connectionString);
                    return -1;
            }
            if (!pvg.verifyApprovePrivilege())
            {
                    String inData = this.TXID + "|" + a1 + "|" + a2 + "|" + a3 + "|" + a4 + "|" + a5 + "|" + a6 +
                        "|" + a7 + "|" + a8 + "|" + a9 + "|" + a10 + "|" + a11 + "|" + a12 + "|" + a13 + "|" + a14 + "|" + a15 +
                        "|" + a16 + "|" + a17 + "|" + a18 + "|" + a19 + "|" + a20 + "|" + a21 + "|" + a22 + "|" + a23 ;
                    if (pvg.writeToPendingTxns(
                        connectionString,               /* connection string */
                        "0",                            /* account 1 */
                        "0",                            /* account 2 */
                        "0",                            /* 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;
            }
            //else
            //{
            //int cstmId = Data.CstmD.Create(connectionString, cstm, dberr);

                // Insert new row in Customer table
            int data = Data.CstmD.Create(connectionString, cstm, dberr);
            if (dberr.ifError())
            {
                result = dberr.getErrorDesc(connectionString);
                return -1;
            }
              // Write into history table
            
            //if (tx.txnmP.tran_fin_type.Equals("Y"))
            //{
            //        // Write to FINHIST table
            //     Entity.Finhist fhist = new Entity.Finhist(
            //       "0",                        /* Account Number */
            //        w,                          /* Reference Number */
            //        this.tx.txnmP.tran_desc,    /* Transaction Description */
            //        0,                          /* Debit Amount */
            //        0,                          /* Credit Amount */
            //        "0",                        /* Remaining Balance */
            //        "0",                        /* Initiating Employee Id */
            //         loginAc,                    /* Approve Employee Id */
            //        cstmId.ToString()                  /* Initiating Customer Number */
            //        );
            //     Data.FinhistD.Create(connectionString, fhist, dberr);
            //}
            //else
            //{
            //        // Write to NFINHIST table
            //    Entity.Nfinhist nFhist = new Entity.Nfinhist(
            //            "0",                        /* Account Number */
            //            w,                        /* Reference Number */
            //            this.tx.txnmP.tran_desc,    /* Transaction Description */
            //            "0",                        /* Initiating Employee Id */
            //            loginAc,                    /* Approve Employee Id */
            //            cstmId.ToString()           /* Initiating Customer Number */
            //            );
            //    Data.NfinhistD.Create(connectionString, nFhist, dberr);
            //}
            //if (dberr.ifError())
            //{
            //        result = dberr.getErrorDesc(connectionString);
            //        return -1;
            //}
                // Delete the Pending transaction
            if(!Data.PendtxnD.Delete(connectionString, dummyRef))
            {
                    dberr.setError(Mnemonics.DbErrorCodes.DBERR_PENDTXN_DELETE);
                    result = dberr.getErrorDesc(connectionString);
                    return -1;
            }
            //}
            if (dberr.ifError())
            {
                result = dberr.getErrorDesc(connectionString);
                return -1;
            }
            //------------------------------
            //Entity.Cstm cstm = Data.CstmD.Read(connectionString, acct.actmP.cs_no1, dberr);
            String mailResponse = "";
            if (!Security.OTPUtility.SendMail("SBS", "*****@*****.**", cstm.cs_fname + cstm.cs_mname + cstm.cs_lname,
                cstm.cs_email, "Update from SBS", "your new User Id with us is: "+data.ToString()))
            {
                mailResponse = "Mail sent.";
            }
            //-------------------------------
            resultP = "Successful!" + mailResponse;
            return 0;
        }
Пример #11
0
        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;
        }