Exemple #1
0
        protected void cmdSave_Click(object sender, EventArgs e)
        {
            ArticlesTableAdapter tbaArticles = new ArticlesTableAdapter();
            String articleID = Request.QueryString["articleid"];
            int    newID;

            try
            {
                if (articleID != null)
                {
                    tbaArticles.Update(textTitle.Text, textPath.Text, textSummary.Text, "",
                                       checkActive.Checked, DateTime.Now, DateTime.Parse(textReview.Text),
                                       int.Parse(articleID.ToString()));
                }
                else
                {
                    //tbaArticles.Insert(textTitle.Text, textPath.Text, textSummary.Text, "", checkActive.Checked, DateTime.Parse(textReview.Text), out newID);

                    //Response.Redirect("admin.aspx?articleID=" + newID.ToString(), false);
                }
            }
            catch (Exception ex)
            {
                General.ErrorHandler(ex, "Error thrown by admin.aspx.cmdSave_Click()");
            }
        }
        protected void cmdSave_Click(object sender, EventArgs e)
        {
            ArticlesTableAdapter tbaArticles = new ArticlesTableAdapter();
            String articleID = Request.QueryString["itemID"];
            int    newID;

            //If there is no article ID specified, save a new article record.  Otherwise, update the specified article.
            try
            {
                if (articleID != null)
                {
                    newID = int.Parse(articleID.ToString());
                    tbaArticles.Update(textTitle.Text, textPath.Text, textDescription.Text, textSummary.Text,
                                       checkActive.Checked, DateTime.Now, checkSearch.Checked, checkRandom.Checked, newID);
                }
                else
                {
                    tbaArticles.Insert(textTitle.Text, textPath.Text, textDescription.Text, textSummary.Text, checkActive.Checked, checkRandom.Checked, checkSearch.Checked, out newID);
                }

                Response.Redirect("adminpanel.aspx?catID=articles&itemID=" + newID.ToString(), false);
            }
            catch (Exception ex)
            {
                General.ErrorHandler(ex, "Error thrown by adminpanel.aspx.cmdSave_Click()");
            }
        }
Exemple #3
0
        protected void LoadArticle(int ArticleID)
        {
            ArticlesTableAdapter tbaArticles = new ArticlesTableAdapter();

            AppData.ArticlesRow rwArticle =
                (AppData.ArticlesRow)tbaArticles.GetDataByID(ArticleID).Rows[0];

            textTitle.Text      = rwArticle.DisplayTitle;
            textPath.Text       = rwArticle.FilePath;
            textSummary.Text    = rwArticle.ShortDescription;
            checkActive.Checked = rwArticle.Active;
            textReview.Text     = rwArticle.ReviewDate.ToString();
        }
Exemple #4
0
        protected AppData.ArticlesRow GetArticle()
        {
            ArticlesTableAdapter tbaArticle = new ArticlesTableAdapter();

            AppData.ArticlesRow rwArticle;

            try
            {
                rwArticle = (AppData.ArticlesRow)tbaArticle.GetRandomArticle().Rows[0];
            }
            catch
            {
                throw;
            }

            return(rwArticle);
        }
Exemple #5
0
        protected void gvArticles_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                // Get the article ID from the selected row, pull the correct article
                // and redirect to it.
                GridViewRow          rwSelect    = gvArticles.SelectedRow;
                int                  articleID   = int.Parse(rwSelect.Cells[rwSelect.Cells.Count - 1].Text);
                ArticlesTableAdapter tbaArticles = new ArticlesTableAdapter();

                AppData.ArticlesRow rwArticle =
                    (AppData.ArticlesRow)tbaArticles.GetDataByID(articleID).Rows[0];

                Response.Redirect("~/" + rwArticle.FilePath, false);
            }
            catch (Exception ex)
            {
                General.ErrorHandler(ex, "Exception thrown by Search.aspx.gvArticles_SelectedIndexChanged.");
            }
        }
        protected void LoadArticle(int ArticleID)
        {
            // Load the specified article and fill in the page fields.

            ArticlesTableAdapter tbaArticles = new ArticlesTableAdapter();

            try
            {
                AppData.ArticlesRow rwArticle =
                    (AppData.ArticlesRow)tbaArticles.GetDataByID(ArticleID).Rows[0];

                textTitle.Text       = rwArticle.DisplayTitle;
                textPath.Text        = rwArticle.FilePath;
                textDescription.Text = rwArticle.ShortDescription;
                textSummary.Text     = rwArticle.LongSummary;
                checkActive.Checked  = rwArticle.Active;
                checkRandom.Checked  = rwArticle.RandomSelect;
                checkSearch.Checked  = rwArticle.SearchSelect;
            }
            catch
            {
                throw;
            }
        }