/// <remarks/> public void createAsync(CreateDirectEmailRequest createRequest) { this.createAsync(createRequest, null); }
/// <remarks/> public void createAsync(CreateDirectEmailRequest createRequest, object userState) { if ((this.createOperationCompleted == null)) { this.createOperationCompleted = new System.Threading.SendOrPostCallback(this.OncreateOperationCompleted); } this.InvokeAsync("create", new object[] { createRequest}, this.createOperationCompleted, userState); }
/// <summary> /// create direct email /// </summary> /// <param name="directEmailId">direct email type id</param> /// <param name="emailLabel">email label</param> /// <param name="emailName">email name</param> /// <param name="subject">subject</param> /// <param name="description">decription</param> /// <param name="fromName">sender name</param> /// <param name="fromAddress">from address</param> /// <param name="htmlSource">html source</param> /// <returns>direct email id</returns> public String createDirectEmail(String directEmailTypeId, String emailLabel, String emailName, String subject, String description, String fromName, String fromAddress, String htmlSource) { if (logger.IsDebugEnabled) { logger.Debug("createDirectEmail:directEmailTypeId=" + directEmailTypeId + ",emailLabel=" + emailLabel + ",emailName=" + emailName + ",subject=" + subject + ",description=" + description + ",fromName=" + fromName + ",fromAddress=" + fromAddress); } String result; String emailId = getDirectEmailId(directEmailTypeId, emailName); //Check if the email type is already exist. if (!emailId.Equals("")) { this.updateDirectEmail(emailId, subject, fromName, htmlSource); return emailId; } CreateDirectEmailRequest request = new CreateDirectEmailRequest(); try { request.directEmailTypeId = directEmailTypeId; request.label = emailLabel; request.name = emailName; request.subject = subject; request.description = description; request.fromName = fromName; request.fromAddress = fromAddress; request.htmlSource = htmlSource; request.textSource = htmlSource; //request. IDResponse response = directEmailService.create(request); result = response.id; } catch (System.Web.Services.Protocols.SoapException ex) { if (!Util.isCodeExist(ex.Detail) || Util.getExistId(ex.Detail).Equals("")) { result = ex.Detail.InnerXml; if (logger.IsDebugEnabled) { logger.Debug("error happens in creating direct email, error is" + result); } throw new Exception(ex.Detail.InnerXml); } result = Util.getExistId(ex.Detail); } return result; }