private void SavePersonMessage(BO.ORCID.PersonMessage personMessage, BO.ORCID.REFPermission refPermission, BLL.ORCID.PersonMessage personMessageBLL) { if (!personMessage.MessagePostSuccess) { string rsp = personMessage.XML_Response; int openTag = rsp.IndexOf("<error-desc>") + ("<error-desc>").Length; int closeTag = rsp.IndexOf("</error-desc>"); personMessage.RecordStatusID = (int)ProfilesRNSDLL.BO.ORCID.REFRecordStatus.REFRecordStatuss.Failed; if (rsp.Contains("<error-desc>")) { personMessage.UserMessage = rsp.Substring(openTag, closeTag - openTag); switch ((ProfilesRNSDLL.BO.ORCID.REFPermission.REFPermissions)personMessage.PermissionID) { case BO.ORCID.REFPermission.REFPermissions.orcid_bio_update: case BO.ORCID.REFPermission.REFPermissions.orcid_works_create: personMessage.UserMessage = refPermission.FailedMessage + "."; break; } } else { personMessage.UserMessage = rsp; } } else { personMessage.RecordStatusID = (int)ProfilesRNSDLL.BO.ORCID.REFRecordStatus.REFRecordStatuss.Success; switch ((ProfilesRNSDLL.BO.ORCID.REFPermission.REFPermissions)personMessage.PermissionID) { case BO.ORCID.REFPermission.REFPermissions.orcid_bio_update: case BO.ORCID.REFPermission.REFPermissions.orcid_works_create: case BO.ORCID.REFPermission.REFPermissions.orcid_profile_read_limited: case BO.ORCID.REFPermission.REFPermissions.affiliations_create: personMessage.UserMessage = refPermission.SuccessMessage + "."; break; default: throw new Exception("Unhandled Permission Type for Success Message."); } } personMessage.PostDate = DateTime.Now; personMessageBLL.Save(personMessage); }
private void InitializePersonMessageRequestInfo(BO.ORCID.PersonMessage personMessage, BLL.ORCID.PersonMessage personMessageBLL) { // initialize the request information personMessage.MessagePostSuccessIsNull = true; personMessage.HttpResponseCodeIsNull = true; personMessage.HeaderPostIsNull = true; personMessage.XML_ResponseIsNull = true; personMessage.UserMessageIsNull = true; personMessage.PostDateIsNull = true; personMessage.RecordStatusID = (int)BO.ORCID.REFRecordStatus.REFRecordStatuss.Waiting_to_be_sent_to_ORCID; personMessageBLL.Save(personMessage); }