private void checkNodeForFileId(TreeNode trnd, appDB.IssueRow issue) { if (issue.IsFileIdNull()) { trnd.ImageKey = "folder.gif"; trnd.SelectedImageKey = "folder.gif"; } }
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); } }
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; } } } }