protected void btnUpdate_Click(object sender, EventArgs e) { if (RadTreeView1.SelectedNode == null) { ShowError("Selecione uma categoria!"); return; } ProductManager manager = new ProductManager(this); ProductPart productPart = manager.GetProductPart(Convert.ToInt32(RadTreeView1.SelectedNode.Value)); productPart.Name = txtProductPart.Text; productPart.Quantity = Convert.ToInt16(txtQuantity.Text); manager.DbContext.SubmitChanges(); //DataManager.CurrentContext.SubmitChanges(); BindTree(); }
protected void btnDelete_Click(object sender, EventArgs e) { if (RadTreeView1.SelectedNode == null) { ShowError("Selecione uma categoria!"); return; } ProductManager manager = new ProductManager(this); ProductPart productPart = manager.GetProductPart(Convert.ToInt32(RadTreeView1.SelectedNode.Value)); try { manager.DeleteProductPart(productPart); } catch (Exception ex) { ShowError(ex.Message.ToString()); return; } BindTree(); }
protected void RadTreeView1_NodeBound(object o, RadTreeNodeEventArgs e) { ProductManager manager = new ProductManager(this); ProductPart productPart = manager.GetProductPart(Convert.ToInt32(e.Node.Value)); e.Node.Text += " (" + productPart.Quantity + ")"; e.Node.Expanded = true; }