public EmailNotificationDTO GetEmailTemplateFromPageModel(UploadDocumentPageModel pageModel)
        {
            // this method uses the email template: "Seafarers_Document_Submission_Email"

            EmailNotificationDTO template = new EmailNotificationDTO();

            template.NotificationTemplateName = "Seafarers_Document_Submission_Email";
            template.ServiceRequestId         = pageModel == null ? 0 : pageModel.MtoaServiceRequestId;
            template.UserId   = 4536;
            template.UserName = "******";
            template.Language = "English";
            template.From     = "*****@*****.**";
            template.To       = pageModel.EmailAddress;
            template.IsHtml   = true;

            template.Attachements = new List <EmailAttachmentDTO>(); // in our email currently, we do not have attachments. But this field can not be null

            var parameters = new List <KeyValuePair <string, string> >();


            parameters.Add(new KeyValuePair <string, string>("Confirmation_Number", pageModel.ConfirmationNumber));
            parameters.Add(new KeyValuePair <string, string>("CDN_Number", pageModel.CdnNumber));
            parameters.Add(new KeyValuePair <string, string>("Phone_Number", pageModel.PhoneNumber));
            parameters.Add(new KeyValuePair <string, string>("Email_Address", pageModel.EmailAddress));
            parameters.Add(new KeyValuePair <string, string>("Selected_CertificateType", pageModel.CertificateType));
            parameters.Add(new KeyValuePair <string, string>("Confirmation_Number", pageModel.ConfirmationNumber));

            var document_param = GetDocumentParameters(pageModel);

            parameters.Add(document_param);

            template.Parameters = parameters;

            #region -- email template parameters
            // We assume that we have following parameters in the given template
            // Confirmation_Number
            //CDN_Number
            //Phone_Number
            //Email_Address
            //Selected_CertificateType

            //DOCUMENT
            //DOCUMENT --this parameter consists of many document fields combined in one string.

            //It is the list of documents in the format of
            //Document 1 FileName.extention
            //Type of document: Document type Entered.
            #endregion --- end of template parameter information

            return(template);
        }
        public IHttpActionResult GetDataFromUserDetailProfile(string userName, string apiAccessKey)
        {
            var objLoginDto    = new LoginDTO();
            var userProfileDto = new ProfileDTO();

            try
            {
                LogWsData("userName :"******"'", "''").Trim();
                    LoginDTO loggedinUsertDto;
                    using (var client = ServiceClient <ILoginManager> .Create(ObjectConstants.LoginManager))
                    {
                        loggedinUsertDto = client.Instance.ValidateUser(objLoginDto);
                    }
                    //if (loggedinUsertDto.LoginList.Count == 0)
                    //{
                    using (var client = ServiceClient <IUserProfileManager> .Create(ObjectConstants.UserProfileManager))
                    {
                        var objuserProfileDto = new ProfileDTO
                        {
                            EmailId       = userName.Replace("'", "''").Trim(),
                            ContactNumber = userName.Replace("'", "''").Trim(),
                            UserName      = userName.Replace("'", "''").Trim()
                        };
                        userProfileDto = client.Instance.ValidateUserProfile(objuserProfileDto);
                    }
                    //}
                    if (userProfileDto.ProfileList.Count > 0)
                    {
                        using (var client = ServiceClient <ILoginManager> .Create(ObjectConstants.LoginManager))
                        {
                            Guid g;
                            g = Guid.NewGuid();
                            var objLoginDtos = new LoginDTO
                            {
                                ProfileId = userProfileDto.ProfileList[0].ProfileId,
                                GUID      = Convert.ToString(g),
                                UserName  = userName.Replace("'", "''").Trim()
                            };
                            client.Instance.UpdateLoginByGUID(objLoginDtos);
                        }
                        EmailNotificationDTO emailNotificationDto = new EmailNotificationDTO();
                        using (var client = ServiceClient <IEmailNotificationManager> .Create(ObjectConstants.EmailNotificationManager))
                        {
                            emailNotificationDto.ObjectId           = Convert.ToInt64(userProfileDto.ProfileList[0].ProfileId);
                            emailNotificationDto.SenderEmailAddress = userProfileDto.ProfileList[0].EmailId;
                            emailNotificationDto.IsActive           = true;
                            emailNotificationDto.IsSent             = false;
                            emailNotificationDto.EventType          = "PasswordRecover";
                            emailNotificationDto.CreatedBy          = Convert.ToInt64(userProfileDto.ProfileList[0].ProfileId);
                            emailNotificationDto.CreatedDate        = DateTime.Now;
                            client.Instance.Save(emailNotificationDto);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogWsData("Exception ForgotPassword: " + ex);
            }
            return(Ok(userProfileDto.ProfileList));
        }