private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { try { if (inEditMode) { InEditModeMessage(); return; } switch (treeView1.HitTest(e.Location).Location) { case TreeViewHitTestLocations.Label: case TreeViewHitTestLocations.Image: case TreeViewHitTestLocations.PlusMinus: e.Node.TreeView.SelectedNode = e.Node; selectedIssue = (appDB.IssueRow)e.Node.Tag; setBindingSourcePosition(selectedIssue.IssueId); break; } } catch (Exception x) { UIHelper.HandleUIException(x); } }
private TreeNode FindIssueNodeX(appDB.IssueRow ir) { TreeNode[] tns = tvIssues.Nodes.Find(ir.IssueId.ToString(), true); foreach (TreeNode tn in tns) { return(tn); } //not found so load node // myFM.AtMng.GetIssue().Load(); //myFM.GetIssue().LoadByParentIssueId(ir.ParentIssueId); appDB.IssueRow[] idr = (appDB.IssueRow[])myFM.AtMng.DB.Issue.Select("IssueId=" + ir.ParentIssueId.ToString()); if (idr.Length > 0) { appDB.IssueRow pir = idr[0]; TreeNode tn1 = FindIssueNode(pir); if (tn1 != null) { LoadLevel(tn1, pir.IssueId); return(tn1.Nodes[ir.IssueId.ToString()]); } else { return(null); } } else { return(null); } }
private void treeView1_ItemDrag(object sender, ItemDragEventArgs e) { try { if (inEditMode) { InEditModeMessage(); return; } NodeDragSource = (TreeNode)e.Item; appDB.IssueRow ir = (appDB.IssueRow)NodeDragSource.Tag; setCurrentNode(ir.IssueId.ToString()); setBindingSourcePosition(ir.IssueId); ddEffect = this.DoDragDrop(NodeDragSource.Text, DragDropEffects.Move); if (ddEffect == DragDropEffects.Move) { // src.Remove(); } } catch (Exception x) { UIHelper.HandleUIException(x); } }
private void checkNodeForFileId(TreeNode trnd, appDB.IssueRow issue) { if (issue.IsFileIdNull()) { trnd.ImageKey = "folder.gif"; trnd.SelectedImageKey = "folder.gif"; } }
public void FindIssue(appDB.IssueRow ir) { TreeNode tn = FindIssueNode(ir); if (tn != null) { tvIssues.SelectedNode = tn; } }
private void setBindingSourcePosition(int issueId) { if (inEditMode) { InEditModeMessage(); return; } //if (!treeView1.Enabled) // return; issueBindingSource1.Position = issueBindingSource1.Find("IssueId", issueId); //treeView1.Enabled = true; if (CurrentRow().IssueId != 0) { ucFileSelectBox1.Enabled = true; linkLabel2.Enabled = true; parentIssue = AtMng.DB.Issue.FindByIssueId(CurrentRow().ParentIssueId); ebParentIssueName.Text = parentIssue.IssueNameEng; ebParentIssueDescription.Text = parentIssue.IssueDescEng; SetRTFValues(false); } else { ucFileSelectBox1.Enabled = false; linkLabel2.Enabled = false; ebParentIssueName.Text = ""; ebParentIssueDescription.Text = ""; SetRTFValues(true); } if (!CurrentRow().IsFileIdNull()) { uiButton1.Enabled = true; } else { uiButton1.Enabled = false; } TreeNode[] newnode = treeView1.Nodes.Find(issueId.ToString(), true); if (newnode.Length == 1 && newnode[0].Nodes.Count == 0) { cmdDelete.Enabled = Janus.Windows.UI.InheritableBoolean.True; } else { cmdDelete.Enabled = Janus.Windows.UI.InheritableBoolean.False; } if (newnode.Length == 1) { checkNodeForFileId(newnode[0], CurrentRow()); } }
private void treeView1_DragDrop(object sender, DragEventArgs e) { try { Point p = treeView1.PointToClient(new Point(e.X, e.Y)); TreeNode nd = treeView1.HitTest(p).Node; if (nd != null) { nd.ForeColor = Color.Black; nd.NodeFont = new Font(treeView1.Font, FontStyle.Regular); appDB.IssueRow target = (appDB.IssueRow)nd.Tag; TreeNode[] childNodes = NodeDragSource.Nodes.Find(nd.Name, true); appDB.IssueRow irSource = (appDB.IssueRow)NodeDragSource.Tag; if (childNodes.Length > 0) { MessageBox.Show("You cannot move an issue to a child of itself.", "Invalid Move Operation", MessageBoxButtons.OK); } else if (NodeDragSource != nd && irSource.ParentIssueId != target.IssueId) { irSource.ParentIssueId = target.IssueId; issueBindingSource1.EndEdit(); Save(); LoadRoot(); setBindingSourcePosition(irSource.IssueId); setCurrentNode(irSource.IssueId.ToString()); } /*atriumDB.EFileRow file=(atriumDB.EFileRow)src.Tag; * * //do Update with file manager for file * FileManager thisfm = myFM.AtMng.GetFile(file.FileId, false); * thisfm.EFile.Move(thisfm.CurrentFile, target, true); * thisfm.EFile.Update(); * thisfm.AtMng.AppMan.Commit(); * * //reload update file record * file=myFM.EFile.Load(file.FileId, false); * src.Tag = file; * * src.Remove(); * nd.Nodes.Add(src); * tvFiles.SelectedNode = src; */ } } catch (Exception x) { UIHelper.HandleUIException(x); } }
public TreeNode FindIssueNode(appDB.IssueRow ir) { TreeNode tn = FindIssueNodeX(ir); if (tn != null) { tn.EnsureVisible(); selectedIssue = ir; } return(tn); }
private void LoadRootX(atriumManager atmng, int issueId) { appDB.IssueRow rootIssue = atmng.DB.Issue.FindByIssueId(issueId); TreeNode nd = new TreeNode(); nd.Text = rootIssue[SelectedIssueLangText].ToString(); nd.Tag = rootIssue; nd.Name = rootIssue.IssueId.ToString(); tvIssues.Nodes.Add(nd); LoadLevel(nd, issueId); }
private void ucBrowseIssues1_IssueSelected(object sender, TreeNodeMouseClickEventArgs e) { try { if (!ucBrowseIssues1.SelectedIssue.IsFileIdNull()) { selectedIssue = ucBrowseIssues1.SelectedIssue; this.Hide(); } } catch (Exception x) { UIHelper.HandleUIException(x); } }
protected override void AfterAdd(DataRow dr) { appDB.IssueRow ir = (appDB.IssueRow)dr; string ObjectName = this.myIssueDT.TableName; ir.IssueId = this.myA.PKIDGet(ObjectName, 1); ir.IssueNameEng = "[New Issue]"; ir.IssueNameFre = "[New Issue]"; if (ir.IsParentIssueIdNull()) { ir.ParentIssueId = 0; } ir.SortByFileNumber = true; }
private void tvIssues_AfterSelect(object sender, TreeViewEventArgs e) { try { selectedIssue = (appDB.IssueRow)e.Node.Tag; if (IssueNavigated != null) { IssueNavigated(this, e); } } catch (Exception x) { UIHelper.HandleUIException(x); } }
private void tvIssues_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { try { selectedIssue = (appDB.IssueRow)e.Node.Tag; if (IssueSelected != null) { IssueSelected(this, e); } } catch (Exception x) { UIHelper.HandleUIException(x); } }
private void tvIssues_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { try { selectedIssue = (appDB.IssueRow)e.Node.Tag; if (e.Node.Nodes.Count == 0) { LoadLevel(e.Node, selectedIssue.IssueId); e.Node.Expand(); } } catch (Exception x) { UIHelper.HandleUIException(x); } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { try { if (inEditMode) { InEditModeMessage(); return; } selectedIssue = (appDB.IssueRow)e.Node.Tag; setBindingSourcePosition(selectedIssue.IssueId); } catch (Exception x) { UIHelper.HandleUIException(x); } }
private void btnOK_Click(object sender, EventArgs e) { try { if (ucBrowseIssues1.SelectedIssue == null || ucBrowseIssues1.SelectedIssue.IssueId == 0) { MessageBox.Show("Please select an issue."); return; } selectedIssue = ucBrowseIssues1.SelectedIssue; this.Hide(); DialogResult = DialogResult.OK; } catch (Exception x) { UIHelper.HandleUIException(x); } }
public void Import(string path, int rootIssueId, int targetIssueId, int rootFileId) { appDB ds = new appDB(); ds.ReadXml(path); appDB.IssueDataTable tempIssues = ds.Issue; appDB.IssueRow ir = tempIssues.FindByIssueId(rootIssueId); appDB.IssueRow pir = myIssueDT.FindByIssueId(targetIssueId); ImportNode(tempIssues, ir, pir, rootFileId); BusinessProcess bp = myA.GetBP(); bp.AddForUpdate(this); bp.Update(); }
protected override void AfterChange(DataColumn dc, DataRow row) { SST.SSTCaseMatterRow dr = (SST.SSTCaseMatterRow)row; switch (dc.ColumnName) { case "IssueId": //set legislation if (!dr.IsIssueIdNull()) { appDB.IssueRow ir = myA.AtMng.DB.Issue.FindByIssueId(dr.IssueId); if (!ir.IsLegProvisionIdNull()) { dr.LegislationId = ir.LegProvisionId; dr.EndEdit(); } } break; } }
//void fIssues_OnUpdate(object sender, atLogic.UpdateEventArgs e) //{ // if (e.SavedOK) // treeView1.Enabled = true; //} //void Issue_ColumnChanged(object sender, DataColumnChangeEventArgs e) //{ // treeView1.Enabled = false; //} private void LoadRoot() { //load root treeView1.Nodes.Clear(); AtMng.GetIssue().Load(); appDB.IssueRow rootIssue = AtMng.DB.Issue.FindByIssueId(0); TreeNode nd = new TreeNode(); nd.Text = rootIssue.IssueNameEng; nd.Tag = rootIssue; nd.Name = rootIssue.IssueId.ToString(); nd.ImageIndex = 0; nd.SelectedImageIndex = 0; treeView1.SelectedNode = nd; treeView1.Nodes.Add(nd); //treeView1.Sort(); LoadLevel(nd, 0); //treeView1.ExpandAll(); setBindingSourcePosition(rootIssue.IssueId); }
private void ImportNode(appDB.IssueDataTable tempIssues, appDB.IssueRow ir, appDB.IssueRow parentIssue, int rootFileId) { //this will recreate the issue structure //it does not try to synchronize it //only to be used to setup test data appDB.IssueRow newIR = (appDB.IssueRow)Add(null); newIR.ParentIssueId = parentIssue.IssueId; newIR.IssueNameEng = ir.IssueNameEng; newIR.IssueNameFre = ir.IssueNameFre; newIR.SortByFileNumber = ir.SortByFileNumber; //create file FileManager myFile = myA.CreateFile(myA.GetFile(rootFileId)); myFile.CurrentFile.NameE = newIR.IssueNameEng; myFile.CurrentFile.NameF = newIR.IssueNameFre; BusinessProcess bp = myA.GetBP(); bp.AddForUpdate(myFile.EFile); bp.AddForUpdate(myFile.GetFileXRef()); bp.AddForUpdate(myFile.GetFileOffice()); bp.AddForUpdate(myFile.GetFileContact()); bp.AddForUpdate(myFile.EFile); bp.Update(); if (!ir.IsFileIdNull()) { newIR.FileId = myFile.CurrentFile.FileId; } foreach (appDB.IssueRow cir in ir.GetIssueRows()) { ImportNode(tempIssues, cir, newIR, myFile.CurrentFileId); } }
public void FindIssue(int issueId) { appDB.IssueRow ir = Atmng.DB.Issue.FindByIssueId(issueId); ucBrowseIssues1.FindIssue(ir); }
protected override void BeforeUpdate(DataRow row) { SST.SSTCaseMatterRow dr = (SST.SSTCaseMatterRow)row; BeforeChange(mySSTCaseMatterDT.IssueIdColumn, dr); //TFS#56157 BY 2013-9-20 BeforeChange(mySSTCaseMatterDT.OutcomeIdColumn, dr); BeforeChange(mySSTCaseMatterDT.AcceptIssueColumn, dr); //add or update filexref for issue if (!dr.IsIssueIdNull()) { appDB.IssueRow ir = myA.AtMng.DB.Issue.FindByIssueId(dr.IssueId); if (dr.RowState == DataRowState.Added && !ir.IsFileIdNull()) { if (!XrefExists(ir.FileId)) { atriumDB.FileXRefRow fxr = (atriumDB.FileXRefRow)myA.FM.GetFileXRef().Add(myA.FM.CurrentFile); fxr.LinkType = 1; fxr.OtherFileId = ir.FileId; fxr.Rollup = false; fxr.FullFileNumber = myA.FM.EFile.Load(ir.FileId, false).FullFileNumber; } } else if (myA.IsFieldChanged(mySSTCaseMatterDT.IssueIdColumn, dr)) { int origIssueId = (int)dr[mySSTCaseMatterDT.IssueIdColumn, DataRowVersion.Original]; appDB.IssueRow origIr = myA.AtMng.DB.Issue.FindByIssueId(origIssueId); var fxrq = from f in myA.FM.DB.FileXRef where f.OtherFileId == origIr.FileId & f.LinkType == 1 select f; if (fxrq.Count() > 0) // if false, no issue found. { atriumDB.FileXRefRow fxr = fxrq.Single(); if (ir.IsFileIdNull()) { fxr.Delete(); } else { if (XrefExists(ir.FileId)) { fxr.Delete(); } else { //check List <int> files = new List <int>(); foreach (SST.SSTCaseMatterRow scmr in mySSTCaseMatterDT) { if (!scmr.IsIssueIdNull() && scmr.SSTCaseMatterId != dr.SSTCaseMatterId) { appDB.IssueRow ir1 = myA.AtMng.DB.Issue.FindByIssueId(scmr.IssueId); if (!ir1.IsFileIdNull()) { files.Add(ir1.FileId); } } } if (files.Contains(fxr.OtherFileId)) { //another issue uses that xref so add a new xref and don't change the current one atriumDB.FileXRefRow fxr1 = (atriumDB.FileXRefRow)myA.FM.GetFileXRef().Add(myA.FM.CurrentFile); fxr1.LinkType = 1; fxr1.OtherFileId = ir.FileId; fxr1.Rollup = false; fxr1.FullFileNumber = myA.FM.EFile.Load(ir.FileId, false).FullFileNumber; } else { fxr.OtherFileId = ir.FileId; } } } } else // no issue found, so no xref to update; add a new xref. { atriumDB.FileXRefRow fxr1 = (atriumDB.FileXRefRow)myA.FM.GetFileXRef().Add(myA.FM.CurrentFile); fxr1.LinkType = 1; fxr1.OtherFileId = ir.FileId; fxr1.Rollup = false; fxr1.FullFileNumber = myA.FM.EFile.Load(ir.FileId, false).FullFileNumber; } } } }