Example #1
0
        protected void OnSaveButtonPressed(object sender, EventArgs e)
        {
            if (!_isNewFileRequestParam)
            {
                editorRedirectHelper(); //exit
            }
            TFS.OpCenter.UI.EditableFileFormEventArgs customEventArgs;

            try
            {
                //cast will fail when user has not entered the Subject and Content of an SRF/FCIF
                customEventArgs = (TFS.OpCenter.UI.EditableFileFormEventArgs)e;
            }
            catch (System.InvalidCastException exception)
            {
                //just continue if cannot be casted, not point in sending email notifications
                editorRedirectHelper();
                return;
            }

            var catController = new ArticlecategoryController();
            var category      = catController.FetchAll().SingleOrDefault(item => item.Name.ToLower() == "general");
            var categoryId    = 5; //general category id;


            if (category != null)
            {
                categoryId = category.Id;
            }

            var url = string.Empty;

            switch (fileType.ToLower())
            {
            case "srf":
                url = "{0}/Forms/SRFView.aspx?file={1}";
                break;

            case "fcif":
                url = "{0}/Forms/FCIFListing.aspx?file={1}";
                break;
            }

            if (string.IsNullOrEmpty(url))
            {
                editorRedirectHelper();
            }
            url = string.Format(url, Utility.GetCurrentWebsiteRoot(), _fileid);
            var subject = string.Format("{0} {1} Released", fileType.ToUpper(), customEventArgs.SrfFcifNumber);
            var content = string.Format("{0} <a href=\"{1}\">Click Here</a>", subject, url);

            var newPostController = new NewspostController();
            var newsPostId        = newPostController.Insert(DateTime.Now, HttpContext.Current.User.Identity.Name, categoryId, subject, content, true);


            WebRequestHelper.UserControllerSendNewsPostNotificationRequest(newsPostId);

            editorRedirectHelper();
        }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            IEnumerable <Newspost> urgentNews   = new NewspostController().FetchUrgent();
            NewspostCollection     news         = new NewspostController().FetchAllNotDeleted();
            HelparticleCollection  helparticles = new HelparticleController().FetchAllNotDeleted();

            news.Sort(Newspost.Columns.Createdon, false);
            helparticles.Sort(Helparticle.Columns.Createdon, false);

            this.HotItems.DataSource = urgentNews.OrderByDescending(item => item.Createdon);
            this.HotItems.DataBind();

            this.NewsEntries.DataSource = news;
            this.NewsEntries.DataBind();

            this.HelpEntries.DataSource = helparticles;
            this.HelpEntries.DataBind();
        }
    }