protected void UpdateDataView() { if (capabilityId >= 0) { capability = Capability.GetByKey(capabilityId); if (capability != null) { //txtCapabilityId.Text = capabilityId.ToString(); txtCapabilityName.Text = capability.Name; txtDescription.Text = capability.Description; Page.DataBind(); } else { lbError.CssClass = "hc_error"; lbError.Text = "Error: Capability is null"; lbError.Visible = true; } } else { Page.DataBind(); } UpdateTreeView(); }
private void Save() { // Update capability menus capability = Capability.GetByKey(capabilityId); capability.Menus.Clear(); XmlDocument t_SourceTreeData = new XmlDocument(); uwMenu.WriteXmlDoc(t_SourceTreeData, true, false); XmlNodeList t_TreeNodeList = t_SourceTreeData.SelectNodes("//Node[Checked]"); XmlNode node = null; for (int i = 0; i < t_TreeNodeList.Count; i++) { node = t_TreeNodeList[i].SelectSingleNode("./DataKey"); if (node != null) { capability.Menus.Add(new HyperCatalog.Business.Menu(Convert.ToInt32(node.InnerText))); } } if (capability.Save()) { lbError.Text = "Data saved !"; lbError.CssClass = "hc_success"; lbError.Visible = true; } else { lbError.Text = "Save failed"; lbError.CssClass = "hc_Error"; lbError.Visible = true; } }