Example #1
0
        private void LoadGrid()
        {
            CMS_Util iClass1 = new CMS_Util();

            grdContent.DataSource = (from a in iClass1.GetAll() orderby a.Key select a).ToList();
            grdContent.DataBind();
        }
Example #2
0
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            CMS_Util iClass1 = new CMS_Util();

            CMS_Util ToUpdate = new CMS_Util();

            ToUpdate.Key         = litKey.Text;
            ToUpdate.Description = litDescription.Text;
            ToUpdate.Text        = Server.HtmlEncode(txtText.Text.Trim());

            iClass1.UpdateText(ToUpdate);

            divLogin.Visible       = false;
            divContentGrid.Visible = true;
            divEditContent.Visible = false;
        }
Example #3
0
        protected void grdContent_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "EditContent")
            {
                CMS_Util iClass1 = new CMS_Util();

                divLogin.Visible       = false;
                divContentGrid.Visible = false;
                divEditContent.Visible = true;

                CMS_Util found = iClass1.GetByKey(e.CommandArgument.ToString());

                litKey.Text         = found.Key;
                litDescription.Text = found.Description;
                txtText.Text        = found.Text;
            }
        }
Example #4
0
        public List <CMS_Util> GetAll()
        {
            List <CMS_Util> retlist = new List <CMS_Util>();

            DataSet ds = new DataSet();

            ds.ReadXml(HttpContext.Current.Server.MapPath("/CMS/xml/content.xml"));
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                CMS_Util newClass = new CMS_Util();
                newClass.Key         = dr["Key"].ToString();
                newClass.Description = dr["Description"].ToString();
                newClass.Text        = dr[2].ToString();
                retlist.Add(newClass);
            }

            return(retlist);
        }
Example #5
0
        public CMS_Util GetByKey(string Key)
        {
            CMS_Util retval = new CMS_Util();

            DataSet ds = new DataSet();

            ds.ReadXml(HttpContext.Current.Server.MapPath("/CMS/xml/content.xml"));
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (dr["Key"].ToString() == Key)
                {
                    retval.Key         = dr["Key"].ToString();
                    retval.Description = dr["Description"].ToString();
                    retval.Text        = dr[2].ToString();
                    break;
                }
            }

            return(retval);
        }
Example #6
0
        public void UpdateText(CMS_Util ToUpdate)
        {
            DataSet ds = new DataSet();

            ds.ReadXml(HttpContext.Current.Server.MapPath("/CMS/xml/content.xml"));
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (dr["Key"].ToString() == ToUpdate.Key)
                {
                    dr.Delete();
                    break;
                }
            }
            DataRow newRow = ds.Tables[0].NewRow();

            newRow["Key"]         = ToUpdate.Key;
            newRow["Description"] = ToUpdate.Description;
            newRow[2]             = HttpContext.Current.Server.HtmlDecode(ToUpdate.Text);
            ds.Tables[0].Rows.Add(newRow);

            ds.WriteXml(HttpContext.Current.Server.MapPath("/CMS/xml/content.xml"));
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string rrr = CMS_Util.GetText("Home.aspx", "Preface");

            litPreface.Text = rrr;
        }