public AddresseeTO(mdo.domain.sm.Addressee addressee) { if (addressee == null) { return; } this.id = addressee.Id; this.oplock = addressee.Oplock; folder = new FolderTO(addressee.Folder); readDate = addressee.ReadDate; owner = new SmUserTO(addressee.Owner); //message = new MessageTO(addressee.Message); // having the message object was making it too easy to cause an infinite recursive loop - hopefully the message ID is enough reminderDate = addressee.ReminderDate; role = (Int32)addressee.Role; if (addressee.Message != null) { messageId = addressee.Message.Id; } }
public SmUserTO getUser(string pwd, string userId, string idType) { SmUserTO result = new SmUserTO(); if (String.IsNullOrEmpty(pwd)) { result.fault = new dto.FaultTO("Must supply password"); } else if (String.IsNullOrEmpty(userId)) { result.fault = new dto.FaultTO("Must supply user ID"); } else if (String.IsNullOrEmpty(idType) && !StringUtils.isNumeric(userId)) { result.fault = new FaultTO("Invalid user ID"); } else if (!String.IsNullOrEmpty(idType) && !String.Equals(idType, "SMID", StringComparison.CurrentCultureIgnoreCase) && !String.Equals(idType, "ICN", StringComparison.CurrentCultureIgnoreCase) && !String.Equals(idType, "SSN", StringComparison.CurrentCultureIgnoreCase)) { result.fault = new FaultTO("Invalid id type", "Use one of the following: SMID, ICN, SSN"); } if (result.fault != null) { return result; } try { using (MdoOracleConnection cxn = new MdoOracleConnection(new mdo.DataSource() { ConnectionString = pwd })) { UserDao dao = new UserDao(cxn); if (String.IsNullOrEmpty(idType) || String.Equals(idType, "SMID", StringComparison.CurrentCultureIgnoreCase)) { result = new SmUserTO(dao.getUserDetail(Convert.ToInt32(userId))); } else if (String.Equals(idType, "ICN", StringComparison.CurrentCultureIgnoreCase)) { result = new SmUserTO(dao.getUserDetail(dao.getUserByIcn(userId).Id)); } else if (String.Equals(idType, "SSN", StringComparison.CurrentCultureIgnoreCase)) { // TODO - write get user by SSN function result.fault = new FaultTO("SSN lookup not currently enabled. Please try again later"); //result = new SmUserTO(dao.getUserDetail(dao.getUserBySsn(userId))); } else { throw new Exception("Invalid user type"); // should never get here with fault handling section but... just in case } } } catch (Exception exc) { result.fault = new dto.FaultTO(exc); } return result; }