예제 #1
0
        public ActionResult Detail(int id, int?mod, int?sectionId)
        {
            SuccessStoryPostulateFacade successStoryPostulateFacade = new SuccessStoryPostulateFacade();
            TagFacade       tagFacade = new TagFacade();
            ModulRepository modul     = new ModulRepository(SessionCustom);

            modul.Entity.ModulId    = mod;
            modul.Entity.LanguageId = this.CurrentLanguage.LanguageId;
            modul.Load();
            this.ViewBag.SectionId = sectionId;

            SuccessStoryPostulate successStoryPostulate = successStoryPostulateFacade.GetById(id, (int)this.CurrentLanguage.LanguageId);

            successStoryPostulate.State = (byte)SuccessStoryPostulateStateEnum.Pending;
            successStoryPostulateFacade.Update(successStoryPostulate);

            return(this.View(new DetailModel
            {
                SuccessStoryPostulate = successStoryPostulate,
                TagsText = string.Join(", ", tagFacade.GetBySuccessStoryPostulate(id).Select(t => t.Name)),
                UserPrincipal = this.CustomUser,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Module = modul.Entity,
                CurrentLanguage = this.CurrentLanguage,
            }));
        }
예제 #2
0
        /// <summary>
        /// Obtiene las postulaciones
        /// </summary>
        /// <param name="page">page index</param>
        /// <param name="mod">Identificador del modulo</param>
        /// <param name="sectionId">Identificador de la seccion</param>
        /// <returns>Vista de las postulaciones</returns>
        public ActionResult List(int?page, int?mod, int?sectionId)
        {
            int total      = 0;
            int pageSize   = 10;
            int pageNumber = page ?? 1;
            SuccessStoryPostulateFacade        postulates = new SuccessStoryPostulateFacade();
            ModulRepository                    modul      = new ModulRepository(SessionCustom);
            List <SuccessStoryPostulatePaging> paging     = postulates.GetPaging(pageNumber, pageSize, out total, this.CurrentLanguage.LanguageId.Value).ToList();

            modul.Entity.ModulId    = mod;
            modul.Entity.LanguageId = this.CurrentLanguage.LanguageId;
            modul.Load();
            decimal nropagesdec = decimal.Parse(total.ToString()) / decimal.Parse(pageSize.ToString());
            decimal nropagesint = (int)(total / pageSize);

            this.ViewBag.CurrentPage = pageNumber;
            this.ViewBag.TotalRows   = total;
            this.ViewBag.SizePage    = pageSize;
            this.ViewBag.NroPages    = nropagesdec > nropagesint ? nropagesint + 1 : nropagesint;
            this.ViewBag.SectionId   = sectionId;

            return(this.View(
                       "List",
                       new SuccessStoryPostulateModel()
            {
                UserPrincipal = this.CustomUser,
                ListaSuccessStoryPostulate = paging,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),

                Module = modul.Entity,
                CurrentLanguage = this.CurrentLanguage,
            }));
        }
예제 #3
0
        public ActionResult Reject(int id, int?mod, int?sectionId)
        {
            SuccessStoryPostulateFacade successStoryPostulateFacade = new SuccessStoryPostulateFacade();
            SuccessStoryPostulate       successStoryPostulate       = successStoryPostulateFacade.GetById(id, (int)this.CurrentLanguage.LanguageId);

            successStoryPostulate.State = (byte)SuccessStoryPostulateStateEnum.Rejected;
            successStoryPostulateFacade.Update(successStoryPostulate);
            this.SendUserNotification(successStoryPostulate.UserId, successStoryPostulate.Name);
            return(this.RedirectToAction("List", new { mod = mod, sectionId = sectionId }));
        }
예제 #4
0
        /// <summary>
        /// gets the home of SuccessStoryEntry module
        /// </summary>
        /// <param name="mod">identifier of module</param>
        /// <param name="sectionId">identifier of section</param>
        /// <param name="idpostulate">Id de la postulacion</param>
        /// <returns>returns the result to action</returns>
        public ActionResult Index(int mod, int?sectionId, int?idpostulate)
        {
            ContentManagement  objcontentman = new ContentManagement(this.SessionCustom, HttpContext);
            SectionRepository  objsection    = new SectionRepository(this.SessionCustom);
            TemplateRepository objtemplate   = new TemplateRepository(this.SessionCustom);
            TagFacade          tagFacade     = new TagFacade();

            objtemplate.Entity.Type = 2;

            if (idpostulate != null)
            {
                Core.Facades.SuccessStoryPostulateFacade dbpostulate = new SuccessStoryPostulateFacade();

                Domain.Entities.Generic.SuccessStoryPostulate postulate = dbpostulate.GetById(idpostulate.Value, this.CurrentLanguage.LanguageId.Value);
                Domain.Entities.SuccessStory successtory = new Domain.Entities.SuccessStory();
                Domain.Entities.Content      content     = new Domain.Entities.Content();

                content.ModulId   = mod;
                content.SectionId = sectionId;

                if (postulate.LanguageId == (int)Domain.Entities.Enums.LanguageEnum.English)
                {
                    content.NameIngles               = postulate.Name;
                    successtory.DescriptionIngles    = postulate.Description;
                    successtory.ProblemsSolvedIngles = postulate.ConcreteProblems;
                    successtory.SocialImpactIngles   = postulate.InnovativeUrbanSolution;
                }
                else
                {
                    content.Name               = postulate.Name;
                    successtory.Description    = postulate.Description;
                    successtory.ProblemsSolved = postulate.ConcreteProblems;
                    successtory.SocialImpact   = postulate.InnovativeUrbanSolution;
                }

                content.Category   = postulate.CategoryName;
                content.UserId     = postulate.UserId;
                content.LanguageId = postulate.LanguageId;
                successtory.InstitutionImplements = postulate.ResponsibleOrganization;
                successtory.InstitutionSource     = postulate.ResponsibleNames;
                successtory.Category = postulate.CategoryName;
                successtory.Url      = postulate.Documents;
                successtory.CityID   = postulate.CityId;

                IList <Tag> listaTags    = tagFacade.GetBySuccessStoryPostulate(idpostulate.Value);
                string      tagsNews     = string.Empty;
                string      existingTags = string.Empty;

                foreach (Tag temp in listaTags)
                {
                    if (temp.TagId != null)
                    {
                        existingTags += temp.TagId + "|";
                    }
                    else
                    {
                        tagsNews += temp.Name + "|";
                    }
                }

                if (tagsNews.EndsWith("|"))
                {
                    tagsNews = tagsNews.Substring(0, tagsNews.Length - 1);
                }

                if (existingTags.EndsWith("|"))
                {
                    existingTags = existingTags.Substring(0, existingTags.Length - 1);
                }

                this.ViewBag.SelectedTags = existingTags;
                this.ViewBag.NewsTags     = tagsNews;

                return(this.View(new SuccessStoryModel()
                {
                    PostulateId = idpostulate,
                    SuccessStory = successtory,
                    IContent = content,
                    UserPrincipal = this.CustomUser,
                    Module = this.Module,
                    ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                    Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                    DeepFollower = sectionId != null ? Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId.Value) : null,
                    CurrentLanguage = this.CurrentLanguage,
                    Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                        Text = t.Name, Value = t.TagId.ToString()
                    })
                }));
            }

            return(this.View(new SuccessStoryModel()
            {
                UserPrincipal = this.CustomUser,
                Module = this.Module,
                ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext),
                Templates = objtemplate.GetAll().Select(t => t.TemplateId),
                DeepFollower = sectionId != null ? Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId.Value) : null,
                IContent = new Domain.Entities.Content()
                {
                    ModulId = mod,
                    SectionId = sectionId
                },
                CurrentLanguage = this.CurrentLanguage,
                Tags = tagFacade.GetAll().Select(t => new SelectListItem {
                    Text = t.Name, Value = t.TagId.ToString()
                })
            }));
        }
예제 #5
0
        public ActionResult Create(SuccessStoryModel model, HttpPostedFileBase contentImage, HttpPostedFileBase contentCoverImage, List <string> videoyoutube, string existingTags, string newTags)
        {
            SuccessStoryRepository objSuccessStory = new SuccessStoryRepository(this.SessionCustom);
            ContentManagement      objcontent      = new ContentManagement(this.SessionCustom, HttpContext);

            try
            {
                objcontent.ContentImage      = contentImage;
                objcontent.ContentCoverImage = contentCoverImage;
                objcontent.CollVideos        = videoyoutube;
                this.SessionCustom.Begin();

                model.IContent.LanguageId = CurrentLanguage.LanguageId;
                objcontent.ContentInsert(model.IContent, 4);
                objSuccessStory.Entity = model.SuccessStory;
                objSuccessStory.Entity.ExistingTags = !string.Empty.Equals(existingTags) ? existingTags : null;
                objSuccessStory.Entity.NewTags      = !string.Empty.Equals(newTags) ? newTags : null;

                if (objSuccessStory.Entity.ContentId != null)
                {
                    objSuccessStory.Update();
                    this.InsertAudit("Update", this.Module.Name + " -> " + model.IContent.Name);
                }
                else
                {
                    if (!string.IsNullOrEmpty(Request.Form["TempFiles"]))
                    {
                        string[] files = Request.Form["TempFiles"].Split(',');

                        if (files.Length > 0)
                        {
                            if (!Directory.Exists(Path.Combine(Server.MapPath("~"), @"Files\" + objcontent.ObjContent.ContentId + @"\")))
                            {
                                Directory.CreateDirectory(Path.Combine(Server.MapPath("~"), @"Files\" + objcontent.ObjContent.ContentId + @"\"));
                            }
                        }

                        foreach (var item in files)
                        {
                            string filep = Path.Combine(Server.MapPath("~"), @"Files\Images\" + Path.GetFileName(item));
                            if (System.IO.File.Exists(filep))
                            {
                                string filedestin = Path.Combine(Server.MapPath("~"), @"Files\Images\" + Path.GetFileName(item));
                                System.IO.File.Move(filep, Path.Combine(Server.MapPath("~"), @"Files\" + objcontent.ObjContent.ContentId + @"\" + Path.GetFileName(item)));
                            }
                        }
                    }

                    objSuccessStory.Entity.ContentId = objcontent.ObjContent.ContentId;
                    objSuccessStory.Insert();

                    this.InsertAudit("Insert", this.Module.Name + " -> " + model.IContent.Name);
                }

                this.SessionCustom.Commit();

                if (model.PostulateId != null)
                {
                    SuccessStoryPostulateFacade dbpostulate = new SuccessStoryPostulateFacade();
                    Domain.Entities.Generic.SuccessStoryPostulate postulate = dbpostulate.GetById(model.PostulateId.Value, this.CurrentLanguage.LanguageId.Value);
                    postulate.SuccessStoryId = objcontent.ObjContent.ContentId;
                    postulate.State          = (int)Domain.Entities.Enums.SuccessStoryPostulateStateEnum.Published;
                    if (dbpostulate.Update(postulate))
                    {
                        string domainUrl = string.Format("/SuccessStory/Story/{0}", objcontent.ObjContent.ContentId.Value);
                        this.SendUserNotification(postulate.UserId, domainUrl, objcontent.ObjContent.ContentId.Value);
                    }

                    this.InsertAudit("Update Postulate", this.Module.Name + " -> " + model.IContent.Name);
                }
            }
            catch (Exception ex)
            {
                SessionCustom.RollBack();
                Utils.InsertLog(
                    this.SessionCustom,
                    "Error" + this.Module.Name,
                    ex.Message + " " + ex.StackTrace);
            }

            if (Request.Form["GetOut"] == "0")
            {
                return(this.RedirectToAction("Index", "Content", new { mod = Module.ModulId }));
            }
            else
            {
                return(this.RedirectToAction("Detail", "SuccessStory", new { mod = Module.ModulId, id = objSuccessStory.Entity.ContentId }));
            }
        }