///<summary>Save the article, checks if we are creating new, or updating an existing
        ///</summary>
        ///<param name="a"></param>
        ///<param name="tabId"></param>
        ///<returns></returns>
        public static int SaveArticle(Article a, int tabId)
        {
            if (a.ArticleId < 1)
            {
                a.ArticleId = DataProvider.Instance().AddArticle(a);

                var cntTaxonomy = new Taxonomy.Content();
                var objContentItem = cntTaxonomy.CreateContentItem(a, tabId);

                a.ContentItemId = objContentItem.ContentItemId;
                SaveArticle(a, tabId);
            }
            else
            {
                DataProvider.Instance().UpdateArticle(a);
                var cntTaxonomy = new Taxonomy.Content();
                cntTaxonomy.UpdateContentItem(a, tabId);
            }
            return a.ArticleId;
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ImportModule implements the IPortable ImportModule Interface
        /// </summary>
        /// <param name="moduleId">The Id of the module to be imported</param>
        /// <param name="content">The content to be imported</param>
        /// <param name="version">The version of the module to be imported</param>
        /// <param name="userId">The Id of the user performing the import</param>
        /// -----------------------------------------------------------------------------
        public void ImportModule(int moduleId, string content, string version, int userId)
        {
            var mc = new ModuleController();
            var mi = mc.GetModule(moduleId);

            XmlNode xmldnnsimplearticles = Common.Globals.GetContent(content, "articles");

            if (xmldnnsimplearticles != null)
            // ReSharper disable PossibleNullReferenceException
                foreach (XmlNode xmldnnsimplearticle in xmldnnsimplearticles.SelectNodes("article"))
            // ReSharper restore PossibleNullReferenceException
                {
                    var objdnnsimplearticle = new Article
                                                  {
                                                      ModuleId = moduleId,
                                                      Title = xmldnnsimplearticle.SelectSingleNode("title").InnerText,
                                                      Description =
                                                          xmldnnsimplearticle.SelectSingleNode("description").InnerText,
                                                      Body = xmldnnsimplearticle.SelectSingleNode("body").InnerText,
                                                      CreatedByUserId = userId,
                                                      CreatedOnDate = DateTime.Now,
                                                      LastModifiedByUserId = userId,
                                                      LastModifiedOnDate = DateTime.Now
                                                  };

                    objdnnsimplearticle.Save(mi.TabID);
                }
        }
Ejemplo n.º 3
0
 public override void UpdateArticle(Article a)
 {
     SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, NamePrefix + "spUpdateArticle"
         , new SqlParameter("@ArticleId", a.ArticleId)
         , new SqlParameter("@ModuleId", a.ModuleId)
        , new SqlParameter("@Title", a.Title)
        , new SqlParameter("@Description", a.Description)
        , new SqlParameter("@Body", a.Body)
        , new SqlParameter("@LastModifiedOnDate", a.LastModifiedOnDate)
        , new SqlParameter("@LastModifiedByUserId", a.LastModifiedByUserId)
        , new SqlParameter("@ContentItemId", a.ContentItemId)
        );
 }
Ejemplo n.º 4
0
 public override int AddArticle(Article a)
 {
     return Convert.ToInt32(SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, NamePrefix + "spAddArticle"
         , new SqlParameter("@ModuleId", a.ModuleId)
         , new SqlParameter("@Title", a.Title)
         , new SqlParameter("@Description", a.Description)
         , new SqlParameter("@Body", a.Body)
         , new SqlParameter("@CreatedOnDate", a.CreatedOnDate)
         , new SqlParameter("@CreatedByUserId", a.CreatedByUserId)
         , new SqlParameter("@LastModifiedOnDate", a.LastModifiedOnDate)
         , new SqlParameter("@LastModifiedByUserId", a.LastModifiedByUserId)
         ));
 }
Ejemplo n.º 5
0
 ///<summary>
 /// The add article astract
 ///</summary>
 ///<param name="a"></param>
 ///<returns></returns>
 public abstract int AddArticle(Article a);
Ejemplo n.º 6
0
 ///<summary>
 /// Updating an article
 ///</summary>
 ///<param name="a"></param>
 public abstract void UpdateArticle(Article a);