Esempio n. 1
0
        public static AssetInformation getAsset(String assetId)
        {
            String idColumn = ColumnData.GetName(Net7.Table_assets._base_id);
            String query    = "SELECT  "
                              + ColumnData.GetName(Net7.Table_assets._base_id) + ", "
                              + ColumnData.GetName(Net7.Table_assets._descr) + ", "
                              + ColumnData.GetName(Net7.Table_assets._filename)
                              + " FROM "
                              + Net7.Tables.assets.ToString()
                              + " WHERE "
                              + idColumn
                              + " = "
                              + DB.QueryParameterCharacter + idColumn;
            DataTable        dataTable        = DB.Instance.executeQuery(query, new String[] { idColumn }, new String[] { assetId });
            AssetInformation assetInformation = null;

            if (dataTable.Rows.Count == 1)
            {
                DataRow dataRow = dataTable.Rows[0];
                assetInformation          = new AssetInformation();
                assetInformation.base_id  = ColumnData.GetInt32(dataRow, Net7.Table_assets._base_id);
                assetInformation.descr    = ColumnData.GetString(dataRow, Net7.Table_assets._descr);
                assetInformation.filename = ColumnData.GetString(dataRow, Net7.Table_assets._filename);
            }
            return(assetInformation);
        }
Esempio n. 2
0
        public static CodeValue[] getItemAmmoTypes(Int32 subCategory)
        {
            List <CodeValue> codeValueList = new List <CodeValue>();

            if (subCategory == 100)
            {
                // Override the ammo type for beam weapons
                codeValueList.Add(CodeValue.Formatted(4, "EMP"));
                codeValueList.Add(CodeValue.Formatted(3, "Energy"));
                codeValueList.Add(CodeValue.Formatted(2, "Plasma"));
            }
            else
            {
                String query = "SELECT "
                               + ColumnData.GetName(Net7.Table_item_type._id) + ", "
                               + ColumnData.GetName(Net7.Table_item_type._name)
                               + " FROM "
                               + Net7.Tables.item_ammo_type.ToString()
                               + " WHERE "
                               + ColumnData.GetName(Net7.Table_item_ammo_type._sub_category)
                               + " = "
                               + subCategory
                               + " ORDER BY "
                               + ColumnData.GetName(Net7.Table_item_type._name);
                DataTable dataTable = DB.Instance.executeQuery(query, null, null);
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    codeValueList.Add(CodeValue.Formatted(ColumnData.GetInt32(dataRow, Net7.Table_item_type._id),
                                                          ColumnData.GetString(dataRow, Net7.Table_item_type._name)));
                }
            }
            return(codeValueList.ToArray());
        }
Esempio n. 3
0
        public static List <CodeValue> getItems(String category, String subCategory)
        {
            List <CodeValue> valueList         = new List <CodeValue>();
            String           categoryColumn    = ColumnData.GetName(Net7.Table_item_base._category);
            String           subCategoryColumn = ColumnData.GetName(Net7.Table_item_base._sub_category);
            String           query             = "SELECT "
                                                 + ColumnData.GetName(Net7.Table_item_base._id) + ", "
                                                 + ColumnData.GetName(Net7.Table_item_base._name)
                                                 + " FROM "
                                                 + Net7.Tables.item_base.ToString()
                                                 + " WHERE "
                                                 + categoryColumn
                                                 + " = "
                                                 + DB.QueryParameterCharacter + categoryColumn
                                                 + " AND "
                                                 + subCategoryColumn
                                                 + " = "
                                                 + DB.QueryParameterCharacter + subCategoryColumn
                                                 + " ORDER BY "
                                                 + ColumnData.GetName(Net7.Table_item_base._name);
            DataTable dataTable = DB.Instance.executeQuery(query,
                                                           new String[] { categoryColumn, subCategoryColumn },
                                                           new String[] { category, subCategory });
            CodeValue codeValue;

            foreach (DataRow dataRow in dataTable.Rows)
            {
                codeValue = new CodeValue(ColumnData.GetInt32(dataRow, Net7.Table_item_base._id),
                                          ColumnData.GetString(dataRow, Net7.Table_item_base._name));
                valueList.Add(codeValue);
            }
            return(valueList);
        }
        public Boolean enableField(DataBinding dataBinding, DataRow dataRow, Boolean enabled)
        {
            switch ((Net7.Table_item_base)dataBinding.enumeration)
            {
            case Net7.Table_item_base._item_base_id:
            {
                Boolean customItem = dataRow != null &&
                                     ColumnData.GetBoolean(dataRow, Net7.Table_item_base._custom_flag);
                if (customItem == false && enabled == true)
                {
                    enabled = false;
                }
                dataBinding.control.Enabled = enabled;
                return(true);
            }

            case Net7.Table_item_base._category:
            {
                if (enabled == true)
                {
                    if (m_gui.getCurrentEditor().getTableHandlers()[0].getTableIO().getState().Equals(TableIO.State.Add))
                    {
                        // Always enable in Add mode
                    }
                    else
                    {
                        Int32 code = (dataRow == null) ? 0 : ColumnData.GetInt32(dataRow, dataBinding.enumeration);
                        Items.ItemCategory category = (Items.ItemCategory)code;
                        enabled = Items.isComponent(category);
                    }
                }
            }
                dataBinding.control.Enabled = enabled;
                return(true);

            case Net7.Table_item_base._sub_category:
            {
                if (enabled == true)
                {
                    if (m_gui.getCurrentEditor().getTableHandlers()[0].getTableIO().getState().Equals(TableIO.State.Add))
                    {
                        // Always enable in Add mode
                    }
                    else
                    {
                        Int32 code = (dataRow == null) ? 0 : ColumnData.GetInt32(dataRow, dataBinding.enumeration);
                        Items.ItemSubCategory subCategory  = (Items.ItemSubCategory)code;
                        TabPage[]             listTabPages = getTabPages(subCategory);
                        enabled = listTabPages.Length == 1;
                    }
                }
            }
                dataBinding.control.Enabled = enabled;
                return(true);
            } // switch

            return(false);
        }
Esempio n. 5
0
        public static AssetInformation[] getAssetItems(String categoryValue, String subCategoryValue)
        {
            String categoryColumn    = ColumnData.GetName(Net7.Table_assets._main_cat);
            String subCategoryColumn = ColumnData.GetName(Net7.Table_assets._sub_cat);

            String[] parameters;
            String[] values;
            List <AssetInformation> valueList = new List <AssetInformation>();
            String query = "SELECT  "
                           + ColumnData.GetName(Net7.Table_assets._base_id) + ", "
                           + ColumnData.GetName(Net7.Table_assets._descr) + ", "
                           + ColumnData.GetName(Net7.Table_assets._filename)
                           + " FROM "
                           + Net7.Tables.assets.ToString()
                           + " WHERE "
                           + categoryColumn
                           + " = "
                           + DB.QueryParameterCharacter + categoryColumn;

            if (subCategoryValue == null)
            {
                parameters = new String[] { categoryColumn };
                values     = new String[] { categoryValue };
            }
            else
            {
                query += " AND "
                         + subCategoryColumn
                         + " = "
                         + DB.QueryParameterCharacter + subCategoryColumn;
                parameters = new String[] { categoryColumn, subCategoryColumn };
                values     = new String[] { categoryValue, subCategoryValue };
            }
            query += " ORDER BY "
                     + ColumnData.GetName(Net7.Table_assets._filename);
            DataTable        dataTable = DB.Instance.executeQuery(query, parameters, values);
            AssetInformation assetInformation;

            foreach (DataRow dataRow in dataTable.Rows)
            {
                assetInformation          = new AssetInformation();
                assetInformation.base_id  = ColumnData.GetInt32(dataRow, Net7.Table_assets._base_id);
                assetInformation.descr    = ColumnData.GetString(dataRow, Net7.Table_assets._descr);
                assetInformation.filename = ColumnData.GetString(dataRow, Net7.Table_assets._filename);
                valueList.Add(assetInformation);
            }
            return(valueList.ToArray());
        }
Esempio n. 6
0
        public static CodeValue[] getItemTypes()
        {
            List <CodeValue> valueList = new List <CodeValue>();
            String           query     = "SELECT "
                                         + ColumnData.GetName(Net7.Table_item_type._id) + ", "
                                         + ColumnData.GetName(Net7.Table_item_type._name)
                                         + " FROM "
                                         + Net7.Tables.item_type.ToString()
                                         + " ORDER BY "
                                         + ColumnData.GetName(Net7.Table_item_type._name);
            DataTable dataTable = DB.Instance.executeQuery(query, null, null);

            foreach (DataRow dataRow in dataTable.Rows)
            {
                valueList.Add(CodeValue.Formatted(ColumnData.GetInt32(dataRow, Net7.Table_item_type._id),
                                                  ColumnData.GetString(dataRow, Net7.Table_item_type._name)));
            }
            return(valueList.ToArray());
        }
        public static Boolean displayField(System.Data.DataRow dataRow, Enum raceField, Enum professionField)
        {
            Int32 race = dataRow == null ? 0 : ColumnData.GetInt32(dataRow, raceField);

            m_suspendValueChanged = true;
            m_terran.Checked      = (race & (int)Race.Terran) != 0;
            m_jenquai.Checked     = (race & (int)Race.Jenquai) != 0;
            m_progen.Checked      = (race & (int)Race.Progen) != 0;

            Int32 profession = dataRow == null ? 0 : ColumnData.GetInt32(dataRow, professionField);

            m_warrior.Checked     = (profession & (int)Profession.Warrior) != 0;
            m_trader.Checked      = (profession & (int)Profession.Trader) != 0;
            m_explorer.Checked    = (profession & (int)Profession.Explorer) != 0;
            m_suspendValueChanged = false;

            setRaceDescription(getRace());
            setProfessionDescription(getProfession());

            return(true);
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            String        query         = "";
            String        filter        = "";
            List <String> sqlParameters = new List <String>();
            List <String> sqlValues     = new List <String>();
            int           parameterId   = 0;

            foreach (SearchCriteria searchCriteria in searchSearchCriteriaLst.Items)
            {
                if (filter.Length != 0)
                {
                    filter += " AND ";
                }
                filter += searchCriteria.getQuery() + parameterId.ToString();
                sqlParameters.Add(searchCriteria.sqlParameter + parameterId.ToString());
                sqlValues.Add(searchCriteria.sqlValue);
                parameterId++;
            }

            if (filter.Length != 0)
            {
                searchResultList.Items.Clear();
                query = "SELECT "
                        + ColumnData.GetName(Net7.Table_item_base._id) + ","
                        + ColumnData.GetName(Net7.Table_item_base._name) + ","
                        + ColumnData.GetName(Net7.Table_item_base._category) + ","
                        + ColumnData.GetName(Net7.Table_item_base._sub_category) + ","
                        + ColumnData.GetName(Net7.Table_item_base._level) + ","
                        + ColumnData.GetName(Net7.Table_item_base._status)
                        + " FROM "
                        + Net7.Tables.item_base;
                if (m_table.Equals(Net7.Tables.item_base))
                {
                    query += DB.WHERE;
                }
                else
                {
                    query += "," + m_table
                             + DB.WHERE
                             + ColumnData.GetName(Net7.Table_item_base._id)
                             + DB.EQUALS
                             + m_primaryId
                             + " AND ";
                }
                query += filter;
                DataTable dataTable = DB.Instance.executeQuery(query, sqlParameters.ToArray(), sqlValues.ToArray());
                searchResultCount.Text = dataTable.Rows.Count.ToString() + " items";
                ListViewItem          listViewItem;
                Int32                 code;
                Items.ItemCategory    categoryValue;
                String                category;
                Items.ItemSubCategory subCategoryValue;
                String                subCategory;
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    code             = ColumnData.GetInt32(dataRow, Net7.Table_item_base._category);
                    categoryValue    = (Items.ItemCategory)code;
                    category         = Items.CategoryLookup(categoryValue);
                    code             = ColumnData.GetInt32(dataRow, Net7.Table_item_base._sub_category);
                    subCategoryValue = (Items.ItemSubCategory)code;
                    subCategory      = Items.SubCategoryLookup(subCategoryValue);
                    listViewItem     = new ListViewItem(new String[]
                    {
                        ColumnData.GetString(dataRow, Net7.Table_item_base._id),
                        ColumnData.GetString(dataRow, Net7.Table_item_base._name),
                        category,
                        subCategory,
                        ColumnData.GetString(dataRow, Net7.Table_item_base._level),
                        ColumnData.GetString(dataRow, Net7.Table_item_base._status)
                    });
                    searchResultList.Items.Add(listViewItem);
                }
            }
        }
        public Boolean displayField(DataBinding dataBinding, DataRow dataRow)
        {
            if (dataBinding.enumeration.Equals(Net7.Table_item_base._id))
            {
                String code = (dataRow == null) ? "" : ColumnData.GetString(dataRow, dataBinding.enumeration);
                m_baseManufacturingBtn.ForeColor = (code.Length == 0 || Database.hasManufacturing(code)) ? Color.Black : Color.Red;
            }
            else if (dataBinding.enumeration.Equals(Net7.Table_item_base._category))
            {
                // Show the relevant tab pages given the category
                Int32 code = (dataRow == null) ? 50 : ColumnData.GetInt32(dataRow, dataBinding.enumeration);
                Items.ItemCategory category = (Items.ItemCategory)code;
                TabPage[]          listTabPages;
                if (m_categoryTabPages.TryGetValue(category, out listTabPages))
                {
                    m_gui.setTabPages(listTabPages);
                }
            }
            else if (dataBinding.enumeration.Equals(Net7.Table_item_base._sub_category))
            {
                // Show the relevant tab pages given the sub-category
                Int32 code = (dataRow == null) ? 0 : ColumnData.GetInt32(dataRow, dataBinding.enumeration);
                Items.ItemSubCategory subCategory = (Items.ItemSubCategory)code;
                TabPage[]             listTabPages;
                if (m_subCategoryTabPages.TryGetValue(subCategory, out listTabPages))
                {
                    m_gui.setTabPages(listTabPages);
                }
                else if (m_subCategoryTabPages.TryGetValue(Items.ItemSubCategory.Other, out listTabPages))
                {
                    // Assume that the sub-category refers to a component
                    m_gui.setTabPages(listTabPages);
                }
                Int32       category        = (dataRow == null) ? 0 : ColumnData.GetInt32(dataRow, Net7.Table_item_base._category);
                CodeValue[] listSubCategory = Database.getItemSubCategories((int)category);
                ComboBox    subCategories   = (ComboBox)dataBinding.control;
                subCategories.Items.Clear();
                subCategories.Items.AddRange(listSubCategory);

                // Rely on the child tables (i.e. Devices, Beams, Missile/Projectile Launcher)
                // to activate the restrictions when needed
                Restrictions.displayField(null, null, null);
                Restrictions.enableField(false);

                Int32 subCategoryId = (dataRow == null) ? 0 : ColumnData.GetInt32(dataRow, dataBinding.enumeration);
                m_gui.setEditor(Items.getEditorType(subCategory), false);
            }
            else if (dataBinding.enumeration.Equals(Net7.Table_item_base._description))
            {
                // Convert from E&B style
                String description = (dataRow == null) ? "" : ColumnData.GetString(dataRow, dataBinding.enumeration);
                dataBinding.control.Text = Utility.ParseDescription(description);
                return(true);
            }
            else if (dataBinding.enumeration.Equals(Net7.Table_item_base._custom_flag))
            {
                ((CheckBox)dataBinding.control).Checked = (dataRow == null) ? false : ColumnData.GetBoolean(dataRow, dataBinding.enumeration);
                return(true);
            }
            else if (dataBinding.enumeration.Equals(Net7.Table_item_base._2d_asset))
            {
                dataBinding.control.Text = (dataRow == null) ? "744" : ColumnData.GetString(dataRow, dataBinding.enumeration);
                return(true);
            }
            else if (dataBinding.enumeration.Equals(Net7.Table_item_base._max_stack))
            {
                dataBinding.control.Text = (dataRow == null) ? "1" : ColumnData.GetString(dataRow, dataBinding.enumeration);
                return(true);
            }
            else if (dataBinding.enumeration.Equals(Net7.Table_item_base._3d_asset))
            {
                dataBinding.control.Text = (dataRow == null) ? "69" : ColumnData.GetString(dataRow, dataBinding.enumeration);
                return(true);
            }
            else if (dataBinding.enumeration.Equals(Net7.Table_item_base._price))
            {
                dataBinding.control.Text = (dataRow == null) ? "0" : ColumnData.GetString(dataRow, dataBinding.enumeration);
                return(true);
            }
            return(false);
        }
Esempio n. 10
0
        public void displayFields(DataRow dataRow)
        {
            tabsMain.SelectedIndex = 0;

            txtId.Text             = dataRow == null ? "" : ColumnData.GetString(dataRow, Database_net7_db.Table_item_base._id);
            cboLevel.SelectedIndex = dataRow == null ? 0 : ColumnData.GetInt32(dataRow, Database_net7_db.Table_item_base._level) - 1;
            SetCategory(dataRow == null ? 0 : ColumnData.GetInt32(dataRow, Database_net7_db.Table_item_base._category));
            SetSubCategory(dataRow == null ? 0 : ColumnData.GetInt32(dataRow, Database_net7_db.Table_item_base._sub_category));
            // TODO: Handle the type column
            //txtPrice.Text           = dataRow == null ? "" : ColumnData.GetString(dataRow, Database_net7_db.Table_item_base._price);
            //txtStackSize.Text       = dataRow == null ? "" : ColumnData.GetString(dataRow, Database_net7_db.Table_item_base._max_stack);
            //txtName.Text            = dataRow == null ? "" : ColumnData.GetString(dataRow, Database_net7_db.Table_item_base._name);
            txtDescription.Text = dataRow == null ? "" : Utility.ParseDescription(ColumnData.GetString(dataRow, Database_net7_db.Table_item_base._description));
            //RefreshManufacturers(     dataRow == null ? 0 : ColumnData.GetInt32(dataRow, Database_net7_db.Table_item_base._manufacturer));
            //txt2DAsset.Text         = dataRow == null ? "" : ColumnData.GetString(dataRow, Database_net7_db.Table_item_base._2d_asset);
            //txt3DAsset.Text         = dataRow == null ? "" : ColumnData.GetString(dataRow, Database_net7_db.Table_item_base._3d_asset);

            //chkNoTrade.Checked      = dataRow == null ? false : ColumnData.GetBoolean(dataRow, Database_net7_db.Table_item_base._no_trade);
            //chkNoStore.Checked      = dataRow == null ? false : ColumnData.GetBoolean(dataRow, Database_net7_db.Table_item_base._no_store);
            //chkNoDestroy.Checked    = dataRow == null ? false : ColumnData.GetBoolean(dataRow, Database_net7_db.Table_item_base._no_destroy);
            //chkNoManu.Checked       = dataRow == null ? false : ColumnData.GetBoolean(dataRow, Database_net7_db.Table_item_base._no_manu);
            //chkUnique.Checked       = dataRow == null ? false : ColumnData.GetBoolean(dataRow, Database_net7_db.Table_item_base._unique);


            //Obtain the category (in case data was corrupt)
            int       SubCat = Utility.ParseParen(cboSubCategory.Text);
            DataTable dataTable;
            int       ItemID = txtId.Text.Length == 0 ? 0 : Int32.Parse(txtId.Text);

            switch ((Items.ItemSubCategory)SubCat)
            {
            case Items.ItemSubCategory.Beam_Weapon:
                dataTable = DB.executeQuery(DB.DatabaseName.net7_db,
                                            DB.getQueryBeam(ItemID.ToString()));
                if (dataTable.Rows.Count == 1)
                {
                    dataRow = dataTable.Rows[0];
                    cboBeamDamageType.Text = ColumnData.GetString(dataRow, Database_net7_db.Table_item_beam._damage_type);
                    txtBeamFireEffect.Text = ColumnData.GetString(dataRow, Database_net7_db.Table_item_beam._fire_effect);
                    txtBeamRange.Text      = ColumnData.GetString(dataRow, Database_net7_db.Table_item_beam._range_100);
                    txtBeamEnergy.Text     = ColumnData.GetString(dataRow, Database_net7_db.Table_item_beam._energy_100);
                    txtBeamReload.Text     = ColumnData.GetString(dataRow, Database_net7_db.Table_item_beam._reload_100);
                    txtBeamDamage100.Text  = ColumnData.GetString(dataRow, Database_net7_db.Table_item_beam._damage_100);
                    txtBeamDamage200.Text  = ColumnData.GetString(dataRow, Database_net7_db.Table_item_beam._damage_200);
                }
                LoadEffects(ItemID);
                break;

            case Items.ItemSubCategory.Missle_Launcher:
                dataTable = DB.executeQuery(DB.DatabaseName.net7_db,
                                            DB.getQueryMissile(ItemID.ToString()));
                if (dataTable.Rows.Count == 1)
                {
                    dataRow = dataTable.Rows[0];
                    txtMissleAmmoName.Text    = ColumnData.GetString(dataRow, Database_net7_db.Table_item_missle._ammo);
                    txtMissleRoundsFired.Text = ColumnData.GetString(dataRow, Database_net7_db.Table_item_missle._ammo_per_shot);
                    //TODO: Add field energy_100 in table item_missle
                    //txtMissleEnergy.Text        = ColumnData.GetString(dataRow, Database_net7_db.Table_item_missle._energy_100);
                    txtMissleReload100.Text = ColumnData.GetString(dataRow, Database_net7_db.Table_item_missle._reload_100);
                    txtMissleReload200.Text = ColumnData.GetString(dataRow, Database_net7_db.Table_item_missle._reload_200);
                }
                LoadEffects(ItemID);
                break;

            case Items.ItemSubCategory.Projectile_Launcher:
                dataTable = DB.executeQuery(DB.DatabaseName.net7_db,
                                            DB.getQueryProjectile(ItemID.ToString()));
                if (dataTable.Rows.Count == 1)
                {
                    dataRow = dataTable.Rows[0];
                    txtProjectileAmmoName.Text    = ColumnData.GetString(dataRow, Database_net7_db.Table_item_projectile._ammo);
                    txtProjectileRoundsFired.Text = ColumnData.GetString(dataRow, Database_net7_db.Table_item_projectile._ammo_per_shot);
                    txtProjectileRange.Text       = ColumnData.GetString(dataRow, Database_net7_db.Table_item_projectile._range_100);
                    //txtProjectileEnergy.Text        = ColumnData.GetString(dataRow, Database_net7_db.Table_item_projectile._energy_100);
                    txtProjectileReload100.Text = ColumnData.GetString(dataRow, Database_net7_db.Table_item_projectile._reload_100);
                    txtProjectileReload200.Text = ColumnData.GetString(dataRow, Database_net7_db.Table_item_projectile._reload_200);
                }
                LoadEffects(ItemID);
                break;

            case Items.ItemSubCategory.Ammo:
                dataTable = DB.executeQuery(DB.DatabaseName.net7_db,
                                            DB.getQueryAmmo(ItemID.ToString()));
                if (dataTable.Rows.Count == 1)
                {
                    //TODO: Load the launcher name
                    dataRow = dataTable.Rows[0];
                    cboAmmoLauncher.Text   = ColumnData.GetString(dataRow, Database_net7_db.Table_item_ammo._launcher_id);
                    cboAmmoDamageType.Text = ColumnData.GetString(dataRow, Database_net7_db.Table_item_ammo._damage_type);
                    txtAmmoVisual.Text     = ColumnData.GetString(dataRow, Database_net7_db.Table_item_ammo._fire_effect);
                    txtAmmoManouv.Text     = ColumnData.GetString(dataRow, Database_net7_db.Table_item_ammo._maneuv_100);
                    txtAmmoRange.Text      = ColumnData.GetString(dataRow, Database_net7_db.Table_item_ammo._range_100);
                    txtAmmoDamage100.Text  = ColumnData.GetString(dataRow, Database_net7_db.Table_item_ammo._damage_100);
                    txtAmmoDamage200.Text  = ColumnData.GetString(dataRow, Database_net7_db.Table_item_ammo._damage_200);
                }
                break;
            }
        }
Esempio n. 11
0
        public void viewRecord()
        {
            // Suspend the value changed event notification since the user is
            // not actually changing the values
            m_suspendValueChanged = true;

            // Process each widget bound to a database field
            foreach (DataBinding dataBinding in listDataBinding)
            {
                // Is there an override within the record manager?
                if (dataBinding.enumeration != null && !m_recordManager.displayField(dataBinding, m_dataRow))
                {
                    // Use the standard data manager
                    if (dataBinding.control != null)
                    {
                        if (dataBinding.control.GetType() == typeof(CheckBox))
                        {
                            ((CheckBox)dataBinding.control).Checked = (m_dataRow == null)
                                                                    ? false
                                                                    : ColumnData.GetBoolean(m_dataRow, dataBinding.enumeration);
                        }
                        else if (dataBinding.control.GetType() == typeof(ListBox))
                        {
                            // TODO: If the DB value is not available in the list then select first entry and enter edit mode
                            ListBox   listBox   = (ListBox)dataBinding.control;
                            CodeValue codeValue = new CodeValue();
                            codeValue.code = (m_dataRow == null) ? 0 : ColumnData.GetInt32(m_dataRow, dataBinding.enumeration);
                            if (m_dataRow == null)
                            {
                                codeValue = listBox.Items.Count == 0 ? null : (CodeValue)listBox.Items[0];
                            }
                            else
                            {
                                codeValue.code = ColumnData.GetInt32(m_dataRow, dataBinding.enumeration);
                            }
                            listBox.SelectedItem = codeValue;
                        }
                        else if (dataBinding.control.GetType() == typeof(ComboBox))
                        {
                            // TODO: If the DB value is not available in the list then select first entry and enter edit mode
                            ComboBox  comboBox  = (ComboBox)dataBinding.control;
                            CodeValue codeValue = new CodeValue();
                            codeValue.code = (m_dataRow == null) ? 0 : ColumnData.GetInt32(m_dataRow, dataBinding.enumeration);
                            if (m_dataRow == null)
                            {
                                codeValue = comboBox.Items.Count == 0 ? null : (CodeValue)comboBox.Items[0];
                            }
                            else
                            {
                                codeValue.code = ColumnData.GetInt32(m_dataRow, dataBinding.enumeration);
                            }
                            comboBox.SelectedItem = codeValue;
                        }
                        else
                        {
                            dataBinding.control.Text = (m_dataRow == null)
                                                     ? ""
                                                     : ColumnData.GetString(m_dataRow, dataBinding.enumeration);
                        }
                    }
                }
            }
            m_suspendValueChanged = false;

            // There's a record available so enable the fields
            enableFields(true);

            // There's a record available so we can add a new one, delete the current
            // one, but cannot save nor cancel it (it's not being added nor modified)
            if (!m_suspendGuiChanged)
            {
                m_gui.setGuiEnabled(true, true, false);
            }
        }