private void trlCRTree_DeleteNode(object sender, EventArgs e) { object obj = trlCRTree.GetDataRecordByNode(trlCRTree.FocusedNode); if (XtraMessageBox.Show("Are you sure to delete node?", "Delete node", MessageBoxButtons.YesNo) == DialogResult.Yes) { QChangeRequest cr = (QChangeRequest)obj; QChangeRequest.Delete(cr); if (cr.GetType() == typeof(QDocumentCR)) { trlCRTree.DataSource = null; } } }
private void trlCRTree_PopupMenuShowing(object sender, DevExpress.XtraTreeList.PopupMenuShowingEventArgs e) { if (e.Menu is TreeListNodeMenu) { trlCRTree.FocusedNode = ((TreeListNodeMenu)e.Menu).Node; object Obj = trlCRTree.GetDataRecordByNode(trlCRTree.FocusedNode); QChangeRequest objCR = (QChangeRequest)Obj; foreach (Type crType in objCR.CompatibleChildren) { e.Menu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Add " + crType.GetDescription(), addHandlers[crType])); } if (modifiers.ContainsKey(objCR.GetType())) { e.Menu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem(string.Format("Run {0} modifier.", objCR.GetType().Name), modifiers[objCR.GetType()])); } e.Menu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Delete", trlCRTree_DeleteNode)); if (objCR.GetType() == typeof(QAddCriterioCR)) { e.Menu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem(string.Format("Script Criterio"), trlCRTree_ScriptCriterio)); } } }
private void LoadCriteria(QChangeRequest cr) { if (cr != null) { if (cr.GetType() == typeof(QAddCriterioCR)) { QAddCriterioCR criterio = (QAddCriterioCR)cr; DataRow row = Criteria.NewRow(); row["Checked"] = criterio.CheckResultType == QCRCheckResultType.WellImplemented; row["Name"] = criterio.Name; row["CriUniqueId"] = criterio.CriUniqueId; row["CheckResultType"] = criterio.CheckResultType; row["DatabaseName"] = criterio.DatabaseName; row["ObjCR"] = criterio; Criteria.Rows.Add(row); } foreach (QChangeRequest child in cr.Children) { LoadCriteria(child); } } }