partial void UIButton722_TouchUpInside(UIButton sender) { Items item = new Items(); item.Description = TextItemDescription.Text; item.Value = TextItemValue.Text; item.Available = true; SetBuyItemsVC.AddItems(item); NavigationController.PopViewController(true); }
public async void AddItems(Items item) { GuiItems.Add (item); // DBConn.Insert(new Items { Description = item.Description, Value= item.Value, Available = item.Available}); var obj = new ParseObject ("Item"); obj ["Description"] = item.Description; obj ["Value"] = item.Value; obj ["Available"] = item.Available; obj ["PurchaserName"] = " "; await obj.SaveAsync (); }
public async override void ViewDidLoad () { base.ViewDidLoad (); var query = ParseObject.GetQuery("Item") .WhereNotEqualTo("Description", ""); IEnumerable<ParseObject> results = await query.FindAsync(); if (results.Count() == 0) { Items initItem = new Items { Description = "Dummy Item", Value= "0.00", Available = true, PurchaserName = "N/A" }; AddItems (initItem); } else { ParseObj = results.ToList (); foreach (ParseObject po in ParseObj) { string Desc = po.Get<string> ("Description"); string Value = po.Get<string> ("Value"); bool Available = po.Get<Boolean> ("Available"); GuiItems.Add (new Items { Description = Desc, Value = Value, Available = Available }); } } TableView.Source = dataSource = new DataSource (this, GuiItems); UIBarButtonItem[] barButtonItems = new UIBarButtonItem[2]; barButtonItems [0] = new UIBarButtonItem (UIBarButtonSystemItem.Add, (sender, args) => { var newItemVC = this.Storyboard.InstantiateViewController ("AddNewItemViewController") as AddNewItemViewController; newItemVC.SetBuyItemsVC = this; NavigationController.PushViewController (newItemVC, true); }); barButtonItems [1] = new UIBarButtonItem (UIBarButtonSystemItem.Trash, (sender, args) => { // DBConn.DeleteAll<Items> (); }); this.NavigationItem.SetRightBarButtonItems (barButtonItems, true); TableView.ReloadData (); }
public DetailItemsViewController(IntPtr handle) : base(handle) { DetailItem = new Items (); }
private async void ModifyItem(Items item) { var query = ParseObject.GetQuery("Item") .WhereEqualTo("Description", item.Description); ParseObject obj = await query.FirstAsync(); obj ["Available"] = false; obj ["PurchaserName"] = item.PurchaserName; await obj.SaveAsync(); }
public bool ModifyItem(Items item) { // Change the Gui and store the change in DB foreach (Items i in Objects) { if (i.Description.Equals (item.Description)) { i.Available = false; iTVC.ModifyItem (item); // iTVC.DBConn.InsertOrReplace (i); break; } } iTVC.TableView.ReloadData (); return true; }