private string Format(BookingTemplate template, string fileContent, ref User user, ref Event @event) { var content = fileContent; var root = Configuration.ServerDomain; string mainIconPath = null; content = content.Replace("{{facebook_url}}", Configuration.FacebookUrl); content = content.Replace("{{facebook_icon}}", Path.Combine(root, "images/facebook.svg")); content = content.Replace("{{instagram_url}}", Configuration.InstagramUrl); content = content.Replace("{{instagram_icon}}", Path.Combine(root, "images/instagram.svg")); content = content.Replace("{{twitter_url}}", Configuration.TwitterUrl); content = content.Replace("{{twitter_icon}}", Path.Combine(root, "images/twitter.svg")); content = content.Replace("{{ynov_url}}", Configuration.YnovUrl); content = content.Replace("{{logo}}", Path.Combine(root, "images/logo.png")); content = content.Replace("{{user_firstname}}", user.FirstName); content = content.Replace("{{event_name}}", @event.Title); mainIconPath = "images/" + template.ToString().ToLower() + ".png"; switch (template) { case BookingTemplate.AWAY: break; case BookingTemplate.PRESENT: content = content.Replace("{{jurypoint_number}}", (@event.JuryPoint ?? 0).ToString()); break; case BookingTemplate.RECALL: string remain = TimeFormatter.GetTimeWindowFrom(DateTime.Now, (DateTime)@event.OpenAt); content = content.Replace("{{remaining_hours}}", remain); AddEventInfos(ref content, ref @event); break; case BookingTemplate.AUTO_VALIDATED: mainIconPath = "images/validate.png"; AddEventInfos(ref content, ref @event); break; case BookingTemplate.SUBSCRIPTION_VALIDATED: mainIconPath = "images/validate.png"; AddEventInfos(ref content, ref @event); break; case BookingTemplate.PENDING_VALIDATION: content = content.Replace("{{subscribed_at}}", DateTime.Now.ToString()); break; } content = content.Replace("{{main_icon}}", Path.Combine(root, mainIconPath)); content = content.Replace(System.Environment.NewLine, ""); return(content); }