public void Add(string userInput, string display) { docDB.RecipientRow newR = (docDB.RecipientRow)dm.GetRecipient().Add(currentMsg); try { dm.GetRecipient().Resolve(userInput, display, newR, true); newR.Type = myRecipType; CreateRecip(newR); } catch (atLogic.ValidationException xV) { dm.DB.Recipient.RemoveRecipientRow(newR); tbNewRecipient.Text = ""; throw xV; } catch (atLogic.AtriumException xA) { dm.DB.Recipient.RemoveRecipientRow(newR); tbNewRecipient.Text = ""; } catch (Exception x) { dm.DB.Recipient.RemoveRecipientRow(newR); tbNewRecipient.Text = ""; throw new LMException("There is a problem with your Outlook/Exchange configuration. You cannot send external emails from Atrium."); } }
public void AddRecipToMessage(docDB.RecipientRow r, docDB.DocumentRow d, RecipType rtype) { try { docDB.RecipientRow newr = (docDB.RecipientRow)Add(d); DoNotResolve = true; newr.Type = ((int)rtype).ToString(); if (!r.IsOfficeIdNull()) { newr.OfficeId = r.OfficeId; } if (!r.IsOfficerIdNull()) { newr.OfficerId = r.OfficerId; } if (!r.IsAddressNull()) { newr.Address = r.Address; } if (!r.IsNameNull()) { newr.Name = r.Name; } } catch (Exception x) { } DoNotResolve = false; }
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 dr) { docDB.RecipientRow row = (docDB.RecipientRow)dr; row.RecipId = myA.AtMng.PKIDGet("Recipient", 10); row.AddressType = "SMTP"; row.isNewMail = false; }
public void Resolve(appDB.ListRow lr, docDB.RecipientRow newR) { if (!lr.IsExchangeNameNull()) { newR.Address = lr.ExchangeName; //addresstype will default to SMTP so that shouldbe the primary email type for all users } newR.Name = lr.ListNameEng; newR.ListId = lr.ListId; }
public void Resolve(officeDB.OfficerRow or, docDB.RecipientRow newR) { if (!or.IsEmailAddressNull()) { newR.Address = or.EmailAddress; //addresstype will default to SMTP so that shouldbe the primary email type for all users } newR.OfficeId = or.OfficeId; newR.OfficerId = or.OfficerId; newR.Name = or.LastName + ", " + or.FirstName + " (" + or.OfficerCode + ")"; }
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 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); }
protected override void BeforeChange(DataColumn dc, DataRow dr) { docDB.RecipientRow row = (docDB.RecipientRow)dr; switch (dc.ColumnName) { case "OfficerId": if (!row.IsOfficerIdNull() && !row.IsOfficeIdNull() && !myA.CheckDomain(row.OfficerId, myA.FM.Codes("OfficerList"))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Officer List"); } break; case "Type": if (!Enum.IsDefined(typeof(RecipType), System.Convert.ToInt32(row.Type))) { throw new AtriumException(atriumBE.Properties.Resources.BadDomainValue, dc.ColumnName, dr.Table.TableName, "Recipient Type"); } break; default: break; } }
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]); } }
void CreateRecip(docDB.RecipientRow r) { if (r.Name == "") { return; } Janus.Windows.Common.SuperTipSettings jstSettings = new Janus.Windows.Common.SuperTipSettings(); Janus.Windows.GridEX.EditControls.EditBox eb = new Janus.Windows.GridEX.EditControls.EditBox(); eb.Name = r.RecipId.ToString(); eb.BorderStyle = Janus.Windows.GridEX.BorderStyle.None; eb.BackColor = tbBackColor; eb.ReadOnly = true; eb.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); eb.Tag = r; eb.Text = r.Name; eb.VisualStyle = Janus.Windows.GridEX.VisualStyle.Office2010; eb.TabStop = false; eb.MouseUp += tbNewRecipient_MouseUp; eb.ShortcutsEnabled = false; eb.ButtonClick += new EventHandler(eb_ButtonClick); if (!r.IsAddressNull()) { jstSettings.Text = r.Address; janusSuperTip1.SetSuperTip(eb, jstSettings); } if (!r.IsOfficerIdNull()) //resolved to officer { eb.Image = Properties.Resources.RecipientOfficer2; } else if (!r.IsListIdNull()) //resolved to list { eb.Image = Properties.Resources.recipientDistList; eb.Font = new Font(eb.Font.FontFamily, 8, FontStyle.Underline | FontStyle.Bold); } else //does not recognize/resolve { eb.Image = Properties.Resources.RecipientUnknown; } ToggleRecipReadOnly(eb); if (myReadOnly) { flowLayoutPanelRecipient.Controls.Add(eb); } else { flowLayoutPanelRecipient.Controls.Remove(tbNewRecipient); flowLayoutPanelRecipient.Controls.Add(eb); flowLayoutPanelRecipient.Controls.Add(tbNewRecipient); if (!AllowMultiple) { tbNewRecipient.Visible = false; } else { tbNewRecipient.Visible = true; } } if (added.ContainsKey(r.RecipId)) { return; } added.Add(r.RecipId, r); }
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); } } }
public void Resolve(officeDB.OfficeRow or, docDB.RecipientRow newR) { newR.Address = myA.FM.GetAddress().Load(or.AddressId).EmailAddress; newR.OfficeId = or.OfficeId; newR.Name = or.OfficeName + " (" + or.OfficeCode + ")"; }