protected override void BeforeUpdate(DataRow row) { base.BeforeUpdate(row); atriumDB.ContactRow dr = (atriumDB.ContactRow)row; //find the related filecontact record and force an update on it by setting updateDate = DateTime.Now.ToUniversalTime(); atriumDB.FileContactRow fcr = (atriumDB.FileContactRow)myA.DB.FileContact.Select("ContactId=" + dr.ContactId.ToString())[0]; if (fcr != null) { fcr.updateDate = DateTime.Now.ToUniversalTime(); } if (row.RowState != DataRowState.Added && (!row["SIN", DataRowVersion.Original].Equals(row["SIN", DataRowVersion.Current]) || !row["LastName", DataRowVersion.Original].Equals(row["LastName", DataRowVersion.Current]) || !row["FirstName", DataRowVersion.Original].Equals(row["FirstName", DataRowVersion.Current]))) { if (!row.IsNull(myPersonDT.LastNameColumn, DataRowVersion.Original) && !row.IsNull(myPersonDT.FirstNameColumn, DataRowVersion.Original)) { this.myA.GetAKA(); atriumDB.AKARow drAka = this.myA.DB.AKA.NewAKARow(); this.myA.DB.AKA.AddAKARow(drAka); drAka.BeginEdit(); drAka.LastName = row["LastName", DataRowVersion.Original].ToString(); drAka.FirstName = row["FirstName", DataRowVersion.Original].ToString(); drAka.SIN = row["SIN", DataRowVersion.Original].ToString(); drAka.ContactId = (int)row["ContactId"]; drAka.EndEdit(); } //this.myA.GetAKA().Update(); //drAka.AcceptChanges(); } }
protected override void AfterUpdate(DataRow dr) { atriumDB.AddressRow addr = (atriumDB.AddressRow)dr; //CLAS hook if (!myA.CurrentFile.IsOpponentIDNull() && addr.ContactId == myA.CurrentFile.OpponentID) { //find contact and determine if update is occuring on current address atriumDB.ContactRow cr = myA.DB.Contact.FindByContactId(addr.ContactId); bool updateFileStuct = false; if (cr == null) //collections file opening; contact not in DB yet { //find debtor in CLASManager DB if (myA.GetCLASMng().DB.Debtor[0].AddressCurrentID == addr.AddressId) { updateFileStuct = true; } } else if (!cr.IsAddressCurrentIDNull() && cr.AddressCurrentID == addr.AddressId) { updateFileStuct = true; } if (updateFileStuct) { //update toc for DB filecontact System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); xd.InnerXml = myA.CurrentFile.FileStructXml; myA.GetFileContact().MyXml(myA.CurrentFile, xd); myA.CurrentFile.FileStructXml = xd.InnerXml; } } }
protected override void BeforeChange(DataColumn dc, DataRow ddr) { string ObjectName = this.myPersonDT.TableName; atriumDB.ContactRow dr = (atriumDB.ContactRow)ddr; try { base.BeforeChange(dc, ddr); } catch (AtriumException x) { switch (dc.ColumnName) { case "SIN": //TFS#54669 CJW 2013-09-20 call swapsin when a duplicate if (x.Message == atriumBE.Properties.Resources.DebtDuplicateSIN) { SwapBySIN(dr, dr.SIN); } else { throw; } break; default: throw; } } }
public void Resolve(atriumDB.ContactRow cr, docDB.RecipientRow newR) { if (!cr.IsEmailAddressNull()) { newR.Address = cr.EmailAddress; //addresstype will default to SMTP so that shouldbe the primary email type for all users } else { if (!cr.IsAddressCurrentIDNull()) { atriumDB.AddressRow ar = myA.FM.DB.Address.FindByAddressId(cr.AddressCurrentID); if (ar == null) { myA.FM.GetAddress().LoadByContactId(cr.ContactId); ar = myA.FM.DB.Address.FindByAddressId(cr.AddressCurrentID); } if (!ar.IsEmailAddressNull()) { newR.Address = ar.EmailAddress; } } if (newR.DocumentRow.isLawmail && newR.IsAddressNull()) { throw new ValidationException(String.Format(Properties.Resources.ContactNoEmailOnResolveAttempt, cr.DisplayName)); } } newR.Name = cr.DisplayName; }
protected override void AfterAdd(DataRow row) { base.AfterAdd(row); atriumDB.ContactRow dr = (atriumDB.ContactRow)row; string ObjectName = this.myPersonDT.TableName; dr.AddressNotCurrent = false; dr.ContactClass = "C"; //TODO 2013-2-12 CJW do we really need this here? What lists are getting cached of contacts //myA.AtMng.ClearCodesCache(); }
private DataRow AddX(atriumDB.ContactRow cr) { atriumDB.AddressRow dr = (atriumDB.AddressRow)base.Add(cr); dr.ContactId = cr.ContactId; if (cr.IsAddressCurrentIDNull()) { cr.AddressCurrentID = dr.AddressId; } return(dr); }
protected override void AfterChange(DataColumn dc, DataRow dr) { docDB.RecipientRow row = (docDB.RecipientRow)dr; switch (dc.ColumnName) { case "OfficerId": //get officer record and set officeid,name,email officeDB.OfficerRow or = myA.AtMng.OfficeMng.DB.Officer.FindByOfficerId(row.OfficerId); if (or == null) { or = myA.AtMng.OfficeMng.GetOfficer().Load(row.OfficerId); } if (or != null) { DoNotResolve = true; row.OfficeId = or.OfficeId; row.Name = or.LastName + ", " + or.FirstName + " (" + or.OfficerCode + ")"; row.Address = or.EmailAddress; row.EndEdit(); DoNotResolve = false; } else { atriumDB.ContactRow cr = myA.FM.GetPerson().Load(row.OfficerId); if (cr != null) { DoNotResolve = true; // row.SetOfficerIdNull(); Resolve(cr, row); DoNotResolve = false; } } break; case "Address": //get officer record and set officeid,name,email if (row.IsAddressNull()) { row.Delete(); } else { if (!DoNotResolve) { Resolve(row.Address, row.Address, row, false); } row.EndEdit(); } break; } }
public officeDB.OfficerRow AddFromContact(atriumDB.ContactRow contactR, officeDB.OfficeRow officeR) { officeDB.OfficerRow or = (officeDB.OfficerRow)Add(officeR); or.ContactId = contactR.ContactId; or.OfficerId = or.ContactId; or.OfficeId = officeR.OfficeId; foreach (DataColumn dc in contactR.Table.Columns) { if (!contactR.IsNull(dc)) { or[dc.ColumnName] = contactR[dc]; } } return(or); }
private void LoadAttendeeContacts(int contactID) { InitContactTable(); DataRow[] crow = (DataRow[])contactDT.Select("contactId=" + contactID); if (crow.Length == 0) { atriumDB.ContactRow cr = FM.GetPerson().Load(contactID); contactDT.Rows.Add(cr.ContactId, cr.DisplayName); } contactDT.AcceptChanges(); DataView contactDV = new DataView(contactDT); attendeeGridEX.DropDowns["ddContact"].SetDataBinding(contactDV, ""); }
private void filePartyBindingSource_CurrentChanged(object sender, EventArgs e) { try { atriumDB.FileContactRow fcr = CurrentRow(); if (fcr == null || fcr.IsNull("FileContactId")) { return; } TogglePartyEditableMode(false); partyBindingSource.Position = partyBindingSource.Find("ContactId", fcr.ContactId.ToString()); ApplySecurity(fcr); //check for address record and set binding source position atriumDB.ContactRow pr = CurrentRowParty(); if (pr == null || pr.IsNull("ContactId")) { return; } if (!pr.IsAddressCurrentIDNull() && CurrentRowAddress() != null) { addressBindingSource.Position = addressBindingSource.Find("AddressId", pr.AddressCurrentID.ToString()); gbAddress.Visible = true; } else { gbAddress.Visible = false; } } catch (Exception x) { UIHelper.HandleUIException(x); } }
private void AddAttendeeToTimeline(TimeLineField ContactField, atriumDB.AttendeeRow atr) { var fcx = from fc in myFM.DB.FileContact where fc.ContactId == atr.ContactId select fc; if (fcx.Count() == 1) { atriumDB.FileContactRow fcr = fcx.Single(); ContactField.ValueList.Add(new TimeLineValueListItem(atr.ContactId, fcr.DisplayName, 0)); } else { atriumDB.ContactRow cr = myFM.GetPerson().Load(atr.ContactId); ContactField.ValueList.Add(new TimeLineValueListItem(atr.ContactId, cr.DisplayName, 0)); //TODO find contact } myFM.GetAppointment().LoadByContactIdDates(atr.ContactId, RangeStartDate, RangeEndDate); AddDummyAppointmentForFileContacts(atr); }
private void LoadAttendeeContacts() { InitContactTable(); foreach (atriumDB.AttendeeRow attrow in FM.DB.Attendee.Rows) { var fcx = from fc in FM.DB.FileContact where fc.ContactId == attrow.ContactId select fc; if (fcx.Count() == 1) { atriumDB.FileContactRow fcr = fcx.Single(); DataRow[] crow = (DataRow[])contactDT.Select("contactId=" + fcr.ContactId); if (crow.Length < 1) { contactDT.Rows.Add(fcr.ContactId, fcr.DisplayName); } } else { DataRow[] crow = (DataRow[])contactDT.Select("contactId=" + attrow.ContactId); atriumDB.ContactRow cr = null; if (crow.Length == 0) { cr = FM.GetPerson().Load(attrow.ContactId); contactDT.Rows.Add(cr.ContactId, cr.DisplayName); } } } contactDT.AcceptChanges(); DataView contactDV = new DataView(contactDT); attendeeGridEX.DropDowns["ddContact"].SetDataBinding(contactDV, ""); }
public atriumDB.FileContactRow Add(docDB.RecipientRow or, string contactType) { //if (myA.DB.FileContact.Rows.Count == 0) // LoadByFileId(myA.CurrentFile.FileId); if (or.IsOfficerIdNull()) { //create free contact myA.GetPerson(); atriumDB.ContactRow c = myA.DB.Contact.NewContactRow(); myA.DB.Contact.AddContactRow(c); c.EmailAddress = or.Address; if (or.Name.Contains(",")) { c.LastName = or.Name.Split(',')[0]; c.FirstName = or.Name.Split(',')[1]; } else if (or.Name.Contains(" ")) { c.LastName = or.Name.Split(' ')[1]; c.FirstName = or.Name.Split(' ')[0]; } else { c.FirstName = "[n/a]"; c.LastName = or.Name; } //assign contactid to recip record or.OfficerId = c.ContactId; atriumDB.FileContactRow fcr = (atriumDB.FileContactRow)Add(myA.CurrentFile); fcr.ContactId = c.ContactId; fcr.ContactType = contactType; fcr.Active = true; fcr.StartDate = DateTime.Today; return(fcr); } else { if (myA.DB.FileContact.Select("ContactId=" + or.OfficerId.ToString()).Length == 0) { //add filecontact //atriumDB.FileContactRow[] fcrs = (atriumDB.FileContactRow[])myA.DB.FileContact.Select("ContactType='"+contactType+"'","", DataViewRowState.Added); //atriumDB.FileContactRow fcr; //if (fcrs.Length == 1) //{ // fcr = fcrs[0]; //} //else //{ atriumDB.FileContactRow fcr = (atriumDB.FileContactRow)Add(myA.CurrentFile); fcr.ContactType = contactType; fcr.ContactId = or.OfficerId; fcr.Active = true; fcr.StartDate = DateTime.Today; if (!or.IsOfficeIdNull()) { fcr.OfficeId = or.OfficeId; } } return((atriumDB.FileContactRow)myA.DB.FileContact.Select("ContactId=" + or.OfficerId.ToString())[0]); } }
private void DoSave() { if (myfmAB.DB.HasErrors) { UIHelper.TableHasErrorsOnSaveMessBox(myfmAB.DB); } else { try { string attemptDebtorUpdateMessage = ""; string sharedContactMessage = ""; if (myfmAB.DB.FileContact.GetChanges(DataRowState.Modified) != null) { foreach (atriumDB.FileContactRow fcr in (atriumDB.FileContactDataTable)myfmAB.DB.FileContact.GetChanges(DataRowState.Modified)) { if (fcr.IsOfficeIdNull()) { if (!myfmAB.GetFileContact().IsADebtor(fcr.ContactId)) { atriumDB.ContactRow cr = myfmAB.GetPerson().Load(fcr.ContactId); int sharedCount = myfmAB.GetFileContact().FileContactCount(fcr.ContactId); if (sharedCount > 1) { sharedContactMessage += String.Format(LawMate.Properties.Resources.TheContactIsASharedContact, fcr.FirstName, fcr.LastName, sharedCount); } cr.LastName = fcr.LastName; cr.FirstName = fcr.FirstName; if (fcr.IsTelephoneNumberNull()) { cr.SetTelephoneNumberNull(); } else { cr.TelephoneNumber = fcr.TelephoneNumber; } if (fcr.IsTelephoneExtensionNull()) { cr.SetTelephoneExtensionNull(); } else { cr.TelephoneExtension = fcr.TelephoneExtension; } if (fcr.IsFaxNumberNull()) { cr.SetFaxNumberNull(); } else { cr.FaxNumber = fcr.FaxNumber; } if (fcr.IsCellPhoneNull()) { cr.SetCellPhoneNull(); } else { cr.CellPhone = fcr.CellPhone; } if (fcr.IsEmailAddressNull()) { cr.SetEmailAddressNull(); } else { cr.EmailAddress = fcr.EmailAddress; } } else { attemptDebtorUpdateMessage += String.Format(LawMate.Properties.Resources.AttemptedToUpdateContactInfoForDebtor, fcr.FirstName, fcr.LastName, AtMng.AppMan.AppName); } } } } if (attemptDebtorUpdateMessage.Length > 0) { MessageBox.Show(attemptDebtorUpdateMessage, LawMate.Properties.Resources.UpdateOfOpponentContact, MessageBoxButtons.OK, MessageBoxIcon.Information); } if (sharedContactMessage.Length > 0) { sharedContactMessage += LawMate.Properties.Resources.ContactInfoUpdatedForEveryUserOrFileThatSharesContact; MessageBox.Show(sharedContactMessage, LawMate.Properties.Resources.UpdateOfSharedContacts, MessageBoxButtons.OK, MessageBoxIcon.Information); } fileContactGridEX.UpdateData(); fileContactBindingSource.EndEdit(); myfmAB.SaveAll(); //atLogic.BusinessProcess bp = myfmAB.GetBP(); //bp.AddForUpdate(myfmAB.GetFileContact()); //bp.AddForUpdate(myfmAB.GetPerson()); //bp.Update(); // myfmAB.GetFileContact().LoadByFileId(myfmAB.CurrentFile.FileId); ClearModifiedFlag(); } catch (Exception x) { UIHelper.HandleUIException(x); } } }
private void EI_WS(SST.ADMSLookupRow ADMSr, MapBE map, ADMS.ADMS_LookupClient ws) { ACEngine ace = myA.FM.CurrentActivityProcess.CurrentACE; DataSet ds = ws.Get_ADMS_SST_Info(ADMSr.ReconID, ADMSr.SIN, ADMSr.BusinessNumber); if (ds.Tables.Contains("ERROR")) { //get status message ADMSr.Message = ds.Tables["ERROR"].Rows[0]["MESSAGE"].ToString(); if (ADMSr.Message.ToUpper() == "SUCCESS") { if (ds.Tables.Contains("ADMS_SST_INFO")) { DataTable dtR = ds.Tables["ADMS_SST_INFO"]; DataRow dr = dtR.Rows[0]; SST.SSTCaseRow scr = (SST.SSTCaseRow)myA.GetSSTCase().GetCurrentRow()[0]; // scr.AppelantSourceId = System.Convert.ToInt32(map.MapIn("AppelantSource", dr["CODE_SRC"].ToString())); scr.ReconsiderationID = ADMSr.ReconID; if (!dr.IsNull("DATE_DCSN_ISD")) { scr.OrigDecisionDate = System.Convert.ToDateTime(dr["DATE_DCSN_ISD"]); } int officeid = System.Convert.ToInt32(map.MapIn("Office", dr["ID_OFC_ANCHR"].ToString())); atriumDB.FileOfficeRow focr = myA.FM.GetFileOffice().AddOfficeToFile(officeid, false, false, false); focr.OfficeFileNum = scr.ReconsiderationID.ToString(); //find the gd account OfficeManager om = myA.AtMng.GetOffice(focr.OfficeId); if (om.DB.Officer.Rows.Count == 0) { om.GetOfficer().LoadByOfficeId(focr.OfficeId); } var oGD = from o in om.DB.Officer where o.PositionCode == "GD" select o; if (oGD.Count() == 1) { atriumDB.FileContactRow fcr = myA.FM.GetFileContact().Add(oGD.Single(), "FHGD"); fcr.HideInToc = true; } if (ds.Tables.Contains("ADMS_SST_INFO_PARTICIPANTS")) { // string participantType = map.MapIn("Source2Participant", dr["CODE_SRC"].ToString()); foreach (DataRow drp in ds.Tables["ADMS_SST_INFO_PARTICIPANTS"].Rows) { bool isAppellant = false; if (!ADMSr.IsSINNull() && !drp.IsNull("ID_SIN") && ADMSr.SIN == drp["ID_SIN"].ToString()) { isAppellant = true; } else if (!ADMSr.IsBusinessNumberNull() && !drp.IsNull("ID_BSNS_NMBR")) { isAppellant = IsEmployerAppellant(ADMSr, drp, isAppellant); } if (isAppellant) { atriumDB.ContactRow pr = (atriumDB.ContactRow)ace.relTables["Party0"][0].Row; atriumDB.FileContactRow fcr4 = (atriumDB.FileContactRow)ace.relTables["FileContact4"][0].Row; SST.FilePartyRow fpr = (SST.FilePartyRow)ace.relTables["FileParty0"][0].Row; fpr.IsAppellant = true; pr.SIN = drp["ID_SIN"].ToString(); pr.ContactClass = "P"; //if (pr.GetColumnError("SIN") == Properties.Resources.DebtDuplicateSIN) //changed test to test for Added as the column error would never be present on the exisiting contact after the swap if (pr.RowState != DataRowState.Added) { //TFS#54669 CJW 2013-09-20 called in PersonBE beforechange now //pr = myA.FM.GetPerson().SwapBySIN(pr, pr.SIN); pr = (atriumDB.ContactRow)ace.relTables["Party0"][0].Row; fcr4 = (atriumDB.FileContactRow)ace.relTables["FileContact4"][0].Row; fpr = (SST.FilePartyRow)ace.relTables["FileParty0"][0].Row; //alert user off swap ADMSr.Message = Properties.Resources.ExistingPartyFound; } pr.LastName = drp["NAME_INDVDL_LST"].ToString(); pr.FirstName = drp["NAME_INDVDL_FRST"].ToString(); pr.LanguageCode = map.MapIn("LanguageCode", drp["CODE_LNG"].ToString()); pr.BusinessNumber = drp["ID_BSNS_NMBR"].ToString(); pr.LegalName = drp["NAME_ORG"].ToString(); pr.OperatingAs = drp["NAME_ORG_UNT"].ToString(); pr.PartyTypeCode = map.MapIn("ContactType", drp["CODE_PRTCPNT_TYP"].ToString()); fcr4.ContactId = pr.ContactId; fcr4.ContactType = pr.PartyTypeCode; fpr.FileContactId = fcr4.FileContactid; pr.TelephoneNumber = drp["NMBR_TLPHN_AR_CD_H"].ToString() + "-" + drp["NMBR_TLPHN_LCL_H"].ToString(); if (!pr.IsAddressCurrentIDNull()) { atriumDB.AddressRow ar = myA.FM.DB.Address.FindByAddressId(pr.AddressCurrentID); ar.ContactId = pr.ContactId; ar.EffectiveTo = DateTime.Today; ar.AddressSourceCode = "HRDC"; ar.Address1 = drp["ADRS_LN_1"].ToString(); ar.Address2 = drp["ADRS_LN_2"].ToString(); ar.Address3 = drp["ADRS_LN_3"].ToString(); string prov = map.MapIn("Province", drp["CODE_PRVNC_OR_ST"].ToString()); if (prov != null) { DataTable dtProv = myA.FM.Codes("Province"); DataRow drs = dtProv.Rows.Find(prov); if (drs != null) { ar.CountryCode = drs["CountryCode"].ToString(); } else { ar.CountryCode = "CDN"; } } else { ar.CountryCode = map.MapIn("Country", drp["NAME_CNTRY"].ToString()); if (drp.IsNull("NAME_CNTRY") || ar.IsNull("CountryCode")) { ar.CountryCode = "CDN"; } } ar.ProvinceCode = prov; ar.City = drp["ADRS_MNCPLTY"].ToString(); ar.PostalCode = drp["CODE_PSTL_OR_ZIP"].ToString(); } } else { //add other participants automatically AddOtherParty(map, drp); } } } } } else if (ADMSr.Message.ToUpper() == "ERROR") { // ADMSr.SetColumnError("Message", ADMSr.Message); ADMSr.Message = ds.Tables["ERROR"].Rows[0]["SQL"].ToString(); if (ADMSr.Message.StartsWith("ORA-01403")) { ADMSr.Message = "No matching reconsideration found in ADMS. / Aucune révision correspondante trouvée dans le SGPA."; } else if (ADMSr.Message.StartsWith("ORA-01422")) { ADMSr.Message = "More than one matching reconsideration found in ADMS. / Il y a plus qu'une révision correspondante trouvée dans le SGPA."; } else if (ADMSr.Message.StartsWith("ORA-1017")) { ADMSr.Message = "Configuration problem with ADMS EI web service. Contact IT support. / Il y a un problème de configuration avec le service web A-E SGPA. Contactez le support TI."; } else if (ADMSr.Message.StartsWith("ORA-12154")) { ADMSr.Message = "Configuration problem with ADMS EI web service. Contact IT support. / Il y a un problème de configuration avec le service web A-E SGPA. Contactez le support TI."; } } } }
public atriumDB.ContactRow SwapBySIN(atriumDB.ContactRow pr, string SIN) { if (pr.RowState == DataRowState.Added) { //load exisiting party row LoadBySIN(SIN); myA.RaiseWarning(WarningLevel.Display, Properties.Resources.ExistingPartyFound, myA.AtMng.AppMan.AppName); var ps = from p in myPersonDT where !p.IsSINNull() && p.SIN == SIN && pr.ContactId != p.ContactId select p; atriumDB.ContactRow existingPerson = ps.Single(); int currentContactId = pr.ContactId; //replace party row in related fields ACEngine ace = myA.CurrentActivityProcess.CurrentACE; if (ace.relTables.ContainsKey("Party0")) { DataView dv = new DataView(myPersonDT, "ContactId=" + existingPerson.ContactId.ToString(), "", DataViewRowState.CurrentRows); ace.relTables["Party0"].RowFilter = dv.RowFilter; } //swap address if (ace.relTables.ContainsKey("Address0") && !existingPerson.IsAddressCurrentIDNull()) { myA.DB.Address.FindByAddressId(pr.AddressCurrentID).Delete(); myA.GetAddress().Load(existingPerson.AddressCurrentID); DataView dv = new DataView(myA.DB.Address, "AddressId=" + existingPerson.AddressCurrentID.ToString(), "", DataViewRowState.CurrentRows); ace.relTables["Address0"].RowFilter = dv.RowFilter; } else if (ace.relTables.ContainsKey("Address0") && existingPerson.IsAddressCurrentIDNull()) { atriumDB.AddressRow adr = myA.DB.Address.FindByAddressId(pr.AddressCurrentID); adr.ContactId = existingPerson.ContactId; existingPerson.AddressCurrentID = adr.AddressId; } //change contact id on filecontact var fcs = from fc in myA.DB.FileContact where !fc.IsNull("ContactId") && fc.ContactId == currentContactId select fc; if (fcs.Count() == 1) { atriumDB.FileContactRow fcr = fcs.Single(); fcr.ContactId = existingPerson.ContactId; } pr.Delete(); // pr.AcceptChanges(); return(existingPerson); } else { return(pr); } }
private void AddOtherParty(MapBE map, DataRow drp) { atriumDB.ContactRow pr = null; //search for party if (!drp.IsNull("ID_SIN")) { string SIN = drp["ID_SIN"].ToString(); myA.FM.GetPerson().LoadBySIN(SIN); var ps = from p in myA.FM.DB.Contact where !p.IsSINNull() && p.SIN == SIN select p; if (ps.Count() == 1) { pr = ps.Single(); } } if (pr == null) { //create party pr = (atriumDB.ContactRow)myA.FM.GetPerson().Add(null); pr.SIN = drp["ID_SIN"].ToString(); } pr.ContactClass = "P"; //if (drp.IsNull("NAME_INDVDL_LST")) // pr.LastName = "Resources"; //else pr.LastName = drp["NAME_INDVDL_LST"].ToString(); //if (drp.IsNull("NAME_INDVDL_FRST")) // pr.FirstName = "Human"; //else pr.FirstName = drp["NAME_INDVDL_FRST"].ToString(); pr.LanguageCode = map.MapIn("LanguageCode", drp["CODE_LNG"].ToString()); pr.BusinessNumber = drp["ID_BSNS_NMBR"].ToString(); pr.LegalName = drp["NAME_ORG"].ToString(); pr.OperatingAs = drp["NAME_ORG_UNT"].ToString(); pr.PartyTypeCode = map.MapIn("ContactType", drp["CODE_PRTCPNT_TYP"].ToString()); pr.TelephoneNumber = drp["NMBR_TLPHN_AR_CD_H"].ToString() + "-" + drp["NMBR_TLPHN_LCL_H"].ToString(); //create address atriumDB.AddressRow ar = (atriumDB.AddressRow)myA.FM.GetAddress().Add(pr); // ar.ContactId = pr.ContactId; ar.EffectiveTo = DateTime.Today; ar.AddressSourceCode = "HRDC"; ar.Address1 = drp["ADRS_LN_1"].ToString(); ar.Address2 = drp["ADRS_LN_2"].ToString(); ar.Address3 = drp["ADRS_LN_3"].ToString(); string prov = map.MapIn("Province", drp["CODE_PRVNC_OR_ST"].ToString()); if (prov != null) { DataTable dtProv = myA.FM.Codes("Province"); DataRow drs = dtProv.Rows.Find(prov); if (drs != null) { ar.CountryCode = drs["CountryCode"].ToString(); } else { ar.CountryCode = "CDN"; } } else { ar.CountryCode = map.MapIn("Country", drp["NAME_CNTRY"].ToString()); if (drp.IsNull("NAME_CNTRY") || ar.IsNull("CountryCode")) { ar.CountryCode = "CDN"; } } ar.ProvinceCode = prov; ar.City = drp["ADRS_MNCPLTY"].ToString(); ar.PostalCode = drp["CODE_PSTL_OR_ZIP"].ToString(); // pr.AddressCurrentID = ar.AddressId; //create filecontact atriumDB.FileContactRow fcrp = (atriumDB.FileContactRow)myA.FM.GetFileContact().Add(myA.FM.CurrentFile); fcrp.ContactId = pr.ContactId; fcrp.ContactType = pr.PartyTypeCode; //create fileparty SST.FilePartyRow fpr = (SST.FilePartyRow)myA.GetFileParty().Add(myA.FM.CurrentFile); // fpr.PartyId = pr.PartyId; // fpr.ContactTypeCode = pr.PartyTypeCode; fpr.IsPending = true; fpr.FileContactId = fcrp.FileContactid; }
private void fileContactBindingSource_CurrentChanged(object sender, EventArgs e) { try { atriumDB.FileContactRow fcr = CurrentRow(); if (fcr==null|| fcr.IsNull("FileContactid")) return; TogglePartyEditableMode(false); switch (fcr.ContactClass) { case "O": verifyContactType(true, false); UIHelper.ComboBoxInit("ContactTypeFile", ucMultiDropDown1, FM); break; case "P": displayParticipant(); UIHelper.ComboBoxInit("Test", ucMultiDropDown1, FM); //verifyContactType(false, true); break; default: verifyContactType(false,false); UIHelper.ComboBoxInit("ContactType", ucMultiDropDown1, FM); break; } atriumDB.ContactRow pr = CurrentRowContact(); if (pr == null || pr.IsNull("ContactId")) return; contactBindingSource.Position = contactBindingSource.Find("ContactId", fcr.ContactId); if (!CurrentRowContact().IsAddressCurrentIDNull() && (CurrentRow().IsPositionCodeNull() || CurrentRow().PositionCode !="TM")) { atriumDB.AddressRow adr = FM.DB.Address.FindByAddressId(CurrentRowContact().AddressCurrentID); if (adr == null) FM.GetAddress().Load(CurrentRowContact().AddressCurrentID); addressBindingSource.Filter = ""; addressBindingSource.Position = addressBindingSource.Find("AddressId", CurrentRowContact().AddressCurrentID.ToString()); ucAddress1.Visible = true; btnAddAddress.Visible = false; } else { //addressBindingSource.Filter = "contactid=0"; if(fcr.ContactClass=="P" || fcr.ContactClass=="B") btnAddAddress.Visible = true; else btnAddAddress.Visible = false; ucAddress1.Visible = false; } if (!CurrentRow().IsPositionCodeNull() && CurrentRow().PositionCode == "TM") { btnAddAddress.Visible = false; ucAddress1.Visible = false; } ApplySecurity(fcr); } catch (Exception x) { UIHelper.HandleUIException(x); } }
public void Resolve(string userInput, string display, docDB.RecipientRow newR, bool showDialog) { officeDB.OfficerRow or = null; //TODO:resolve from autocomplete first! userInput = userInput.Replace("'", "''"); //not sure why auto-complete was taking precedence //this will prevent look up from resolving officer before they were created or = myA.AtMng.OfficeMng.GetOfficer().LoadByEmail(userInput); if (or != null && or.CurrentEmployee) { Resolve(or, newR); return; } //JL: old email addresses with 'INET[' fail on line below: Address='" + userInput +" //data clean up required? //userInput = userInput.Replace("INET[", ""); //userInput = userInput.Replace("]", ""); DataRow[] drAuto = myA.AtMng.RecipientGetRecentSent().Select("Address='" + userInput + "'"); if (drAuto.Length > 0) { //add recipient row if (drAuto[0].IsNull("OfficerId")) { newR.Address = drAuto[0]["email"].ToString(); newR.Name = drAuto[0]["Name"].ToString(); if (!drAuto[0].IsNull("ListId")) { newR.ListId = (int)drAuto[0]["ListId"]; } } else { or = myA.AtMng.OfficeMng.GetOfficer().FindLoad((int)drAuto[0]["OfficerId"]); if (or != null) { Resolve(or, newR); } else { newR.OfficerId = (int)drAuto[0]["OfficerId"]; newR.Address = drAuto[0]["email"].ToString(); newR.Name = drAuto[0]["Name"].ToString(); } } return; } ////resolve by officecode //try //{ // officeDB.OfficeRow off = myA.AtMng.GetOffice(userInput).CurrentOffice; // Resolve(off, newR); // return; //} //catch (Exception xo) //{ // //do nothing it just means the office didn't exist //} //resolve by list appDB.ListRow[] lr = (appDB.ListRow[])myA.AtMng.DB.List.Select("ListNameEng like '" + userInput + "%'"); if (lr.Length > 0) { Resolve(lr[0], newR); return; } //resolve by role on file atriumDB.FileContactRow fcr = myA.FM.GetFileContact().GetByRole(userInput); if (fcr != null && fcr.Active) { //if it is not an officer then get the contact record if (fcr.IsOfficeIdNull()) { atriumDB.ContactRow cr = fcr.ContactRow; if (cr == null) { myA.FM.GetPerson().Load(fcr.ContactId); } Resolve(cr, newR); return; } else { or = myA.AtMng.OfficeMng.GetOfficer().FindLoad(fcr.ContactId); } } if (or == null) { //resolve by officer code first or = myA.AtMng.OfficeMng.GetOfficer().LoadByOfficerCode(userInput); if (or != null && !or.CurrentEmployee) { or = null; } } if (or != null) { Resolve(or, newR); return; } //or = myA.AtMng.OfficeMng.GetOfficer().LoadByEmail(userInput); //if (or != null && or.CurrentEmployee ) //{ // Resolve(or, newR); // return; //} if (!newR.DocumentRow.isLawmail) { //this is good for non-comm documents newR.Address = userInput; newR.Name = display; newR.AddressType = "NONE"; } else { string addrType = "SMTP"; try { Redemption.MAPIUtils mapiUtil = DocumentBE.MAPIUtils(); Redemption.SafeRecipient rdoRecip = mapiUtil.CreateRecipient(userInput, showDialog, 0); addrType = "SMTP";//always get the SMTP address rdoRecip.AddressEntry.Type; //resolution of distrib lists gets done on acbf now //if (addrType == "SMTP") // userInput = rdoRecip.AddressEntry.SMTPAddress; //else if (addrType == "MAPIPDL") //{ // //go thorugh all entries in list // Redemption.AddressEntry ade = rdoRecip.AddressEntry; // Redemption.AddressEntries mbrs = (Redemption.AddressEntries)ade.Members; // foreach (Redemption.AddressEntry addr in mbrs) // { // if (addr.Type == "EX") // Add(addr.Address, addr.Name); // else // Add(addr.SMTPAddress, addr.Name); // } // return; //} //else userInput = rdoRecip.AddressEntry.SMTPAddress; if (userInput == null || userInput == "") { addrType = "X400"; userInput = rdoRecip.Address; } display = rdoRecip.Name; } catch (System.NullReferenceException xnull) { // myA.AtMng.LogError(xnull); //address not found in address book or cancel hit throw new AtriumException("Cancel of address pick"); } catch (Exception x) { myA.AtMng.LogError(x); //address not found in address book or cancel hit throw x; } if (userInput == null) //personal\outlook distribution lists cause this { userInput = display; } or = myA.AtMng.OfficeMng.GetOfficer().LoadByEmail(userInput); if (or == null || !or.CurrentEmployee) { //add recipient row newR.Address = userInput; newR.Name = display; newR.AddressType = addrType; return; } else { Resolve(or, newR); } } }