private void Delete() { try { if (UIHelper.ConfirmDelete()) { CurrentRow().Delete(); this.issueBindingSource1.EndEdit(); atLogic.BusinessProcess bp = AtMng.GetBP(); bp.AddForUpdate(AtMng.GetIssue()); bp.Update(); lmDatasets.appDB.IssueRow ir = (lmDatasets.appDB.IssueRow)treeView1.SelectedNode.PrevNode.Tag; treeView1.SelectedNode.Remove(); setBindingSourcePosition(ir.IssueId); setCurrentNode(ir.IssueId.ToString()); //treeView1.Enabled = true; //LoadRoot(); } } catch (Exception x) { throw x; } }
private void Save() { if (AtMng.DB.Issue.HasErrors) { UIHelper.TableHasErrorsOnSaveMessBox(AtMng.DB); } else { try { string nodeKey = CurrentRow().IssueId.ToString(); SaveRtfValues(); this.issueBindingSource1.EndEdit(); atLogic.BusinessProcess bp = AtMng.GetBP(); bp.AddForUpdate(AtMng.GetIssue()); bp.Update(); //LoadRoot(); setCurrentNode(nodeKey); inEditMode = false; lblRtfEdited.Visible = false; SetRTFValues(false); //TreeNode[] tn=treeView1.Nodes.Find(CurrentRow().ParentIssueId.ToString(), true); //TreeNode nd = treeView1.SelectedNode; //nd.Remove(); //tn[0].Nodes.Add(nd); } catch (Exception x) { throw x; } } }
private void New() { lmDatasets.appDB.IssueRow ir = (lmDatasets.appDB.IssueRow)AtMng.GetIssue().Add(CurrentRow()); //LoadRoot(); TreeNode nd = new TreeNode(); nd.Text = ir.IssueNameEng; nd.Tag = ir; nd.Name = ir.IssueId.ToString(); checkNodeForFileId(nd, ir); treeView1.SelectedNode.Nodes.Add(nd); setCurrentNode(ir.IssueId.ToString()); }
//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 linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) //{ // if (CurrentRow().IssueId != 0) // { // if (fbr == null) // fbr = new fBrowse(Atmng, 0,false,false,false); // fbr.ShowDialog(this); // if (fbr.SelectedFile != null) // { // lmDatasets.appDB.IssueRow ir = CurrentRow(); // ir.FileId = fbr.SelectedFile.FileId; // if (ir.IssueNameEng == "[New Issue]") // { // ir.IssueNameEng = fbr.SelectedFile.NameE; // ir.IssueNameFre = fbr.SelectedFile.NameF; // } // setBindingSourcePosition(CurrentRow().IssueId); // } // } // else // { // MessageBox.Show("You cannot link a file to the root issue.", "Invalid Action", MessageBoxButtons.OK); // } //} private void uiCommandManager1_CommandClick(object sender, Janus.Windows.UI.CommandBars.CommandEventArgs e) { try { switch (e.Command.Key) { case "cmdImport": openFileDialog1.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*"; openFileDialog1.FileName = ""; if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { fBrowse fb = new fBrowse(AtMng, 0, false, false, false, true); if (fb.ShowDialog() == System.Windows.Forms.DialogResult.OK) { int fid = fb.SelectedFile.FileId; AtMng.GetIssue().Import(openFileDialog1.FileName, 0, 0, fid); } } break; case "cmdExport": saveFileDialog1.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*"; saveFileDialog1.FileName = "issue" + DateTime.Today.ToString("yyyyMMdd") + ".xml"; if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { AtMng.GetIssue().Export(saveFileDialog1.FileName); } break; case "cmdCancel": Cancel(); break; case "cmdNew": New(); break; case "cmdSave": Save(); break; case "cmdDelete": Delete(); break; case "cmdToggle": if (cmdToggle.Checked != Janus.Windows.UI.InheritableBoolean.True) { treeView1.ExpandAll(); } else { treeView1.CollapseAll(); } break; } } catch (Exception x) { UIHelper.HandleUIException(x); } }