public int SubmitEntrepreneurEnquiry(EntrepreneurEnquiryDTO model)
        {
            EntrepreneurEnquiry contact = new EntrepreneurEnquiry();

            contact = mapper.Map <EntrepreneurEnquiry>(model);
            return(NotificationRepository.SubmitEntrepreneurEnquiry(contact));
        }
Example #2
0
        public int PrepareAndSendEntrepreneurEmail(EntrepreneurEnquiryDTO model)
        {
            ActivityLog.SetLog("[START][PrepareAndSendEntrepreneurEmail]", LogLoc.INFO);
            string body = string.Empty;

            using (StreamReader reader = new StreamReader(System.Web.HttpContext.Current.Server.MapPath("~/Helpers/EmailTemplates/BusinessEnquiry.html")))
            {
                body = reader.ReadToEnd();
            }
            body = body.Replace("{Name}", model.Name);
            body = body.Replace("{Date}", DateTime.Now.ToShortDateString());
            body = body.Replace("{Email}", model.Email);
            body = body.Replace("{Mobile}", model.Mobile);
            body = body.Replace("{Address}", model.Address);
            body = body.Replace("{PinCode}", model.Pincode);
            body = body.Replace("{Location}", model.Location);
            body = body.Replace("{Profession}", model.Profession);
            body = body.Replace("{Investment}", model.Investment.ToString());

            EmailServiceDTO email = new EmailServiceDTO();

            email.ToEmail      = model.Email;
            email.Status       = (int)AspectEnums.EmailStatus.Pending;
            email.Body         = body;
            email.ToName       = model.Name;
            email.Priority     = 2;
            email.IsAttachment = false;
            ActivityLog.SetLog("[END][PrepareAndSendEntrepreneurEmail]", LogLoc.INFO);
            return(SendEmail(email));
        }
        public JsonResponse <int> EntrepreneurEnquiry(EntrepreneurEnquiryDTO enquiry)
        {
            JsonResponse <int> response = new JsonResponse <int>();

            ActivityLog.SetLog("[START][EntrepreneurEnquiry]", LogLoc.INFO);
            try
            {
                enquiry.Status        = (int)AspectEnums.EnquiryStatus.Received;
                response.SingleResult = NotificationBusinessInstance.SubmitEntrepreneurEnquiry(enquiry);
                response.IsSuccess    = response.SingleResult > 0 ? true : false;

                if (response.IsSuccess)
                {
                    EmailHelper helper = new EmailHelper();
                    helper.PrepareAndSendEntrepreneurEmail(enquiry);
                    response.StatusCode = "200";
                    response.Message    = "Your enquiry is successfully posted.  We will send you email shortly.";
                }
            }
            catch (Exception ex)
            {
                ActivityLog.SetLog("Message: " + ex.Message + "Inner Ex: " + ex.InnerException, LogLoc.ERROR);
                response.IsSuccess  = false;
                response.StatusCode = "500";
                response.Message    = "Your enquiry is failed.";
            }
            ActivityLog.SetLog("[END][EntrepreneurEnquiry]", LogLoc.INFO);
            return(response);
        }