/// <summary>
        /// Parent Constructor
        /// </summary>
        /// <param name="as1">accounting schema</param>
        public MAcctSchemaElement(MAcctSchema as1)
            : this(as1.GetCtx(), 0, as1.Get_TrxName())
        {
            SetClientOrg(as1);
            SetC_AcctSchema_ID(as1.GetC_AcctSchema_ID());

            //	setC_Element_ID (0);
            //	setElementType (null);
            //	setName (null);
            //	setSeqNo (0);
        }
        /// <summary>
        /// Factory: Return ArrayList of Account Schema Elements
        /// </summary>
        /// <param name="as1">Accounting Schema</param>
        /// <returns>ArrayList with Elements</returns>
        public static MAcctSchemaElement[] GetAcctSchemaElements(MAcctSchema as1)
        {
            int key = as1.GetC_AcctSchema_ID();

            MAcctSchemaElement[] retValue = (MAcctSchemaElement[])s_cache[key];
            if (retValue != null)
            {
                return(retValue);
            }

            _log.Fine("C_AcctSchema_ID=" + as1.GetC_AcctSchema_ID());
            List <MAcctSchemaElement> list = new List <MAcctSchemaElement>();
            //
            String sql = "SELECT * FROM C_AcctSchema_Element "
                         + "WHERE C_AcctSchema_ID=" + as1.GetC_AcctSchema_ID() + " AND IsActive='Y' ORDER BY SeqNo";

            try
            {
                DataSet ds = DataBase.DB.ExecuteDataset(sql, null, as1.Get_TrxName());
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow            dr  = ds.Tables[0].Rows[i];
                    MAcctSchemaElement ase = new MAcctSchemaElement(as1.GetCtx(), dr, as1.Get_TrxName());
                    _log.Fine(" - " + ase);
                    if (ase.IsMandatory() && ase.GetDefaultValue() == 0)
                    {
                        _log.Log(Level.SEVERE, "No default value for " + ase.GetName());
                    }
                    list.Add(ase);
                }
            }
            catch (Exception e)
            {
                _log.Log(Level.SEVERE, sql, e);
            }

            retValue = new MAcctSchemaElement[list.Count];
            retValue = list.ToArray();
            s_cache.Add(key, retValue);
            return(retValue);
        }
Пример #3
0
 /// <summary>
 /// Parent Constructor
 /// </summary>
 /// <param name="as1">as account schema</param>
 public MAccount(MAcctSchema as1)
     : this(as1.GetCtx(), 0, as1.Get_TrxName())
 {
     SetClientOrg(as1);
     SetC_AcctSchema_ID(as1.GetC_AcctSchema_ID());
 }