コード例 #1
0
        /// <summary>
        /// Get Realized Loss Acct for currency
        /// </summary>
        /// <param name="C_Currency_ID">currency</param>
        /// <returns>loss acct</returns>
        public int GetRealizedLoss_Acct(int C_Currency_ID)
        {
            MCurrencyAcct acct = MCurrencyAcct.Get(this, C_Currency_ID);

            if (acct != null)
            {
                return(acct.GetRealizedLoss_Acct());
            }
            return(base.GetRealizedLoss_Acct());
        }
コード例 #2
0
        /// <summary>
        /// Get Currency Account for Currency
        /// </summary>
        /// <param name="a"> accounting schema default</param>
        /// <param name="C_Currency_ID">currency</param>
        /// <returns>Currency Account or null</returns>
        public static MCurrencyAcct Get(MAcctSchemaDefault a, int C_Currency_ID)
        {
            MCurrencyAcct retValue = null;
            String        sql      = "SELECT * FROM C_Currency_Acct "
                                     + "WHERE C_AcctSchema_ID=@Param1 AND C_Currency_ID=@Param2";

            SqlParameter[] Param = new SqlParameter[2];
            IDataReader    idr   = null;
            DataTable      dt    = null;

            //PreparedStatement pstmt = null;
            try
            {
                Param[0] = new SqlParameter("@Param1", a.GetC_AcctSchema_ID());
                //pstmt = DataBase.prepareStatement(sql, null);
                //pstmt.setInt(1, as.getC_AcctSchema_ID());
                //pstmt.setInt(2, C_Currency_ID);
                Param[1] = new SqlParameter("@Param1", a.GetC_AcctSchema_ID());
                //ResultSet rs = pstmt.executeQuery();
                idr = DataBase.DB.ExecuteReader(sql, Param, null);
                dt  = new DataTable();
                dt.Load(idr);
                idr.Close();
                foreach (DataRow dr in dt.Rows)
                {
                    retValue = new MCurrencyAcct(a.GetCtx(), dr, null);
                }
            }
            catch (Exception e)
            {
                if (idr != null)
                {
                    idr.Close();
                }
                _log.Log(Level.SEVERE, "get", e);
            }
            finally
            {
                dt = null;
            }
            return(retValue);
        }       //	get