private EmailLinkedResourceModel GenerateImageList(List <EmailTemplateModel> lstEmailTemplatemodel, HTMLParserService parser)
        {
            Hashtable                imgpaths         = new Hashtable();
            StringBuilder            imagesblock      = new StringBuilder();
            List <LinkedResource>    lstImageResouces = new List <LinkedResource>();
            LinkedResource           resource;
            MailMessage              message           = new MailMessage();
            EmailLinkedResourceModel imagelinkResource = new EmailLinkedResourceModel();

            List <string> lstIsbns = lstEmailTemplatemodel.FirstOrDefault() != null?lstEmailTemplatemodel.FirstOrDefault().LstISBN : new List <string>();

            foreach (string isbn in lstIsbns)
            {
                string imagePath = ConfigurationManager.AppSettings["CommonRepository"] + ConfigurationManager.AppSettings["ImagesH135"] + @"\";
                if (imgpaths.Count < 5)
                {
                    if (!isbn.Contains(imagePath))
                    {
                        imagePath = imagePath + isbn + ".jpg";
                    }
                    else
                    {
                        imagePath = isbn;
                    }
                    if (System.IO.File.Exists(imagePath))
                    {
                        imgpaths.Add(lstEmailTemplatemodel.FirstOrDefault().DWName + "-" + isbn, imagePath);
                    }
                }
            }


            IDictionaryEnumerator myEnum = imgpaths.GetEnumerator();
            int i = 1;

            while (myEnum.MoveNext())
            {
                string imgFile = myEnum.Value.ToString();
                resource           = new LinkedResource(imgFile);
                resource.ContentId = "id" + i;
                lstImageResouces.Add(resource);

                Hashtable blockVars = new Hashtable();
                blockVars.Add("imgpath", "id" + i);
                blockVars.Add("DWName", myEnum.Key);

                string parsedHtml = parser.ParseBlock("image", blockVars);

                if (!string.IsNullOrEmpty(parsedHtml))
                {
                    imagesblock.Append(parsedHtml);
                }

                i = i + 1;
            }

            imagelinkResource.HtmlImageContent  = imagesblock.ToString();
            imagelinkResource.ListImageResource = lstImageResouces;
            return(imagelinkResource);
        }
        private string GenerateRepCommentsText(EmailTemplateViewModel item, HTMLParserService parser)
        {
            Hashtable blockVars = new Hashtable();

            blockVars.Add("RepComments", item.RepComments);
            string parsedHtml = parser.ParseBlock("RepComments", blockVars);

            return(parsedHtml);
        }
        private string GenerateAnchorList(List <EmailTemplateModel> lstEmailTemplatemodel, HTMLParserService parser, string type, EmailTemplateViewModel item = null)
        {
            Hashtable links      = new Hashtable();
            string    dwBaseUrl  = ConfigurationManager.AppSettings["DWEmailUrl"];
            string    dwVideoUrl = ConfigurationManager.AppSettings["DWVideoUrl"];

            if (type == "DefaultDWLink")
            {
                EmailTemplateModel etm = lstEmailTemplatemodel.Take(1).FirstOrDefault();
                links.Add(etm.DWName + "~" + etm.QuoteID, dwBaseUrl + etm.QuoteID + "&type=Decision Wizard");
            }
            else if (type == "Link")
            {
                foreach (EmailTemplateModel etm in lstEmailTemplatemodel.Skip(1))
                {
                    links.Add(etm.DWName + "~" + etm.QuoteID, dwBaseUrl + etm.QuoteID + "&type=Decision Wizard");
                }
            }
            else if (type == "VideoLink")
            {
                links.Add("videolink", dwVideoUrl);
            }
            else
            {
                if (item != null)
                {
                    links.Add("repDetails", item.RepFirstName + "~" + item.FromAddress);
                }
            }
            //generate others DW's list
            StringBuilder         linksBlock   = new StringBuilder();
            IDictionaryEnumerator myEnumerator = links.GetEnumerator();

            while (myEnumerator.MoveNext())
            {
                Hashtable blockVars = new Hashtable();
                if (type != "VideoLink")
                {
                    if (item != null)
                    {
                        blockVars.Add("RepName", myEnumerator.Value.ToString().Split('~')[0]);
                        blockVars.Add("RepPhone", "");
                        blockVars.Add("RepEmailAddress", myEnumerator.Value.ToString().Split('~')[1]);
                    }
                    else
                    {
                        blockVars.Add("Url", myEnumerator.Value);
                        blockVars.Add("DWName", myEnumerator.Key.ToString().Split('~')[0]);
                    }
                }
                else
                {
                    blockVars.Add("VideoUrl", myEnumerator.Value);
                }
                string parsedHtml = parser.ParseBlock(type, blockVars);

                if (!string.IsNullOrEmpty(parsedHtml))
                {
                    linksBlock.Append(parsedHtml);
                }
            }

            return(linksBlock.ToString());
        }