Exemple #1
0
        /// <summary>
        /// Update Value/Description after change of
        /// account element value/description.
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="where">where clause</param>
        /// <param name="trxName">transaction</param>
        public static void UpdateValueDescription(Ctx ctx, String where, Trx trxName)
        {
            String sql = "SELECT * FROM C_ValidCombination";

            if (where != null && where.Length > 0)
            {
                sql += " WHERE " + where;
            }
            sql += " ORDER BY C_ValidCombination_ID";
            int     count  = 0;
            int     errors = 0;
            DataSet ds     = new DataSet();

            try
            {
                ds = DataBase.DB.ExecuteDataset(sql, null, trxName);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow  rs      = ds.Tables[0].Rows[i];
                    MAccount account = new MAccount(ctx, rs, trxName);
                    account.SetValueDescription();
                    if (account.Save())
                    {
                        count++;
                    }
                    else
                    {
                        errors++;
                    }
                }
                ds = null;
            }
            catch (Exception e)
            {
                _log.Log(Level.SEVERE, sql, e);
            }
            _log.Fine(where + " #" + count + ", Errors=" + errors);
        }