static void Main(string[] args)
        {
            var error = new Data.Dber();
            var s = CstmD.Read(CONNECTION_STRING,"10001", error);

            var c = CstmD.Create(CONNECTION_STRING,s,error);

            var d = CstmD.Delete(CONNECTION_STRING, c.ToString(),null);
            // TestSecurity();

            Console.ReadLine();
        }
 public Y_000(String txid, String connectionString, String usr, String pwd)
 {
     this.error = false;
     this.TXID = txid;
     this.userid = usr;
     this.pwd = pwd;
     this.dberr = new Data.Dber();
     this.result = " ";
     if(processTransaction(connectionString, usr, pwd) != 0)
     {
         this.error = true;
     }
 }
 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;
     }
 }
 public Y_010(String txid, String connectionString, String acc_no)
 {
     try
     {
         this.TXID = txid;
         dberr = new Data.Dber(); // change to Data.Dber
         processTransaction(connectionString, acc_no, dberr);
         // seq will generate and store transaction reference no.
         seq = new Sequence(TXID);
     }
     catch(Exception e)
     {
         error = e.ToString();
     }
 }
 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;
 }
 public bool deletePendingTransaction(string connectionString, string referenceNumber)
 {
     if (referenceNumber.Trim() == string.Empty) return true;
     var dberr = new Data.Dber();
     return Data.PendtxnD.Delete(connectionString, referenceNumber);
 }
 public string getBankPublicKey(string connectionString)
 {
     var dberr = new Data.Dber();
     var data = Data.PkitD.GetBankPrivateKey(connectionString);
     if (!dberr.ifError())
     {
         return data;
     }
     else return null;
 }
 public string getCustomerPrivateKey(string connectionString, string customerNumber)
 {
     var dberr = new Data.Dber();
     var data = Data.PkitD.GetCustomerPrivateKey(connectionString, customerNumber);
     if (!dberr.ifError())
     {
         return data;
     }
     else return null;
 }
 public DataSet getMerchantAccessibleCustomerData(string connectionString, string employeeId)
 {
     var dberr = new Data.Dber();
     var ds = Data.CstmD.GetMerchantAccessibleCustomerData(connectionString, employeeId, dberr);
     if (!dberr.ifError())
     {
         return ds;
     }
     else return null;
 }
 public DataSet GetInternalUserList(string connectionString)
 {
     var dberr = new Data.Dber();
     var ds = Data.EmpmD.GetInternalUserList(connectionString, dberr);
     if (!dberr.ifError())
     {
         return ds;
     }
     else return null;
 }
 public Entity.Empm getInternalUserDataFromUserName(string connectionString, string username)
 {
     var dberr = new Data.Dber();
     var data = Data.EmpmD.GetEmployeeObjectFromUserName(connectionString, username, dberr);
     if (!dberr.ifError())
     {
         return data;
     }
     else return null;
 }
 public Entity.Cstm getExternalUserDataFromUserName(string connectionString, string username)
 {
     var dberr = new Data.Dber();
     var data = Data.CstmD.GetCustomerObjectFromUserName(connectionString, username, dberr);
     if (!dberr.ifError())
     {
         return data;
     }
     else return null;
 }
 public string geTranDataFromRefNumber(string connectionString, string ref_no)
 {
     var dberr = new Data.Dber();
     var data = Data.PendtxnD.GetTranDataFromRefNumber(connectionString, ref_no, dberr);
     if (!dberr.ifError())
     {
         return data;
     }
     else return null;
 }
 public DataSet getNonFinHistory(String connectionString, String cusno)
 {
     Data.Dber dberr = new Data.Dber();
     DataSet dSet = Data.NfinhistD.GetAccountStatement(connectionString, cusno, dberr);
     if (!dberr.ifError())
     {
         return dSet;
     }
     else return null;
 }