Exemplo n.º 1
0
        public static Boolean getItemCategorySubcategory(String itemId, out String category, out String subCategory)
        {
            String itemColumn = ColumnData.GetName(Net7.Table_item_base._id);
            String query      = "SELECT "
                                + ColumnData.GetName(Net7.Table_item_base._category) + ", "
                                + ColumnData.GetName(Net7.Table_item_base._sub_category)
                                + " FROM "
                                + Net7.Tables.item_base.ToString()
                                + " WHERE "
                                + itemColumn
                                + " = "
                                + DB.QueryParameterCharacter + itemColumn;
            DataTable dataTable = DB.Instance.executeQuery(query,
                                                           new String[] { itemColumn },
                                                           new String[] { itemId });

            if (dataTable.Rows.Count == 1)
            {
                DataRow dataRow = dataTable.Rows[0];
                category    = ColumnData.GetString(dataRow, Net7.Table_item_base._category);
                subCategory = ColumnData.GetString(dataRow, Net7.Table_item_base._sub_category);
                return(true);
            }

            category    = "";
            subCategory = "";
            return(false);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        static public Boolean getAssetCatSubCatFromId(String id, out String category, out String subCategory)
        {
            String idColumn = ColumnData.GetName(Net7.Table_assets._base_id);
            String query    = "SELECT "
                              + ColumnData.GetName(Net7.Table_assets._main_cat)
                              + ", "
                              + ColumnData.GetName(Net7.Table_assets._sub_cat)
                              + " FROM "
                              + Net7.Tables.assets.ToString()
                              + " WHERE "
                              + idColumn
                              + " = "
                              + DB.QueryParameterCharacter + idColumn;
            DataTable dataTable = DB.Instance.executeQuery(query, new String[] { idColumn }, new String[] { id });

            if (dataTable.Rows.Count == 1)
            {
                DataRow dataRow = dataTable.Rows[0];
                category    = ColumnData.GetString(dataRow, Net7.Table_assets._main_cat);
                subCategory = ColumnData.GetString(dataRow, Net7.Table_assets._sub_cat);
                return(true);
            }
            else
            {
                category    = "";
                subCategory = "";
                return(false);
            }
        }
Exemplo n.º 4
0
        public static Mission getMission(String id)
        {
            Mission mission   = null;
            String  parameter = "id";
            String  query     = DB.SELECT
                                + "*"
                                + DB.FROM
                                + Net7.Tables.missions
                                + DB.WHERE
                                + ColumnData.GetName(Net7.Table_missions._mission_id)
                                + DB.EQUALS
                                + DB.QueryParameterCharacter
                                + parameter;
            DataTable dataTable = DB.Instance.executeQuery(query, new String[] { parameter }, new String[] { id });

            if (dataTable.Rows.Count == 1)
            {
                mission = new Mission();
                mission.setId(id);
                mission.setXml(ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_XML));
                mission.setName(ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_name));
                String type = ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_type);
                CommonTools.MissionType missionType;
                CommonTools.Enumeration.TryParse <CommonTools.MissionType>(type, out missionType);
                mission.setType(missionType);
                mission.setKey(ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_key));
            }
            return(mission);
        }
        public static ColumnData.ColumnDataInfo[] ToColumnDataInfo <T>(Boolean sortByName)
        {
            Type enumType = typeof(T);

            if (!enumType.IsEnum)
            {
                throw new InvalidOperationException("This type is not an enumeration");
            }
            String[] enumNames = Enum.GetNames(enumType);
            if (sortByName)
            {
                Array.Sort(enumNames);
            }
            List <ColumnData.ColumnDataInfo> listColumnDataInfo = new List <ColumnData.ColumnDataInfo>();
            Enum enumValue;

            ColumnData.ColumnDataInfo columnDataInfo;
            foreach (String enumName in enumNames)
            {
                enumValue = (Enum)Enum.Parse(enumType, enumName);
                {
                    columnDataInfo              = new ColumnData.ColumnDataInfo();
                    columnDataInfo.DataType     = ColumnData.GetDataType(enumValue);
                    columnDataInfo.TypeIsString = ColumnData.IsDataTypeString(enumValue);
                    columnDataInfo.Name         = ColumnData.GetName(enumValue);
                    listColumnDataInfo.Add(columnDataInfo);
                }
            }
            return(listColumnDataInfo.ToArray());
        }
Exemplo n.º 6
0
        private void updateFields(DataRow dataRow)
        {
            Boolean newRecord = m_state.Equals(State.Add);

            foreach (DataBinding dataBinding in listDataBinding)
            {
                if (dataBinding.enumeration != null &&
                    !m_recordManager.updateField(newRecord, dataBinding, dataRow) &&
                    dataBinding.control != null)
                {
                    if (dataBinding.control.GetType() == typeof(CheckBox))
                    {
                        dataRow[ColumnData.GetName(dataBinding.enumeration)] = ((CheckBox)dataBinding.control).Checked ? 1 : 0;
                    }
                    else if (dataBinding.control.GetType() == typeof(ComboBox))
                    {
                        ComboBox  comboBox  = (ComboBox)dataBinding.control;
                        CodeValue codeValue = (CodeValue)comboBox.SelectedItem;
                        dataRow[ColumnData.GetName(dataBinding.enumeration)] = codeValue.code;
                    }
                    else if (dataBinding.control.GetType() == typeof(ListBox))
                    {
                        ListBox   listBox   = (ListBox)dataBinding.control;
                        CodeValue codeValue = (CodeValue)listBox.SelectedItem;
                        dataRow[ColumnData.GetName(dataBinding.enumeration)] = codeValue.code;
                    }
                    else
                    {
                        dataRow[ColumnData.GetName(dataBinding.enumeration)] = dataBinding.control.Text;
                    }
                }
            }
        }
Exemplo n.º 7
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());
        }
Exemplo n.º 8
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);
        }
        public static Boolean validate(out String errorMessage)
        {
            errorMessage = "";
            String                query             = "";
            int                   queryCount        = 0;
            List <String>         parameters        = new List <string>();
            List <String>         values            = new List <string>();
            List <DataValidation> dbDataValidations = new List <DataValidation>();
            String                parameter;

            foreach (DataValidation dataValidation in listDataValidations)
            {
                // Hack to allow non-database validations to feed into this system
                if ((dataValidation.dataConfiguration == null && dataValidation.code == null))
                {
                    errorMessage = dataValidation.errorMessage;
                    break;
                }

                parameter = dataValidation.dataConfiguration.m_id.ToString() + queryCount.ToString();
                if (query.Length != 0)
                {
                    query += " UNION ";
                }
                query += DB.SELECT
                         + queryCount.ToString()
                         + ","
                         + ColumnData.GetName(dataValidation.dataConfiguration.m_id)
                         + DB.FROM
                         + dataValidation.dataConfiguration.m_table
                         + DB.WHERE
                         + ColumnData.GetName(dataValidation.dataConfiguration.m_id)
                         + DB.EQUALS
                         + DB.QueryParameterCharacter
                         + parameter;
                parameters.Add(parameter);
                values.Add(dataValidation.code);
                dbDataValidations.Add(dataValidation);
                queryCount++;
            }

            if (errorMessage.Length == 0 &&
                query.Length != 0)
            {
                DataTable dataTable = DB.Instance.executeQuery(query, parameters.ToArray(), values.ToArray());
                for (int validation = 0; validation < dbDataValidations.Count; validation++)
                {
                    if (dataTable.Rows.Count <= validation ||
                        !dataTable.Rows[validation][0].ToString().Equals(validation.ToString()))
                    {
                        errorMessage = dbDataValidations[validation].errorMessage;
                        break;
                    }
                }
            }
            listDataValidations.Clear();
            return(errorMessage.Length == 0);
        }
 public String selectDataRowFromId(String currentId)
 {
     return("SELECT * FROM "
            + Net7.Tables.item_base.ToString()
            + " WHERE "
            + ColumnData.GetName(Net7.Table_item_base._id)
            + " = "
            + currentId);
 }
Exemplo n.º 11
0
 public static String getQueryBeam(String itemId)
 {
     return("SELECT * FROM "
            + Net7.Tables.item_beam.ToString()
            + " WHERE "
            + ColumnData.GetName(Net7.Table_item_beam._item_id)
            + " = '"
            + itemId
            + "'");
 }
Exemplo n.º 12
0
 /// <summary>
 ///   <para>
 ///     Update the value within the appropriate DataRow column from
 ///     the contents of the field within DataBinding</para>
 /// </summary>
 /// <returns>
 ///     <para>True: the data has been updated.</para>
 ///     <para>False: the data has not been updated, use the default code </para>
 /// </returns>
 public Boolean updateField(Boolean newRecord, DataBinding dataBinding, DataRow dataRow)
 {
     Net7.Table_item_ammo ammoField = (Net7.Table_item_ammo)dataBinding.enumeration;
     switch (ammoField)
     {
     case Net7.Table_item_ammo._maneuv_100:
         dataRow[ColumnData.GetName(ammoField)] = 0;
         return(true);
     }
     return(false);
 }
Exemplo n.º 13
0
        public static String getQueryItem_param()
        {
            String idColumn = ColumnData.GetName(Net7.Table_item_base._id);

            return("SELECT * FROM "
                   + Net7.Tables.item_base.ToString()
                   + " WHERE "
                   + idColumn
                   + " = "
                   + DB.QueryParameterCharacter + idColumn);
        }
Exemplo n.º 14
0
        public static String getFirstMissionId()
        {
//return "8";
            String query = DB.SELECT
                           + ColumnData.GetName(Net7.Table_missions._mission_id)
                           + DB.FROM
                           + Net7.Tables.missions.ToString()
                           + DB.LIMIT1;
            DataTable dataTable = DB.Instance.executeQuery(query, null, null);

            return(dataTable.Rows.Count == 0 ? null : ColumnData.GetString(dataTable.Rows[0], Net7.Table_missions._mission_id));
        }
        public static Boolean updateField(Boolean newRecord, System.Data.DataRow dataRow, Enum raceField, Enum professionField)
        {
            Int32  race       = getRace();
            String columnName = ColumnData.GetName(raceField);

            dataRow[columnName] = race;

            Int32 profession = getProfession();

            dataRow[ColumnData.GetName(professionField)] = profession;
            return(true);
        }
Exemplo n.º 16
0
        static public String getVersion()
        {
            String query = "SELECT "
                           + ColumnData.GetName(Net7.Table_versions._Version)
                           + " FROM "
                           + Net7.Tables.versions.ToString()
                           + " WHERE "
                           + ColumnData.GetName(Net7.Table_versions._EName)
                           + " = 'Item'";
            DataTable dataTable = DB.Instance.executeQuery(query, null, null);

            return(ColumnData.GetString(dataTable.Rows[0], Net7.Table_versions._Version));
        }
Exemplo n.º 17
0
        public static void deleteMission(Mission mission)
        {
            writeXmlLog(mission, LogAction.Delete);
            String parameter = "id";
            String query     = "DELETE FROM "
                               + Net7.Tables.missions
                               + DB.WHERE
                               + ColumnData.GetName(Net7.Table_missions._mission_id)
                               + DB.EQUALS
                               + DB.QueryParameterCharacter + parameter;

            DB.Instance.executeQuery(query, new String[] { parameter }, new String[] { mission.getId() });
        }
Exemplo n.º 18
0
        public String recordDelete()
        {
            String id = m_gui.getCurrentEditor().getPrimaryId();

            DataRow[] dataRows = m_dataSet.Tables[m_tableName].Select(ColumnData.GetName(m_idField) + " = " + id);
            if (dataRows.Length != 0)
            {
                try
                {
                    DataRow m_dataRow = dataRows[0];
                    m_dataRow.Delete();
                    MySqlCommandBuilder mySqlCommandBuilder = new MySqlCommandBuilder(m_sqlDataAdapter);
                    m_sqlDataAdapter.Update(m_dataSet, m_tableName);
                    m_dataSet.AcceptChanges();
                    mySqlCommandBuilder.Dispose();
                    m_dataRow = null;
                }
                catch (MySqlException e)
                {
                    switch (e.Number)
                    {
                    case 1451:
                        return("This record cannot be deleted because it is used in other tables\n\n"
                               + e.GetBaseException().Message);

                    default:
                        return("MySqlException: " + e.Number.ToString());
                    }
                }
            }
            return("");


/*
 *          String query = "DELETE FROM "
 + m_tableName
 + " WHERE "
 + ColumnData.GetName(m_idField)
 + " = "
 + m_dataRow[0].ToString();
 +          m_dataRow.Delete();
 +          m_sqlDataAdapter.Update(m_dataset);
 +          m_dataSet.AcceptChanges();
 +          m_dataRow = null;
 +          setState(TableIO.State.View);
 +          viewRecord();
 */
        }
        public static String getDescription(DataType dataType, String id)
        {
            DataConfiguration dataConfiguration;

            if (m_DataConfigurations.TryGetValue(dataType, out dataConfiguration))
            {
                String query = "";
                foreach (Enum field in dataConfiguration.m_description)
                {
                    if (query.Length == 0)
                    {
                        query += DB.SELECT;
                    }
                    else
                    {
                        query += ",";
                    }
                    query += ColumnData.GetName(field);
                }

                String parameter = "id";
                query += DB.FROM
                         + dataConfiguration.m_table.ToString()
                         + DB.WHERE
                         + ColumnData.GetName(dataConfiguration.m_id)
                         + DB.EQUALS
                         + DB.QueryParameterCharacter
                         + parameter;
                DataTable dataTable   = DB.Instance.executeQuery(query, new String[] { parameter }, new String[] { id });
                String    description = "";
                if (dataTable.Rows.Count == 1)
                {
                    foreach (DataColumn column in dataTable.Columns)
                    {
                        if (description.Length != 0)
                        {
                            description += " ";
                        }
                        description += dataTable.Rows[0][column].ToString();
                    }
                }
                return(description + " (" + id + ")");
            }
            else
            {
                throw (new Exception("Unable to convert '" + dataType.ToString() + "' into a DataConfiguration.DataType"));
            }
        }
Exemplo n.º 20
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());
        }
Exemplo n.º 21
0
        public static Boolean hasManufacturing(String itemId)
        {
            String itemIdColumn = ColumnData.GetName(Net7.Table_item_manufacture._item_id);
            String query        = "SELECT "
                                  + itemIdColumn
                                  + " FROM "
                                  + Net7.Tables.item_manufacture.ToString()
                                  + " WHERE "
                                  + itemIdColumn
                                  + " = "
                                  + DB.QueryParameterCharacter + itemIdColumn
                                  + " LIMIT 1";
            DataTable dataTable = DB.Instance.executeQuery(query, new String[] { itemIdColumn }, new String[] { itemId });

            return(dataTable.Rows.Count != 0);
        }
Exemplo n.º 22
0
        public static String getNextItemId()
        {
            String query = "SELECT MAX("
                           + ColumnData.GetName(Net7.Table_item_base._id)
                           + ") FROM "
                           + Net7.Tables.item_base.ToString();
            DataTable dataTable = DB.Instance.executeQuery(query, null, null);
            Int32     nextId    = 1;

            if (dataTable.Rows.Count == 1)
            {
                DataRow dataRow = dataTable.Rows[0];
                nextId = Int32.Parse(dataRow[0].ToString()) + 1;
            }
            return(nextId.ToString());
        }
        /// <summary>
        ///   <para>
        ///     Update the value within the appropriate DataRow column from
        ///     the contents of the field within DataBinding</para>
        /// </summary>
        /// <returns>
        ///     <para>True: the data has been updated.</para>
        ///     <para>False: the data has not been updated, use the default code </para>
        /// </returns>
        public Boolean updateField(Boolean newRecord, DataBinding dataBinding, DataRow dataRow)
        {
            Net7.Table_item_reactor reactorField = (Net7.Table_item_reactor)dataBinding.enumeration;
            switch (reactorField)
            {
            case Net7.Table_item_reactor._energy_100:
            case Net7.Table_item_reactor._range_100:
                dataRow[ColumnData.GetName(reactorField)] = 0;
                return(true);

            case Net7.Table_item_reactor._rest_race:
            case Net7.Table_item_reactor._rest_prof:
                // Handles both race and profession restrictions
                return(Restrictions.updateField(newRecord, dataRow, Net7.Table_item_reactor._rest_race, Net7.Table_item_reactor._rest_prof));
            }
            return(false);
        }
Exemplo n.º 24
0
        public static String getNextMissionId()
        {
            String query = "SELECT MAX("
                           + ColumnData.GetName(Net7.Table_missions._mission_id)
                           + ") FROM "
                           + Net7.Tables.missions;
            DataTable dataTable = DB.Instance.executeQuery(query, null, null);
            Int32     nextId    = 1;

            if (dataTable.Rows.Count == 1 && dataTable.Rows[0] != null)
            {
                DataRow dataRow = dataTable.Rows[0];
                Int32.TryParse(dataRow[0].ToString(), out nextId);
                ++nextId;
            }
            return(nextId.ToString());
        }
Exemplo n.º 25
0
        public static String[] getAssetCategories()
        {
            List <String> valueList = new List <String>();
            String        query     = "SELECT DISTINCT "
                                      + ColumnData.GetName(Net7.Table_assets._main_cat)
                                      + " FROM "
                                      + Net7.Tables.assets.ToString()
                                      + " ORDER BY "
                                      + ColumnData.GetName(Net7.Table_assets._main_cat);
            DataTable dataTable = DB.Instance.executeQuery(query, null, null);

            foreach (DataRow dataRow in dataTable.Rows)
            {
                valueList.Add(ColumnData.GetString(dataRow, Net7.Table_assets._main_cat));
            }
            return(valueList.ToArray());
        }
Exemplo n.º 26
0
        public static List <String> getEveryItem()
        {
            List <String> items = new List <String>();
            String        query = "SELECT "
                                  + ColumnData.GetName(Net7.Table_item_base._id)
                                  + " FROM "
                                  + Net7.Tables.item_base.ToString()
                                  + " ORDER BY "
                                  + ColumnData.GetName(Net7.Table_item_base._id);
            DataTable dataTable = DB.Instance.executeQuery(query, null, null);

            foreach (DataRow dataRow in dataTable.Rows)
            {
                items.Add(ColumnData.GetString(dataRow, Net7.Table_item_base._id));
            }
            return(items);
        }
Exemplo n.º 27
0
        private TableIO initializeItemManufacturing(ISearchDialog itemSearchDialog)
        {
            Net7_Tools.Gui.frmManufacturing manufacturingDlg  = new Net7_Tools.Gui.frmManufacturing();
            ItemManufacturingRecordManager  itemRecordManager = new ItemManufacturingRecordManager(manufacturingDlg, this);
            TableIO tableIO = new TableIO(this, itemRecordManager);

            manufacturingDlg.setTableIO(tableIO);
            DataBinding dataBinding;

            dataBinding = tableIO.bind(manufacturingDlg.manufacturingCboDifficulty, Net7.Table_item_manufacture._difficulty, "Difficulty Level");
            dataBinding.addValidation(new ValidateNumericInsideRange(1, 9));

            //dataBinding.addValidation(new ValidateInTable(Net7_db.Tables.item_base.ToString(), DB.getQueryItem(itemId));
            dataBinding = tableIO.bind(manufacturingDlg.manufacturingTxtComponent1, Net7.Table_item_manufacture._comp_1, "Component 1", false);
            dataBinding = tableIO.bind(manufacturingDlg.manufacturingTxtComponent2, Net7.Table_item_manufacture._comp_2, "Component 2", false);
            dataBinding = tableIO.bind(manufacturingDlg.manufacturingTxtComponent3, Net7.Table_item_manufacture._comp_3, "Component 3", false);
            dataBinding = tableIO.bind(manufacturingDlg.manufacturingTxtComponent4, Net7.Table_item_manufacture._comp_4, "Component 4", false);
            dataBinding = tableIO.bind(manufacturingDlg.manufacturingTxtComponent5, Net7.Table_item_manufacture._comp_5, "Component 5", false);
            dataBinding = tableIO.bind(manufacturingDlg.manufacturingTxtComponent6, Net7.Table_item_manufacture._comp_6, "Component 6", false);

            // Initialize the manufacturing difficulty levels
            manufacturingDlg.manufacturingCboDifficulty.Items.Clear();
            manufacturingDlg.manufacturingCboDifficulty.Items.AddRange(Database.Database.getItemManufacturingLevels());

            // Configure the 6 component fields, search buttons, and descriptions
            FieldSearchDescription.Data fieldSearchDescriptionData
                = new FieldSearchDescription.Data(
                      itemRecordManager,
                      itemSearchDialog,
                      Database.Database.getQueryItem_param(),
                      DB.QueryParameterCharacter + ColumnData.GetName(Net7.Table_item_base._id),
                      Net7.Table_item_base._name);
            itemRecordManager.setFieldSearchDescriptionData(fieldSearchDescriptionData);
            itemRecordManager.addComponentFields(new FieldSearchDescription.Fields(manufacturingDlg.manufacturingTxtComponent1, manufacturingDlg.manufacturingBtnComponent1, manufacturingDlg.manufacturingTxtComponentDesc1));
            itemRecordManager.addComponentFields(new FieldSearchDescription.Fields(manufacturingDlg.manufacturingTxtComponent2, manufacturingDlg.manufacturingBtnComponent2, manufacturingDlg.manufacturingTxtComponentDesc2));
            itemRecordManager.addComponentFields(new FieldSearchDescription.Fields(manufacturingDlg.manufacturingTxtComponent3, manufacturingDlg.manufacturingBtnComponent3, manufacturingDlg.manufacturingTxtComponentDesc3));
            itemRecordManager.addComponentFields(new FieldSearchDescription.Fields(manufacturingDlg.manufacturingTxtComponent4, manufacturingDlg.manufacturingBtnComponent4, manufacturingDlg.manufacturingTxtComponentDesc4));
            itemRecordManager.addComponentFields(new FieldSearchDescription.Fields(manufacturingDlg.manufacturingTxtComponent5, manufacturingDlg.manufacturingBtnComponent5, manufacturingDlg.manufacturingTxtComponentDesc5));
            itemRecordManager.addComponentFields(new FieldSearchDescription.Fields(manufacturingDlg.manufacturingTxtComponent6, manufacturingDlg.manufacturingBtnComponent6, manufacturingDlg.manufacturingTxtComponentDesc6));

            tableIO.initialize(Net7.Tables.item_manufacture.ToString(), Net7.Table_item_manufacture._item_id, Database.Database.getQueryManufacturing());

            return(tableIO);
        }
Exemplo n.º 28
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());
        }
Exemplo n.º 29
0
 public void recordCancel()
 {
     if (m_state.Equals(TableIO.State.Edit))
     {
         String currentId = ColumnData.GetString(m_dataRow, m_idField);
         setState(TableIO.State.View);
         if (recordSearch("SELECT * FROM "
                          + m_tableName
                          + " WHERE "
                          + ColumnData.GetName(m_idField)
                          + " = "
                          + currentId))
         {
             viewRecord();
         }
     }
     else
     {
         setState(TableIO.State.View);
     }
 }
Exemplo n.º 30
0
        static public String getAssetFromDescription(String description)
        {
            String descColumn = ColumnData.GetName(Net7.Table_assets._descr);
            String query      = "SELECT "
                                + ColumnData.GetName(Net7.Table_assets._base_id)
                                + " FROM "
                                + Net7.Tables.assets.ToString()
                                + " WHERE "
                                + descColumn
                                + " = "
                                + DB.QueryParameterCharacter + descColumn;
            DataTable dataTable = DB.Instance.executeQuery(query, new String[] { descColumn }, new String[] { description });
            String    assetId   = "";

            if (dataTable.Rows.Count == 1)
            {
                DataRow dataRow = dataTable.Rows[0];
                assetId = ColumnData.GetString(dataRow, Net7.Table_assets._base_id);
            }
            return(assetId);
        }