Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }