private void AddButt_Click(object sender, EventArgs e) { Item itm = new Item() { Name = NameBox.Text, Place = PlaceBox.Text, Description = DescBox.Text, Code = Code }; itm.SetAvailable(true); if (ParentBox.Text != "") { List <Item> list = DbWrap.GetList(ParentBox.Text); if (list.Count > 0) { list.First().AddChild(itm); DbWrap.Update(list.First()); } else { DbWrap.Insert(itm); } } else { DbWrap.Insert(itm); } NameBox.Text = ""; PlaceBox.Text = ""; DescBox.Text = ""; }
private void DeleteButt_Click(object sender, EventArgs e) { foreach (Item itm in treeListView.SelectedObjects) { DbWrap.Delete(itm); } UpdateExplorer(); }
private void CheckOutButt_Click(object sender, EventArgs e) { List <Item> list = DbWrap.GetList(Code); foreach (Item itm in list) { itm.SetAvailable(false); DbWrap.Update(itm); } }
private void CheckInButt_Click(object sender, EventArgs e) { List <Item> list = DbWrap.GetList(Code); foreach (Item itm in list) { itm.SetAvailable(true); Console.WriteLine(itm.Id); DbWrap.Update(itm); } }
private void UpdateExplorer() { Thread.Sleep(100); List <Item> list = DbWrap.GetList(); data = list; this.treeListView.Roots = data; treeListView.RebuildAll(true); //treeListView.Refresh(); }
private void UpdateButt_Click(object sender, EventArgs e) { Item itm = (Item)treeListView.SelectedObjects[0]; itm.Name = ExpNameBox.Text; itm.Place = ExpPlaceBox.Text; itm.Description = ExpDescBox.Text; DbWrap.Update(itm); UpdateExplorer(); UpdateButt.Enabled = false; DeleteButt.Enabled = false; ExpNameBox.Text = ""; ExpPlaceBox.Text = ""; ExpDescBox.Text = ""; }
private void HandleCode() { Code = CodeBox.Text.ToUpper(); CodeLabel.Text = Code; CodeBox.Text = ""; Console.WriteLine("Got:" + Code); if (CheckInBox.Checked) { Console.WriteLine("CheckIn:" + Code); List <Item> list = DbWrap.GetList(Code); foreach (Item itm in list) { itm.SetAvailable(true); Console.WriteLine("In:" + itm.Id); DbWrap.Update(itm); } } else if (CheckOutBox.Checked) { Console.WriteLine("CheckOut:" + Code); List <Item> list = DbWrap.GetList(Code); foreach (Item itm in list) { itm.SetAvailable(false); Console.WriteLine("Out:" + itm.Id); DbWrap.Update(itm); } } UpdateExplorer(); }
public Item GetParent() { return(DbWrap.GetItem(Parent)); }