Пример #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
        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 }));
        }
Пример #3
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 }));
            }
        }