Пример #1
0
    public void InventoryButtonClick()
    {
        inventoryTable.SetActive(!inventoryTable.activeSelf);
        InventoryTable script = inventoryTable.GetComponent <InventoryTable>();

        script.Reload();
    }
Пример #2
0
    public void SaveInventory()
    {
        int slot_id, quantity;

        Int32.TryParse(transform.Find("slotInput").GetComponent <InputField>().text, out slot_id);
        Int32.TryParse(transform.Find("quantityInput").GetComponent <InputField>().text, out quantity);
        Dropdown itemDropdown = transform.Find("itemInput").GetComponent <Dropdown>();
        Item     it           = items.ElementAt(itemDropdown.value);

        InventorySlot sl = new InventorySlot();

        sl.slotID   = slot_id;
        sl.item     = it;
        sl.quantity = quantity;

        Mysql mysql = FindObjectOfType <Mysql>();

        mysql.SaveInventorySlot(player_id, sl);

        slot = null;
        transform.gameObject.SetActive(false);

        InventoryTable script = inventoryTable.GetComponent <InventoryTable>();

        script.Reload(player_id);
    }
Пример #3
0
        private async void CheckBoxComplete_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox       cb    = (CheckBox)sender;
            InventoryTable item2 = cb.DataContext as InventoryTable;

            await UpdateCheckedInventoryTable(item2);
        }
Пример #4
0
        private async Task InsertInventoryTable(InventoryTable InventoryTable)
        {
            // This code inserts a new InventoryTable into the database. When the operation completes
            // and Mobile Services has assigned an Id, the item is added to the CollectionView
            //await InventoryTable.InsertAsync(InventoryTable);
            //items.Add(InventoryTable);

            //await SyncAsync(); // offline sync
        }
Пример #5
0
        private async void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            var InventoryTable = new InventoryTable {
                Text = txtBoxInput.Text
            };

            InsertRecord(txtBoxInput.Text);
            await InsertInventoryTable(InventoryTable);
        }
Пример #6
0
 public InventoryController()
 {
     this._inventoryTable = new InventoryTable();
     this._userTable      = new UserTable();
     this._locationTable  = new LocationTable();
     this._profileTable   = new ProfileTable();
     this._hardwareTable  = new HardwareTable();
     this._logTable       = new LogBook.Controllers.LogBookController();
 }
Пример #7
0
        public void BindGrid(string sortExpression = "", bool isSort = false)
        {
            using (var db = new AGRODataContext(Server.MapPath("\\")))
            {
                IQueryable <Inventory> query = db.Inventory;

                switch (sortExpression)
                {
                case "IdI":
                    query = GetSortExpression(query, i => i.IdI, "IdI", isSort);
                    break;

                case "IName":
                    query = GetSortExpression(query, i => i.IName, "IName", isSort);
                    break;

                case "Price":
                    query = GetSortExpression(query, i => i.Price, "Price", isSort);
                    break;

                case "Count":
                    query = GetSortExpression(query, i => i.Count, "Count", isSort);
                    break;

                case "MPrice":
                    query = GetSortExpression(query, i => i.MPrice, "MPrice", isSort);
                    break;

                default:
                    query = GetSortExpression(query, i => i.IdI, "IdI", isSort);
                    break;
                }

                var source = query
                             .Select(x => new
                {
                    IdI    = x.IdI,
                    IName  = x.IName,
                    Price  = x.Price,
                    Count  = x.Count,
                    MPrice = x.MPrice
                })
                             .ToList();

                InventoryTable.DataSource = source;
                InventoryTable.DataBind();
            }
        }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.I))
        {
            itemsTable.SetActive(!itemsTable.activeSelf);
            ItemsTable script = itemsTable.GetComponent <ItemsTable>();
            script.Reload();
        }

        if (Input.GetKeyDown(KeyCode.N))
        {
            inventoryTable.SetActive(!inventoryTable.activeSelf);
            InventoryTable script = inventoryTable.GetComponent <InventoryTable>();
            script.Reload();
        }
    }
Пример #9
0
        //private MobileServiceCollection<InventoryTable, InventoryTable> items;
        //private IMobileServiceTable<InventoryTable> todoTable = App.website20180420120114.GetTable<InventoryTable>();

        private async void InsertRecord(string strInput)
        {
            try
            {
                InventoryTable item = new InventoryTable {
                    Text = strInput, TITLE = "Awesome item", AUTHOR = "John Doe", PRICE = "$50.00"
                };
                // await App.website20180420120114.GetTable<InventoryTable>().InsertAsync(item);


                //using Windows.UI.Popups;
                MessageDialog messageDialog = new MessageDialog("Completed Successfully!", "Windows 8");
                await messageDialog.ShowAsync();
            }
            catch (Exception e)
            {
                MessageDialog messageDialog = new MessageDialog("An Error Occurred: " + e.Message, "Windows 8");
                await messageDialog.ShowAsync();
            }
        }
Пример #10
0
        private async Task UpdateCheckedInventoryTable(InventoryTable item)
        {
            try
            {
                // This code takes a freshly completed InventoryTable and updates the database. When the MobileService
                // responds, the item is removed from the list
                //await InventoryTable.UpdateAsync(item);
                //items.Remove(item);

                //The following code illustrates how to delete an existing instance. The instance is identified by the "Id" field set on the InventoryTable.
                // await InventoryTable.DeleteAsync(item);

                ListItems.Focus(Windows.UI.Xaml.FocusState.Unfocused);

                //await SyncAsync(); // offline sync
            }
            catch (Exception e)
            {
                MessageDialog messageDialog = new MessageDialog("An Error Occurred: " + e.Message, "Windows 8");
                await messageDialog.ShowAsync();
            }
        }