public atriumDB.FileContactRow AddRecipToFile(docDB.RecipientRow r, bool save, string contactType) { FileManager fm = myA.FM; atriumDB.FileContactRow fcr = fm.GetFileContact().Add(r, contactType);; if (save) { BusinessProcess bp = fm.GetBP(); bp.AddForUpdate(fm.GetFileOffice()); bp.AddForUpdate(fm.GetPerson()); bp.AddForUpdate(fm.GetFileContact()); bp.AddForUpdate(fm.EFile); bp.Update(); } return(fcr); }
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 AfterChange(DataColumn dc, DataRow ddr) { atriumDB.FileContactRow dr = (atriumDB.FileContactRow)ddr; //JLL: Fires too often on contactid when it hasn't changed - because of ucContactSelect control switch (dc.ColumnName) { case FileContactFields.ContactType: case FileContactFields.ContactId: if (!dr.IsNull("ContactType") && dr.IsNull("ContactId")) { if (!dr.NoReassign) // only run it if noreassign not set JLL 2015-01-22 { int id = myA.EFile.GetOfficerForContactType(dr.EFileRow, dr.ContactType); if (id != 0) { dr.ContactId = id; dr.EndEdit(); } } } if (!dr.IsNull("ContactType") && !dr.IsNull("ContactId")) { if (dr.ContactType == myA.AtMng.GetSetting(AppStringSetting.LeadPLContactType) && (dr.EFileRow.IsLeadParalegalIDNull() || dr.EFileRow.LeadParalegalID != dr.ContactId)) { dr.EFileRow.LeadParalegalID = dr.ContactId; dr.EFileRow.EndEdit(); } if (dr.ContactType == myA.AtMng.GetSetting(AppStringSetting.OfficerContactType) && (dr.EFileRow.IsOfficerIdNull() || dr.EFileRow.OfficerId != dr.ContactId)) { dr.EFileRow.OfficerId = dr.ContactId; dr.EFileRow.EndEdit(); } //if (dr.ContactType == "FLL" &&(dr.EFileRow.IsLeadLawyerIDNull() || dr.EFileRow.LeadLawyerID != dr.ContactId)) //{ // dr.EFileRow.LeadLawyerID = dr.ContactId; // dr.EFileRow.EndEdit(); //} //JLL: 2010/11/16 Can only have one Lead Lawyer on file //update current Lead Lawyer to Assisting Lawyer, unless trying to update to same if (dr.ContactType == myA.AtMng.GetSetting(AppStringSetting.LeadLawyerContactype)) { foreach (atriumDB.FileContactRow fcr in myA.CurrentFile.GetFileContactRows()) { if (!fcr.IsNull("ContactType") && dr != fcr && fcr.ContactType == "FLL" && fcr.Active) { if (dr.ContactId == fcr.ContactId) { throw new AtriumException(String.Format(Properties.Resources.LeadLawyerAlreadyOnFile, myA.AtMng.AppMan.AppName)); } else { //found current - update to assisting and leave fcr.ContactType = "FAL"; fcr.EndEdit(); break; } } } if (dr.EFileRow.IsLeadLawyerIDNull() || dr.EFileRow.LeadLawyerID != dr.ContactId) { dr.EFileRow.LeadLawyerID = dr.ContactId; dr.EFileRow.EndEdit(); } } //JLL: 2009/07/23 Can only have one Lead Client Contact on file //update current Lead Client Contact to Secondary Client Contact if (dr.ContactType == "FCC") { foreach (atriumDB.FileContactRow fcr in myA.CurrentFile.GetFileContactRows()) { if (!fcr.IsNull("ContactType") && dr != fcr && fcr.ContactType == "FCC" && fcr.Active) { //if (dr.ContactId == fcr.ContactId) //{ // //We need to delete the duplicate somehow. // //to skip the error entirely means we end up with two contacts on the file that is the same person // // opinion/requestdocid beforeChange fires and adds another filecontact record when it is not needed // // maybe perform a check in opinion/requestdocid beforeChange to see if contactids match already and don't add if already OK // throw new AtriumException("The selected contact is already the Lead Client Contact on this file. LawMate does not allow duplicate lead client contacts."); //} //else //found current - update to secondary and leave fcr.ContactType = "FSCC"; fcr.EndEdit(); break; } } } } if (dr.RowState == DataRowState.Added & !dr.IsNull("ContactId") & !dr.IsNull("ContactType")) { //find officeid officeDB.OfficerRow orr = myA.AtMng.OfficeMng.GetOfficer().FindLoad(dr.ContactId); if (orr != null) { //add office to file //if (myA.DB.FileOffice.Rows.Count == 0) // myA.GetFileOffice().LoadByFileId(dr.FileId); if (myA.DB.FileOffice.Select("OfficeID=" + orr.OfficeId.ToString()).Length == 0) { atriumDB.FileOfficeRow fo = (atriumDB.FileOfficeRow)myA.GetFileOffice().Add(myA.CurrentFile); fo.OfficeId = orr.OfficeId; if (dr.ContactType == "FCC" || dr.ContactType == "FHGD") { fo.IsClient = true; object alloc = myA.DB.FileOffice.Compute("Sum(PercentAlloc)", "isclient=1"); if (alloc.GetType() == typeof(decimal)) { fo.PercentAlloc = 100 - System.Convert.ToDecimal(alloc); } else { fo.PercentAlloc = 100; } } } } } break; case FileContactFields.EndDate: //JLL: 2009/07/23 - set active based on end date dr.Active = dr.IsEndDateNull(); dr.HideInToc = !dr.IsEndDateNull(); dr.EndEdit(); break; default: break; } }
public void CreatePersonalFiles(int parentFileId, officeDB.OfficerRow or, bool useSeparatePersonalFiles) { //JLL: 2009/07/27 Note about CONVERSION // when creating personal files in Personnel Management file, structure should be: // Personnel Management // Officers // Role-Based Accounts //check to make sure myfileid is null //if (!or.IsMyFileIdNull()) // throw new AtriumException("File already created."); //check to make sure the officer has an account SecurityDB.secUserRow sur = myA.AtMng.SecurityManager.GetsecUser().GetSecUserForOfficer(or); try { //create my file FileManager myFile = myA.AtMng.CreateFile(myA.AtMng.GetFile(parentFileId)); myFile.CurrentFile.NameE = string.Format("{0}, {1} [{2}]", or.LastName, or.FirstName, or.OfficerCode); myFile.CurrentFile.FileType = "PR"; 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(); //myFile.AtMng.AppMan.Commit(); or.MyFileId = myFile.CurrentFile.FileId; //break security inheritance myFile.EFile.BreakInherit(); //set new perms to this user and sysadmin? AddUserFileRule(sur.UserId, myFile.CurrentFile, (int)atSecurity.SpecialRules.MyPersonalFile); AddUserFileRule((int)atSecurity.SpecialGroups.Everyone, myFile.CurrentFile, (int)atSecurity.SpecialRules.ReadMail); //Create Setting For Below if (!useSeparatePersonalFiles) { or.InboxId = or.MyFileId; or.SentItemsId = or.MyFileId; } else { //create inbox FileManager inbox = myA.AtMng.CreateFile(myFile); inbox.CurrentFile.NameE = "Inbox"; inbox.CurrentFile.NameF = "Dossier corbeille arrivée"; BusinessProcess bpi = myA.GetBP(); bpi.AddForUpdate(inbox.EFile); bpi.AddForUpdate(inbox.GetFileXRef()); bpi.AddForUpdate(inbox.GetFileOffice()); bpi.AddForUpdate(inbox.GetFileContact()); bpi.AddForUpdate(inbox.EFile); bpi.Update(); or.InboxId = inbox.CurrentFile.FileId; //create sentitems FileManager sentItems = myA.AtMng.CreateFile(myFile); sentItems.CurrentFile.NameE = "Sent Items"; sentItems.CurrentFile.NameF = "Dossier corbeille envoyée"; BusinessProcess bpsi = myA.GetBP(); bpsi.AddForUpdate(sentItems.EFile); bpsi.AddForUpdate(sentItems.GetFileXRef()); bpsi.AddForUpdate(sentItems.GetFileOffice()); bpsi.AddForUpdate(sentItems.GetFileContact()); bpsi.AddForUpdate(sentItems.EFile); bpsi.Update(); or.SentItemsId = sentItems.CurrentFile.FileId; } //create shortcuts FileManager shortcuts = myA.AtMng.CreateFile(myFile); shortcuts.CurrentFile.NameE = "My Shortcuts"; shortcuts.CurrentFile.NameF = "Dossier de raccourcis"; shortcuts.CurrentFile.MetaType = "SC"; BusinessProcess bpsc = myA.GetBP(); bpsc.AddForUpdate(shortcuts.EFile); bpsc.AddForUpdate(shortcuts.GetFileXRef()); bpsc.AddForUpdate(shortcuts.GetFileOffice()); bpsc.AddForUpdate(shortcuts.GetFileContact()); bpsc.AddForUpdate(shortcuts.EFile); bpsc.Update(); or.ShortcutsId = shortcuts.CurrentFile.FileId; } catch (Exception x) { //myA.AtMng.AppMan.Rollback(); throw x; } }
protected override void BeforeUpdate(DataRow row) { officeDB.OfficeRow dr = (officeDB.OfficeRow)row; FileManager fm = this.myA.AtMng.GetFile(dr.OfficeFileId); fm.CurrentFile.NameE = dr.OfficeName; fm.CurrentFile.NameF = dr.OfficeNameFre; //JLL: 2007/07/28 //commented out below, fails to execute properly - moved to afterupdate if (dr.RowState == DataRowState.Added) { fm.GetFileOffice().AddOfficeToFile(dr.OfficeId, false, true, false); } // atriumDB.EFileRow currentFile=fm.CurrentFile; // atriumDB.EFileRow pmFile=(atriumDB.EFileRow)fm.EFile.Add(currentFile); // pmFile.BeginEdit(); // pmFile.LeadOfficeId = currentFile.LeadOfficeId; // pmFile.NameE="Personnel Management"; // pmFile.NameF="Personnel Management"; // pmFile.FileType="PM"; // pmFile.EndEdit(); // //fm.CurrentFile=currentFile; // if(dr.IsOnLine) // { // //add help desk file // atriumDB.EFileRow helpFile=(atriumDB.EFileRow)fm.EFile.Add(currentFile); // helpFile.BeginEdit(); // helpFile.LeadOfficeId = currentFile.LeadOfficeId; // helpFile.NameE="Help Desk Requests"; // helpFile.NameF="Help Desk Requests"; // helpFile.FileType="HD"; // helpFile.EndEdit(); // //fm.CurrentFile=currentFile; // } // //JLL: How do i get that data loaded in here? // if(dr.CB) //OfficeType data not loaded // { // //add payment file // atriumDB.EFileRow payFile=(atriumDB.EFileRow)fm.EFile.Add(currentFile); // payFile.BeginEdit(); // payFile.LeadOfficeId = currentFile.LeadOfficeId; // payFile.NameE="Receipt and Remittance of Payments"; // payFile.NameF="Receipt and Remittance of Payments"; // payFile.FileType="AC"; // payFile.EndEdit(); // //fm.CurrentFile=currentFile; // } // //JLL: How do i get that data loaded in here? // if(dr.Billing) //OfficeType data not loaded // { // //add billing file // atriumDB.EFileRow billFile=(atriumDB.EFileRow)fm.EFile.Add(currentFile); // billFile.BeginEdit(); // billFile.LeadOfficeId = currentFile.LeadOfficeId; // billFile.NameE="Billings"; // billFile.NameF="Billings"; // billFile.FileType="AB"; // billFile.EndEdit(); // //fm.CurrentFile=currentFile; // } // //fm.CurrentFile=currentFile; //} }