Example #1
0
        protected void UpdateContent_Click(object sender, EventArgs e)
        {
            if (ValidateUpdateFields())
            {
                int      ID        = int.Parse(lblID.Text);
                string   title     = tbTitle.Text;
                string   source    = tbSource.Text;
                string   author    = tbAuthor.Text;
                string   smallDesc = SmallDesc.InnerText;
                string   bigDesc   = BigDesc.Value;
                bool     hidden    = cbHidden.Checked;
                DateTime modified  = DateTime.Parse(ModifiedDate.Text);

                AdminOthers.UpdateOther(ID, title, source, author, smallDesc, bigDesc, hidden, modified);

                if (ID > 0)
                {
                    lblMessage.Text = "Item was successfully updated !!!";
                    ClearUpdateFields();
                }
                else
                {
                    lblMessage.Text = "Update item content error.";
                }
            }
        }
Example #2
0
        protected void AddNewContent_Click(object sender, EventArgs e)
        {
            if (ValidateInsertFields())
            {
                string   title     = tbTitle.Text;
                string   source    = tbSource.Text;
                string   author    = tbAuthor.Text;
                string   smallDesc = SmallDesc.InnerText;
                string   bigDesc   = BigDesc.Value;
                bool     hidden    = cbHidden.Checked;
                DateTime modified  = DateTime.Parse(ModifiedDate.Text);

                int ID = 0;
                ID = AdminOthers.AddOther(title, source, author, smallDesc, bigDesc, hidden, modified);

                if (ID > 0)
                {
                    lblMessage.Text = "Item was successfully added !!!";
                    ClearInsertFields();
                    BindData();
                }
                else
                {
                    lblMessage.Text = "Add new content error.";
                }
            }
        }
Example #3
0
        protected void OthersGrid_PageIndexChanging(Object sender, GridViewPageEventArgs e)
        {
            OthersGrid.PageIndex = e.NewPageIndex;
            DataTable list = AdminOthers.GetOtherList();

            OthersGrid.DataSource = list;
            OthersGrid.DataBind();
        }
Example #4
0
        protected void BindData()
        {
            DataTable itemslist = AdminOthers.GetOtherList();

            OthersGrid.DataSource = itemslist;
            OthersGrid.DataBind();

            ModifiedDate.Text = DateTime.Now.ToString("MM/dd/yyyy");
        }
Example #5
0
        protected void OthersGrid_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            lblMessage.Text = "";
            int ID = int.Parse(OthersGrid.Rows[e.RowIndex].Cells[1].Text);

            logger.Debug("deleting news - " + ID);

            AdminOthers.DeleteOther(ID);

            //logger.Debug("binding news ");
            BindData();
        }
Example #6
0
        protected void BindData()
        {
            DataTable items = AdminOthers.GetOther(_ID);

            if (items.Rows.Count > 0)
            {
                DataRow row = items.Rows[0];
                lblID.Text          = row["ID"].ToString();
                tbTitle.Text        = row["Title"].ToString();
                tbSource.Text       = row["Source"].ToString();
                tbAuthor.Text       = row["Author"].ToString();
                SmallDesc.InnerText = row["SmallDesc"].ToString();
                BigDesc.Value       = row["BigDesc"].ToString();
                cbHidden.Checked    = bool.Parse(row["Hidden"].ToString());
                ModifiedDate.Text   = DateTime.Parse(row["Modified"].ToString()).ToString("MM/dd/yyyy");
            }
        }