Ejemplo n.º 1
0
        public static int Create(string connectionString, Finhist dataObject, Dber dberr)
        {
            try
            {

                var query = string.Format(@"INSERT INTO [SBS].[dbo].[FINHIST]
           ([TRAN_DATE]
           ,[AC_NO]
           ,[TRAN_TIMESTAMP]
           ,[TRAN_DESC]
           ,[REM_BAL]
           ,[INIT_CSNO]
           ,[INIT_EMPID]
           ,[APPRV_EMPID]
           ,[DR_AMT]
           ,[CR_AMT])
                    OUTPUT INSERTED.REF_NO          
                    VALUES
                    ('{0}'  ,'{1}','{2}'  ,'{3}'  ,'{4}'  ,{5}  ,{6}  ,{7} ,'{8}'  ,'{9}')",
               dataObject.tran_date,dataObject.ac_no,dataObject.tran_timestamp,dataObject.tran_desc,dataObject.rem_bal,
               dataObject.init_csno == "0" ? "null" : dataObject.init_csno, 
               dataObject.init_empid == "0" ? "null" : dataObject.init_empid,
               dataObject.apprv_empid == "0" ? "null" : dataObject.apprv_empid,
               dataObject.dr_amt,dataObject.cr_amt);
                return (int)DbAccess.ExecuteScalar(connectionString, CommandType.Text, query);
            }
            catch (Exception ex)
            {
                dberr.setError(Mnemonics.DbErrorCodes.DBERR_FINHIST_CREATE);
                return -1;
            }
        }
Ejemplo n.º 2
0
        public static Finhist Read(string connectionString, string ref_no, Dber dberr)
        {
            try
            {
                var FinHistMasterObject = new Finhist();

                var query = string.Format("select * from FinHist where ref_no = {0}", ref_no);
                var data = DbAccess.ExecuteQuery(connectionString, CommandType.Text, query);

                //assign the data object to ErrorHistry master object
                if (data.Tables[0].Rows.Count > 0)
                {
                    FinHistMasterObject.ref_no = data.Tables[0].Rows[0]["ref_no"].ToString();
                    FinHistMasterObject.init_empid = data.Tables[0].Rows[0]["init_empid"].ToString();
                    FinHistMasterObject.tran_date = data.Tables[0].Rows[0]["tran_date"].ToString();
                    FinHistMasterObject.tran_desc = data.Tables[0].Rows[0]["tran_desc"].ToString();
                    FinHistMasterObject.tran_timestamp = data.Tables[0].Rows[0]["tran_timestamp"].ToString();
                    FinHistMasterObject.rem_bal = data.Tables[0].Rows[0]["rem_bal"].ToString();
                    FinHistMasterObject.cr_amt = Convert.ToDecimal(data.Tables[0].Rows[0]["cr_amt"]);
                    FinHistMasterObject.dr_amt = Convert.ToDecimal(data.Tables[0].Rows[0]["dr_amt"]);
                    FinHistMasterObject.ac_no = data.Tables[0].Rows[0]["ac_no"].ToString();
                    FinHistMasterObject.apprv_empid = data.Tables[0].Rows[0]["apprv_empid"].ToString();
                    FinHistMasterObject.init_csno = data.Tables[0].Rows[0]["init_csno"].ToString();


                    return FinHistMasterObject;
                }

                else
                {
                    dberr.setError(Mnemonics.DbErrorCodes.DBERR_FINHIST_READ);
                    return null;
                }
            }
            catch (Exception ex)
            {
                dberr.setError(Mnemonics.DbErrorCodes.DBERR_FINHIST_READ);
                return null;
            }
        }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
 public static bool Update(string connectionString, Finhist dataObject, Dber dberr)
 {
     throw new NotImplementedException();
 }