Example #1
0
        public static string TranslateItem(ItemCategoryID itemCategory, long itemID)
        {
            string pathToDatabase        = Directory.GetCurrentDirectory() + @"\Data\DeS.db";
            string translatedDescription = "";

            SQLiteConnection sqlite_conn = new SQLiteConnection("Data Source=" + pathToDatabase + ";Version=3;");

            try
            {
                sqlite_conn.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error connection to database for translation: " + ex.Message);
            }

            SQLiteDataReader sqlite_datareader;
            SQLiteCommand    sqlite_cmd;

            sqlite_cmd = sqlite_conn.CreateCommand();

            string tableName;

            switch (itemCategory)
            {
            case ItemCategoryID.WEAPON:
                tableName = "EquipParamWeapon";
                break;

            case ItemCategoryID.ARMOR:
                tableName = "EquipParamProtector";
                break;

            case ItemCategoryID.ACCESORIES:
                tableName = "EquipParamAccessory";
                break;

            case ItemCategoryID.CONSUMABLES:
                tableName = "EquipParamGoods";
                break;

            default:
                tableName = "EquipParamGoods";
                break;
            }

            sqlite_cmd.CommandText = string.Format("SELECT {0} FROM {1} WHERE {2} = {3}", "description", tableName, "id", itemID);

            sqlite_datareader = sqlite_cmd.ExecuteReader();

            while (sqlite_datareader.Read())
            {
                translatedDescription = sqlite_datareader.GetString(0);
            }

            sqlite_conn.Close();

            return(translatedDescription);
        }
Example #2
0
        public ItemLotItem(ItemCategoryID hostOnlyItemCategory, long hostOnlyItemID, int hostOnlyItemNumber, long eventId, ItemLot parentItemLot) : base(hostOnlyItemID, hostOnlyItemCategory)
        {
            HostOnlyItemCategory = hostOnlyItemCategory;
            HostOnlyItemID       = hostOnlyItemID;
            HostOnlyItemNumber   = hostOnlyItemNumber;
            HostOnlyItem         = true;
            ParentItemLot        = parentItemLot;

            SetItemDescription();
        }
Example #3
0
        public ItemLotItem(ItemCategoryID lotItemCategory, long lotItemId, int lotItemNumber, int lotItemBasePoint, int qWCBasePoint, int qWCAppliesPoint, bool enableLuck, ItemLot parentItemLot) : base(lotItemId, lotItemCategory)
        {
            LotItemCategory  = lotItemCategory;
            LotItemId        = lotItemId;
            LotItemNumber    = lotItemNumber;
            LotItemBasePoint = lotItemBasePoint;
            QWCBasePoint     = qWCBasePoint;
            QWCAppliesPoint  = qWCAppliesPoint;
            EnableLuck       = enableLuck;
            HostOnlyItem     = false;
            ParentItemLot    = parentItemLot;

            SetItemDescription();
        }
Example #4
0
        public Item(long iD, ItemCategoryID itemCategory)
        {
            ID           = iD;
            ItemCategory = itemCategory;

            if (IDBanks.keyItems.Contains(ID))
            {
                KeyItem = true;
            }
            else
            {
                KeyItem = false;
            }
        }
        private void DeleteItemCategory()
        {
            Int64 ItemCategoryID;

            Int64.TryParse(treeItemCategory.SelectedValue, out ItemCategoryID);

            if (ItemCategoryID > 0)
            {
                try
                {
                    Int64 result = -1;

                    String fe = SqlExpressionBuilder.PrepareFilterExpression(MDItemCategoryEntity.FLD_NAME_ItemCategoryID, ItemCategoryID.ToString(), SQLMatchType.Equal);

                    MDItemCategoryEntity mDItemCategoryEntity = new MDItemCategoryEntity();


                    result = FCCMDItemCategory.GetFacadeCreate().Delete(mDItemCategoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                    if (result == 0)
                    {
                        _ItemCategoryID       = 0;
                        _MDItemCategoryEntity = new MDItemCategoryEntity();

                        // clearing cache
                        FCCMDItemCategory.GetFacadeCreate().RemoveCache();

                        PrepareInitialView();

                        LoadTreeView();

                        MiscUtil.ShowMessage(lblMessage, "Item Category has been successfully deleted.", true);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Failed to delete Item Category.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }