using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for Class_tblPageContents
/// </summary>
public class Class_tblPageContents
{
    private int int_PageID = 0;
    private String Str_PageContent = String.Empty;

    public Class_tblPageContents(int int_PageID)
	{
        this.int_PageID = int_PageID;
	}

    public Class_tblPageContents(int int_PageID, String Str_PageContent)
    {
        this.int_PageID = int_PageID;
        this.Str_PageContent = Str_PageContent;
    }

    public void UDF_GetPageContent()
    {
        LSC_WareHouseDataContext db = new LSC_WareHouseDataContext();
        try
        {
            tblPageContent tblPgCnt = db.tblPageContents.Single(n => n.PageContentID == int_PageID);
            Str_PageContent = tblPgCnt.PageContentText.Trim();
        }
        catch
        {
            Str_PageContent = "Please Enter Page Content -  Page ID = " + int_PageID.ToString();
        }
    }

    public void UDF_SavePageContent()
    {
        LSC_WareHouseDataContext db = new LSC_WareHouseDataContext();
        tblPageContent tblPgCnt = db.tblPageContents.Single(n => n.PageContentID == int_PageID);
        tblPgCnt.PageContentText = this.Str_PageContent;
        db.SubmitChanges();
    }

    public String Str_PagesContent
    {
        get
        {
            return this.Str_PageContent;
        }
    }
}
