public static void CreateContent(int moduleId, string culture, int statusId, DateTime modified, string text)
        {
            ContentTableAdapter contentAdapter = new ContentTableAdapter();

            DataAccessLayer.ContentDataTable contentTable = new DataAccessLayer.ContentDataTable();
            DataAccessLayer.ContentRow       contentRow   = contentTable.NewContentRow();
            contentRow.ModuleId = moduleId;
            contentRow.Modified = modified;
            contentRow.StatusId = statusId;
            contentRow.Culture  = culture;
            contentRow.Text     = text;
            //contentRow.RowState = DataRowState.Added;

            contentTable.AddContentRow(contentRow);

            contentAdapter.Update(contentTable);
        }
        public static void UpdateContent(int contentVersionId, int moduleId, string culture, int statusId, DateTime modified, string text)
        {
            ContentTableAdapter contentAdapter = new ContentTableAdapter();

            DataAccessLayer.ContentDataTable contentTable = contentAdapter.GetContentByContentVersionId(contentVersionId);
            if (contentTable.Rows.Count != 1)
            {
                throw new Exception("GetContentByContentVersionId did not return 1 row.");
            }

            DataAccessLayer.ContentRow contentRow = (DataAccessLayer.ContentRow)contentTable.Rows[0];
            contentRow.ModuleId = moduleId;
            contentRow.Modified = modified;
            contentRow.StatusId = statusId;
            contentRow.Culture  = culture;
            contentRow.Text     = text;

            contentAdapter.Update(contentRow);
        }
        public static Content GetContentByContentVersionId(int contentVersionId)
        {
            ContentTableAdapter contentAdapter = new ContentTableAdapter();

            DataAccessLayer.ContentDataTable contentTable = contentAdapter.GetContentByContentVersionId(contentVersionId);
            Content archivedContent = new Content();

            if (contentTable.Rows.Count == 0)
            {
                return(null);
            }

            DataAccessLayer.ContentRow contentRow = (DataAccessLayer.ContentRow)contentTable.Rows[0];

            archivedContent.ContentVersionId = contentRow.ContentVersionId;
            archivedContent.ModuleId         = contentRow.ModuleId;
            archivedContent.StatusId         = contentRow.StatusId;
            archivedContent.Culture          = contentRow.Culture;
            archivedContent.Text             = contentRow.Text;
            archivedContent.Modified         = contentRow.Modified;

            return(archivedContent);
        }
        public static Collection <Content> GetArchivedContent(int moduleId, string culture)
        {
            ContentTableAdapter contentAdapter = new ContentTableAdapter();

            DataAccessLayer.ContentDataTable contentTable    = contentAdapter.GetContentByStatusId(3, moduleId, culture);
            Collection <Content>             archivedContent = new Collection <Content>();

            foreach (DataRow dataRow in contentTable.Rows)
            {
                DataAccessLayer.ContentRow contentRow = (DataAccessLayer.ContentRow)dataRow;
                Content contentObject = new Content();
                contentObject.ContentVersionId = contentRow.ContentVersionId;
                contentObject.ModuleId         = contentRow.ModuleId;
                contentObject.StatusId         = contentRow.StatusId;
                contentObject.Culture          = contentRow.Culture;
                contentObject.Text             = contentRow.Text;
                contentObject.Modified         = contentRow.Modified;

                archivedContent.Add(contentObject);
            }

            return(archivedContent);
        }
        public static Content GetPendingContent(int moduleId, string culture)
        {
            ContentTableAdapter contentAdapter = new ContentTableAdapter();

            DataAccessLayer.ContentDataTable contentTable;

            contentTable = contentAdapter.GetContentByStatusId(1, moduleId, culture);
            if (contentTable.Rows.Count > 0)
            {
                DataAccessLayer.ContentRow activeContentRow = (DataAccessLayer.ContentRow)contentTable.Rows[0];
                Content content = new Content();
                content.ContentVersionId = activeContentRow.ContentVersionId;
                content.ModuleId         = activeContentRow.ModuleId;
                content.Culture          = activeContentRow.Culture;
                content.StatusId         = activeContentRow.StatusId;
                content.Modified         = activeContentRow.Modified;
                content.Text             = activeContentRow.Text;
                return(content);
            }
            else
            {
                return(null);
            }
        }