示例#1
0
        /// <summary>
        /// delete a section
        /// </summary>
        /// <param name="sectionId">identifier of section</param>
        /// <returns>returns true if operation successful</returns>
        public bool DeleteSection(int sectionId)
        {
            try
            {
                FriendlyurlRepository friendlyrepo = new FriendlyurlRepository(this.session);
                SectionRepository     objsection   = new SectionRepository(this.session);
                objsection.Entity.SectionId = sectionId;
                objsection.Delete();

                friendlyrepo.Entity.Id   = sectionId;
                friendlyrepo.Entity.Type = Friendlyurl.FriendlyType.Section;
                friendlyrepo.Delete();

                Utils.InsertAudit(
                    this.session,
                    new Audit()
                {
                    Auditaction = "Delete",
                    Description = "Section -> " + sectionId.ToString(),
                    Joindate    = DateTime.Now,
                    Username    = (this.context.User as CustomPrincipal).UserId
                });

                return(true);
            }
            catch (Exception ex)
            {
                Utils.InsertLog(
                    this.session,
                    "Delete Section",
                    ex.Message + " - " + ex.StackTrace);
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// Deletes content from data base
        /// </summary>
        /// <param name="listContentId">list of content's identifiers</param>
        public void DeleteContent(string[] listContentId)
        {
            List <int> collIds = new List <int>();

            foreach (string item in listContentId)
            {
                collIds.Add(int.Parse(item));
            }

            ContentRepository     objcontent   = new ContentRepository(this.session);
            FriendlyurlRepository friendlyrepo = new FriendlyurlRepository(this.session);

            try
            {
                this.session.Begin();

                foreach (int item in collIds)
                {
                    string path = Path.Combine(this.context.Server.MapPath("~"), @"files\" + item);
                    if (Directory.Exists(path))
                    {
                        Directory.Delete(path, true);
                    }

                    objcontent.Entity.ContentId = item;
                    objcontent.Delete();

                    friendlyrepo.Entity.Id   = item;
                    friendlyrepo.Entity.Type = Friendlyurl.FriendlyType.Content;
                    friendlyrepo.Delete();
                }

                Utils.InsertAudit(
                    this.session,
                    new Audit()
                {
                    Joindate    = DateTime.Now,
                    Description = "Delete contents",
                    Username    = (this.context.User as CustomPrincipal).UserId,
                    Auditaction = "Delete"
                });

                this.session.Commit();
            }
            catch (Exception ex)
            {
                this.session.RollBack();
                Utils.InsertLog(this.session, "Error Delete", ex.ToString());
            }
        }
示例#3
0
        /// <summary>
        /// Inserts a content in data base
        /// </summary>
        /// <param name="content">the object content</param>
        public void ContentInsert(Content content)
        {
            this.ObjContent = content;
            string            serverMap  = this.context.Server.MapPath("~");
            ContentRepository objcontent = new ContentRepository(this.session);

            this.objimagerez             = new ImageResize(serverMap);
            objcontent.Entity            = this.ObjContent;
            objcontent.Entity.Updatedate = DateTime.Now;

            if (this.ContentImage != null && this.ContentImage.ContentLength > 0 && Utils.IsImage(this.ContentImage.FileName))
            {
                objcontent.Entity.Image = Utils.UploadFile(
                    this.ContentImage,
                    serverMap,
                    @"resources\temporal\",
                    null);
            }

            if (this.ContentCoverImage != null && this.ContentCoverImage.ContentLength > 0 && Utils.IsImage(this.ContentCoverImage.FileName))
            {
                objcontent.Entity.CoverImage = Utils.UploadFile(
                    this.ContentCoverImage,
                    serverMap,
                    @"resources\temporal\",
                    "cover-",
                    1800);
            }

            if (content.ContentId != null)
            {
                objcontent.Update();

                FriendlyurlRepository friendlyrepo = new FriendlyurlRepository(this.session);
                friendlyrepo.Entity.Id            = content.ContentId;
                friendlyrepo.Entity.Friendlyurlid = objcontent.Entity.Frienlyname;
                friendlyrepo.Entity.Type          = Friendlyurl.FriendlyType.Content;
                friendlyrepo.Entity.LanguageId    = content.LanguageId;
                friendlyrepo.Update();
            }
            else
            {
                objcontent.Entity.Orderliness = objcontent.GetMaxOrder();
                objcontent.Entity.Frienlyname = Utils.GetFindFrienlyName(this.session, objcontent.Entity.Name, objcontent.Entity.Orderliness.Value);
                objcontent.Entity.Joindate    = objcontent.Entity.Updatedate;

                if (content.UserId == null)
                {
                    objcontent.Entity.UserId = (this.context.User as CustomPrincipal).UserId;
                }
                else
                {
                    objcontent.Entity.UserId = content.UserId;
                }

                this.ObjContent.ContentId = Convert.ToInt32(objcontent.Insert());

                FriendlyurlRepository friendlyrepo = new FriendlyurlRepository(this.session);
                friendlyrepo.Entity.Id            = this.ObjContent.ContentId;
                friendlyrepo.Entity.Friendlyurlid = objcontent.Entity.Frienlyname;
                friendlyrepo.Entity.Type          = Friendlyurl.FriendlyType.Content;
                friendlyrepo.Entity.LanguageId    = content.LanguageId;
                friendlyrepo.Insert();
            }

            if (objcontent.Entity.Image != null)
            {
                string pathtruncate = Path.Combine(serverMap, @"resources\temporal\");
                string pathorigin   = pathtruncate + objcontent.Entity.Image;
                string newpath      = Path.Combine(serverMap, @"files\" + this.ObjContent.ContentId + @"\");

                if (File.Exists(pathorigin))
                {
                    int  newWidth  = 0;
                    int  newHeight = 0;
                    bool isResized = false;

                    if (int.TryParse(this.context.Request.Form["imgwidth"], out newWidth) &&
                        int.TryParse(this.context.Request.Form["imgheight"], out newHeight))
                    {
                        ImageResize objimage = new ImageResize(serverMap);

                        objimage.Prefix = "_";
                        objimage.Width  = newWidth;
                        objimage.Height = newHeight;
                        isResized       = objimage.Resize(@"resources\temporal\" + objcontent.Entity.Image, ImageResize.TypeResize.BackgroundProportional);
                    }

                    if (!Directory.Exists(newpath))
                    {
                        Directory.CreateDirectory(newpath);
                    }

                    if (!isResized)
                    {
                        File.Move(pathorigin, newpath + objcontent.Entity.Image);
                        File.Delete(pathorigin);
                    }
                    else
                    {
                        File.Move(pathtruncate + "_" + objcontent.Entity.Image, newpath + objcontent.Entity.Image);
                        File.Delete(pathorigin);
                        File.Delete(pathtruncate + "_" + objcontent.Entity.Image);
                    }
                }

                string fileroute = @"files\" + this.ObjContent.ContentId + @"\" + objcontent.Entity.Image;

                this.objimagerez.Resize(
                    fileroute,
                    ImageResize.TypeResize.PartialProportional);

                this.objimagerez.Width  = 170;
                this.objimagerez.Height = 105;
                this.objimagerez.Prefix = "170x105-";
                this.objimagerez.Resize(fileroute, ImageResize.TypeResize.CropProportional);

                this.objimagerez.Width  = 340;
                this.objimagerez.Height = 250;
                this.objimagerez.Prefix = "340x250-";
                this.objimagerez.Resize(fileroute, ImageResize.TypeResize.CropProportional);

                this.objimagerez.Width  = 340;
                this.objimagerez.Height = 320;
                this.objimagerez.Prefix = "340x320-";
                this.objimagerez.Resize(fileroute, ImageResize.TypeResize.CropProportional);

                this.objimagerez.Width  = 511;
                this.objimagerez.Height = 320;
                this.objimagerez.Prefix = "511x320-";
                this.objimagerez.Resize(fileroute, ImageResize.TypeResize.CropProportional);

                this.objimagerez.Width  = 683;
                this.objimagerez.Height = 320;
                this.objimagerez.Prefix = "683x320-";
                this.objimagerez.Resize(fileroute, ImageResize.TypeResize.CropProportional);

                this.objimagerez.Width  = 191;
                this.objimagerez.Height = 191;
                this.objimagerez.Prefix = "191x191-";
                this.objimagerez.Resize(fileroute, ImageResize.TypeResize.CropProportional);

                this.objimagerez.Width  = 511;
                this.objimagerez.Height = 255;
                this.objimagerez.Prefix = "511x255-";
                this.objimagerez.Resize(fileroute, ImageResize.TypeResize.CropProportional);
            }

            if (objcontent.Entity.CoverImage != null)
            {
                string pathtruncate = Path.Combine(serverMap, @"resources\temporal\");
                string pathorigin   = pathtruncate + objcontent.Entity.CoverImage;
                string newpath      = Path.Combine(serverMap, @"files\" + this.ObjContent.ContentId + @"\");

                if (File.Exists(pathorigin))
                {
                    if (!Directory.Exists(newpath))
                    {
                        Directory.CreateDirectory(newpath);
                    }

                    File.Move(pathtruncate + objcontent.Entity.CoverImage, newpath + objcontent.Entity.CoverImage);
                    File.Delete(pathorigin);
                    File.Delete(pathtruncate + objcontent.Entity.CoverImage);
                }

                string fileroute = @"files\" + this.ObjContent.ContentId + @"\" + objcontent.Entity.CoverImage;

                ////this.objimagerez.Resize(fileroute, ImageResize.TypeResize.PartialProportional);

                this.objimagerez.Width  = 1800;
                this.objimagerez.Height = 800;
                this.objimagerez.Prefix = "1800x800-";
                this.objimagerez.Resize(fileroute, ImageResize.TypeResize.Proportional);
            }

            this.InsertAttachFiles();
            this.InsertTags();
        }
示例#4
0
        /// <summary>
        /// Copy a content from the other content
        /// </summary>
        /// <param name="contentId">identifier of content</param>
        /// <param name="languageId">identifier of language</param>
        /// <param name="sectionId">identifier of section</param>
        /// <returns>returns true if the operation is successful</returns>
        public bool Clone(int contentId, int languageId, int sectionId)
        {
            try
            {
                this.session.Begin();
                ContentRepository     contentrepo    = new ContentRepository(this.session);
                FileattachRepository  fileattachrepo = new FileattachRepository(this.session);
                FriendlyurlRepository friendlyrepo   = new FriendlyurlRepository(this.session);

                fileattachrepo.Entity.ContentId      =
                    friendlyrepo.Entity.Id           =
                        contentrepo.Entity.ContentId = contentId;
                contentrepo.LoadByKey();

                friendlyrepo.Entity.Type = Friendlyurl.FriendlyType.Content;
                friendlyrepo.Load();

                List <Fileattach> collfiles = fileattachrepo.GetAll();

                contentrepo.Entity.SectionId   = sectionId;
                contentrepo.Entity.Name        = "Copy of " + contentrepo.Entity.Name;
                contentrepo.Entity.Orderliness = contentrepo.GetMaxOrder();
                int newid = Convert.ToInt32(contentrepo.Insert());

                friendlyrepo.Entity.Id            = newid;
                friendlyrepo.Entity.Friendlyurlid = "copy_of_" + friendlyrepo.Entity.Friendlyurlid;
                friendlyrepo.Entity.LanguageId    = languageId;
                friendlyrepo.Insert();

                foreach (Fileattach item in collfiles)
                {
                    fileattachrepo.Entity           = item;
                    fileattachrepo.Entity.ContentId = newid;
                    fileattachrepo.Insert();
                }

                this.CompleteClone(contentId, newid, contentrepo.Entity.ModulId.Value);

                string originpath = Path.Combine(this.context.Server.MapPath("~"), @"Files\" + contentId + @"\");
                string newpath    = Path.Combine(this.context.Server.MapPath("~"), @"Files\" + newid + @"\");

                if (Directory.Exists(originpath))
                {
                    DirectoryInfo dir   = new DirectoryInfo(originpath);
                    FileInfo[]    files = dir.GetFiles();

                    if (!Directory.Exists(newpath))
                    {
                        Directory.CreateDirectory(newpath);
                    }

                    foreach (FileInfo item in files)
                    {
                        File.Copy(item.FullName, newpath + item.Name);
                    }
                }

                this.session.Commit();

                return(true);
            }
            catch (Exception ex)
            {
                this.session.RollBack();
                Utils.InsertLog(this.session, "Clone Content ", ex.ToString());
                return(false);
            }
        }
示例#5
0
        /// <summary>
        /// Creates the specified controller by using the specified request context.
        /// </summary>
        /// <param name="requestContext">The context of the HTTP request, which includes the HTTP context and route data</param>
        /// <param name="controllerName">The name of the controller.</param>
        /// <returns>The controller</returns>
        public override IController CreateController(RequestContext requestContext, string controllerName)
        {
            Type controllerType = this.GetControllerType(requestContext, controllerName);

            IController controller;

            Language language = null;

            ISession session = MvcApplication.Container.Resolve <ISession>();

            LanguageManagement langrepo = new LanguageManagement(session, requestContext.HttpContext);

            if (requestContext.RouteData.Values.ContainsKey("culture"))
            {
                if (requestContext.RouteData.Values["culture"].ToString().ToLower() == "vs")
                {
                    HttpContext.Current.Response.Cookies.Add(new HttpCookie("vs", "true"));
                }

                language = langrepo.GetLanguage(requestContext.RouteData.Values["culture"].ToString());
            }
            else
            {
                language = langrepo.GetLanguageDefault();
            }

            Thread.CurrentThread.CurrentCulture   = new CultureInfo(language.Culturename);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(language.Culturename);

            if (controllerType != null)
            {
                controller = this.GetControllerInstance(requestContext, controllerType);
            }
            else
            {
                FriendlyurlRepository friendly = new FriendlyurlRepository(session);
                friendly.Entity.LanguageId    = language.LanguageId;
                friendly.Entity.Friendlyurlid = requestContext.RouteData.Values["controller"].ToString();
                friendly.LoadByKey();

                if (friendly.Entity.Id != null)
                {
                    string queryString = this.CreateQueryString(HttpContext.Current.Request.QueryString);

                    if (friendly.Entity.Type == Friendlyurl.FriendlyType.Content)
                    {
                        HttpContext.Current.RewritePath("~/Contenido/Index/" + friendly.Entity.Id + "?lang=" + language.LanguageId + queryString);
                        controllerType = this.GetControllerType(requestContext, "Contenido");
                    }
                    else if (friendly.Entity.Type == Friendlyurl.FriendlyType.Idea)
                    {
                        HttpContext.Current.RewritePath("~/Idea/Index/" + friendly.Entity.Id + "?lang=" + language.LanguageId + queryString);
                        controllerType = this.GetControllerType(requestContext, "Idea");
                    }
                    else if (friendly.Entity.Type == Friendlyurl.FriendlyType.BlogEntry)
                    {
                        HttpContext.Current.RewritePath("~/Blog/Index/" + friendly.Entity.Id + "?lang=" + language.LanguageId + queryString);
                        controllerType = this.GetControllerType(requestContext, "Blog");
                    }
                    else if (friendly.Entity.Type == Friendlyurl.FriendlyType.Section)
                    {
                        HttpContext.Current.RewritePath("~/Seccion/Index/" + friendly.Entity.Id + "?lang=" + language.LanguageId + queryString);
                        controllerType = this.GetControllerType(requestContext, "Seccion");
                    }
                    else if (friendly.Entity.Type == Friendlyurl.FriendlyType.SuccessCase)
                    {
                        HttpContext.Current.RewritePath("~/SuccessCase/Index/" + friendly.Entity.Id + "?lang=" + language.LanguageId + queryString);
                        controllerType = this.GetControllerType(requestContext, "SuccessCase");
                    }

                    RouteData routeData = RouteTable.Routes.GetRouteData(requestContext.HttpContext);
                    foreach (KeyValuePair <string, object> routeElement in routeData.Values)
                    {
                        requestContext.RouteData.Values[routeElement.Key] = routeElement.Value;
                    }
                }
                else
                {
                    throw new HttpException(404, string.Empty);
                }

                if (session != null)
                {
                    session.Dispose();
                }

                controller = this.GetControllerInstance(requestContext, controllerType);
            }

            return(controller);
        }
示例#6
0
        /// <summary>
        /// inserts or updates a section object
        /// </summary>
        /// <param name="objSection">object section</param>
        /// <returns>returns true if operation successful</returns>
        public bool SaveSection(Section objSection)
        {
            try
            {
                SectionRepository sectionRepository = new SectionRepository(this.session);

                string section = objSection.Name;

                sectionRepository.Entity = objSection;
                if (sectionRepository.Entity.SectionId != null)
                {
                    if (null != objSection.OldOrder && objSection.Sectionorder != null && objSection.Sectionorder != objSection.OldOrder)
                    {
                        sectionRepository.ChangeOrder(sectionRepository.Entity.Sectionorder.Value, objSection.OldOrder.Value);
                    }

                    sectionRepository.Update();

                    FriendlyurlRepository friendlyrepo = new FriendlyurlRepository(this.session);
                    friendlyrepo.Entity.Id            = sectionRepository.Entity.SectionId;
                    friendlyrepo.Entity.Friendlyurlid = sectionRepository.Entity.Friendlyname;
                    friendlyrepo.Entity.Type          = Friendlyurl.FriendlyType.Section;
                    friendlyrepo.Update();

                    InfoCache <List <Section> > cache = new InfoCache <List <Section> >(this.context)
                    {
                        TimeOut = 120
                    };
                    sectionRepository.Entity = new Section();
                    cache.SetCache("sections", sectionRepository.GetAll());

                    Utils.InsertAudit(
                        this.session,
                        new Audit()
                    {
                        Auditaction = "Update",
                        Description = "Section -> " + section,
                        Joindate    = DateTime.Now,
                        Username    = (this.context.User as CustomPrincipal).UserId
                    });
                }
                else
                {
                    sectionRepository.Entity.Sectionorder = sectionRepository.GetMaxOrder();
                    sectionRepository.Entity.Friendlyname = Utils.GetFindFrienlyName(
                        this.session,
                        sectionRepository.Entity.Name,
                        sectionRepository.Entity.Sectionorder.Value);
                    sectionRepository.Entity.SectionId = Convert.ToInt32(sectionRepository.Insert());

                    FriendlyurlRepository friendlyrepo = new FriendlyurlRepository(this.session);
                    friendlyrepo.Entity.Id            = sectionRepository.Entity.SectionId;
                    friendlyrepo.Entity.Friendlyurlid = sectionRepository.Entity.Friendlyname;
                    friendlyrepo.Entity.Type          = Friendlyurl.FriendlyType.Section;
                    friendlyrepo.Entity.LanguageId    = sectionRepository.Entity.LanguageId;
                    friendlyrepo.Insert();

                    Utils.InsertAudit(
                        this.session,
                        new Audit()
                    {
                        Auditaction = "Insert",
                        Description = "Section -> " + section,
                        Joindate    = DateTime.Now,
                        Username    = (this.context.User as CustomPrincipal).UserId
                    });
                }

                return(true);
            }
            catch (Exception ex)
            {
                Utils.InsertLog(
                    this.session,
                    "Insert Section",
                    ex.Message + " - " + ex.StackTrace);
                return(false);
            }
        }
示例#7
0
        /// <summary>
        /// Fill a front end information
        /// </summary>
        /// <param name="key">search criteria</param>
        /// <param name="userId">current user ID</param>
        public void BindInfo(int key, int?userId)
        {
            ContentRepository objcont = new ContentRepository(this.session);

            this.Metatags = new List <KeyValuePair <KeyValue, KeyValue> >();

            if (this.type == Type.Content)
            {
                objcont.Entity.ContentId = key;
                objcont.LoadByKey();

                if (objcont.Entity.ContentId == null)
                {
                    this.Outcome = Result.NotFound;
                }
                else
                {
                    this.Section = this.sections.Find(t => t.SectionId == objcont.Entity.SectionId);

                    if (Section != null)
                    {
                        this.Content  = objcont.Entity;
                        this.Layout   = this.Section.Layout;
                        this.Template = objcont.Entity.Template;

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("name", "title"),
                                new Domain.Entities.KeyValue("content", objcont.Entity.Name)));

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("name", "description"),
                                new Domain.Entities.KeyValue("content", objcont.Entity.Shortdescription)));

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("property", "og:title"),
                                new Domain.Entities.KeyValue("content", objcont.Entity.Name)));

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("property", "og:description"),
                                new Domain.Entities.KeyValue("content", objcont.Entity.Shortdescription)));

                        if (HttpContext.Current != null)
                        {
                            FileattachRepository fileRepository = new FileattachRepository(new SqlSession());
                            fileRepository.Entity.ContentId = objcont.Entity.ContentId;
                            Fileattach file     = fileRepository.GetAll().FirstOrDefault(t => t.Type == Domain.Entities.Fileattach.TypeFile.Video);
                            string     fileName = string.Empty;
                            if (file != null)
                            {
                                fileName = string.Concat(file.Name, "v=", file.Filename);
                            }

                            string siteUrlRoot = ("http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath).TrimEnd('/');
                            Domain.Entities.FrontEnd.Video video = Business.Utils.GetVideoFromUrl(fileName);
                            string picture = siteUrlRoot + "/1024.png";
                            if (!string.IsNullOrEmpty(objcont.Entity.Image))
                            {
                                picture = siteUrlRoot + "/files/" + objcont.Entity.ContentId + "/" + objcont.Entity.Image;
                            }
                            else if (video != null && video.Type == "youtube")
                            {
                                picture = "http://img.youtube.com/vi/" + video.ID + "/default.jpg";
                            }

                            this.Metatags.Add(
                                new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                    new Domain.Entities.KeyValue("property", "og:image"),
                                    new Domain.Entities.KeyValue("content", picture)));

                            this.Metatags.Add(
                                new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                    new Domain.Entities.KeyValue("property", "og:url"),
                                    new Domain.Entities.KeyValue("content", ("http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath).TrimEnd('/') + "/" + objcont.Entity.Frienlyname)));
                        }

                        this.Outcome      = Result.Ok;
                        this.Detail       = this.GetDetail(this.GetNameType(objcont.Entity.Template), objcont.Entity.ContentId, userId, this.language.LanguageId);
                        this.DeepFollower = Utils.GetDeepFollowerFrontEnd(this.sections, this.Section.SectionId.Value, this.Content, this.language);
                        objcont.Entity.Views++;
                        objcont.Update();
                    }
                    else
                    {
                        this.Outcome = Result.NotFound;
                    }
                }
            }
            else if (this.type == Type.Idea)
            {
                IdeaRepository objidea = new IdeaRepository(this.session);
                objidea.Entity.IdeaId = key;
                objidea.LoadByKey();

                if (objidea.Entity.ContentId == null)
                {
                    this.Outcome = Result.NotFound;
                }
                else
                {
                    objcont.Entity.ContentId = objidea.Entity.ContentId;
                    objcont.LoadByKey();
                    this.Section = this.sections.Find(t => t.SectionId == objcont.Entity.SectionId);

                    if (Section != null)
                    {
                        this.Idea   = objidea.Entity;
                        this.Layout = this.Section.Layout;

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("name", "title"),
                                new Domain.Entities.KeyValue("content", objcont.Entity.Name)));

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("name", "description"),
                                new Domain.Entities.KeyValue("content", objcont.Entity.Shortdescription)));

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("property", "og:title"),
                                new Domain.Entities.KeyValue("content", objcont.Entity.Name)));

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("property", "og:description"),
                                new Domain.Entities.KeyValue("content", objcont.Entity.Shortdescription)));

                        string siteUrlRoot = ("http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath).TrimEnd('/');
                        Domain.Entities.FrontEnd.Video video = Business.Utils.GetVideoFromUrl(objidea.Entity.Video);
                        string picture = siteUrlRoot + "/1024.png";
                        if (!string.IsNullOrEmpty(objidea.Entity.Image))
                        {
                            picture = siteUrlRoot + "/files/ideas/" + objidea.Entity.Image;
                        }
                        else if (video != null && video.Type == "youtube")
                        {
                            picture = "http://img.youtube.com/vi/" + video.ID + "/default.jpg";
                        }

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("property", "og:image"),
                                new Domain.Entities.KeyValue("content", picture)));

                        FriendlyurlRepository url = new FriendlyurlRepository(this.session);
                        url.Entity.Id   = key;
                        url.Entity.Type = Friendlyurl.FriendlyType.Idea;
                        url.Load();

                        this.Metatags.Add(
                            new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                                new Domain.Entities.KeyValue("property", "og:url"),
                                new Domain.Entities.KeyValue("content", ("http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath).TrimEnd('/') + "/" + url.Entity.Friendlyurlid)));

                        this.Outcome = Result.Ok;
                        this.Detail  = this.GetDetail(this.GetNameType(objcont.Entity.Template), objcont.Entity.ContentId, userId, this.language.LanguageId);

                        this.DeepFollower = Utils.GetDeepFollowerFrontEnd(this.sections, this.Section.SectionId.Value, this.Content, this.language);
                        objidea.Entity.Views++;
                        objidea.Update();

                        if (objidea.IsIdeaInTop10(objidea.Entity.IdeaId.Value))
                        {
                            SystemNotificationRepository notification = new SystemNotificationRepository(this.session);
                            int count = notification.SystemNotificationCount(objidea.Entity.UserId.Value, (int)Domain.Entities.Basic.SystemNotificationType.IDEA_TOP_10, objidea.Entity.IdeaId.Value);
                            if (count == 0)
                            {
                                Business.Utilities.Notification.NewNotification(objidea.Entity.UserId.Value, null, Domain.Entities.Basic.SystemNotificationType.IDEA_TOP_10, null, string.Concat("/", objidea.Entity.Friendlyurlid), objidea.Entity.ContentId, objidea.Entity.IdeaId.Value, null, null, null, this.session, this.context, this.language);
                            }
                        }

                        if (objidea.IsIdeaInTop5Home(objidea.Entity.IdeaId.Value))
                        {
                            SystemNotificationRepository notification = new SystemNotificationRepository(this.session);
                            int count = notification.SystemNotificationCount(objidea.Entity.UserId.Value, (int)Domain.Entities.Basic.SystemNotificationType.POPULAR_IDEA_TOP_5, objidea.Entity.IdeaId.Value);
                            if (count == 0)
                            {
                                Business.Utilities.Notification.NewNotification(objidea.Entity.UserId.Value, null, Domain.Entities.Basic.SystemNotificationType.POPULAR_IDEA_TOP_5, null, string.Concat("/", objidea.Entity.Friendlyurlid), objidea.Entity.ContentId, objidea.Entity.IdeaId.Value, null, null, null, this.session, this.context, this.language);
                            }
                        }
                    }
                    else
                    {
                        this.Outcome = Result.NotFound;
                    }
                }
            }
            else
            {
                this.Section = this.sections.Find(t => t.SectionId == key);

                if (this.Section == null)
                {
                    this.Outcome = Result.NotFound;
                }
                else
                {
                    this.Layout   = this.Section.Layout;
                    this.Template = this.Section.Template;

                    this.Metatags.Add(
                        new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                            new Domain.Entities.KeyValue("name", "title"),
                            new Domain.Entities.KeyValue("content", this.Section.Name)));

                    this.Metatags.Add(
                        new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                            new Domain.Entities.KeyValue("name", "description"),
                            new Domain.Entities.KeyValue("content", this.Section.Description)));

                    this.Metatags.Add(
                        new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                            new Domain.Entities.KeyValue("property", "og:title"),
                            new Domain.Entities.KeyValue("content", this.Section.Name)));

                    this.Metatags.Add(
                        new KeyValuePair <Domain.Entities.KeyValue, Domain.Entities.KeyValue>(
                            new Domain.Entities.KeyValue("property", "og:description"),
                            new Domain.Entities.KeyValue("content", this.Section.Description)));

                    this.Outcome = Result.Ok;

                    this.Detail       = this.GetDetail(this.GetNameType(this.Section.Template), this.Section.SectionId, userId, this.language.LanguageId);
                    this.DeepFollower = Utils.GetDeepFollowerFrontEnd(this.sections, this.Section.SectionId.Value, null, this.language);
                }
            }
        }