Exemplo n.º 1
0
 public ArticleType GetByID(int _articleTypeID)
 {
     ArticleTypeDAC _articleTypeComponent = new ArticleTypeDAC();
      IDataReader reader = _articleTypeComponent.GetByIDArticleType(_articleTypeID);
      ArticleType _articleType = null;
      while(reader.Read())
      {
          _articleType = new ArticleType();
          if(reader["ArticleTypeID"] != DBNull.Value)
              _articleType.ArticleTypeID = Convert.ToInt32(reader["ArticleTypeID"]);
          if(reader["Name"] != DBNull.Value)
              _articleType.Name = Convert.ToString(reader["Name"]);
          if(reader["Code"] != DBNull.Value)
              _articleType.Code = Convert.ToString(reader["Code"]);
      _articleType.NewRecord = false;             }             reader.Close();
      return _articleType;
 }
Exemplo n.º 2
0
 public List<ArticleType> GetAll()
 {
     ArticleTypeDAC _articleTypeComponent = new ArticleTypeDAC();
      IDataReader reader =  _articleTypeComponent.GetAllArticleType().CreateDataReader();
      List<ArticleType> _articleTypeList = new List<ArticleType>();
      while(reader.Read())
      {
      if(_articleTypeList == null)
          _articleTypeList = new List<ArticleType>();
          ArticleType _articleType = new ArticleType();
          if(reader["ArticleTypeID"] != DBNull.Value)
              _articleType.ArticleTypeID = Convert.ToInt32(reader["ArticleTypeID"]);
          if(reader["Name"] != DBNull.Value)
              _articleType.Name = Convert.ToString(reader["Name"]);
          if(reader["Code"] != DBNull.Value)
              _articleType.Code = Convert.ToString(reader["Code"]);
      _articleType.NewRecord = false;
      _articleTypeList.Add(_articleType);
      }             reader.Close();
      return _articleTypeList;
 }
Exemplo n.º 3
0
        public List<Article> GetAllArticles(string LanguageID)
        {
            ArticleDAC _articleComponent = new ArticleDAC();
            string whereCondition = "";

            IDataReader reader = _articleComponent.ViewAllArticles("LanguageID = " + LanguageID).CreateDataReader();
            List<Article> _articleList = new List<Article>();
            while (reader.Read())
            {
                if (_articleList == null)
                    _articleList = new List<Article>();
                Article _article = new Article();
                #region Article Information

                if (reader["ArticleId"] != DBNull.Value)
                    _article.ArticleId = Convert.ToInt32(reader["ArticleId"]);
                if (reader["SiteSectionId"] != DBNull.Value)
                    _article.SiteSectionId = Convert.ToInt32(reader["SiteSectionId"]);
                if (reader["CreatorId"] != DBNull.Value)
                    _article.CreatorId = Convert.ToInt32(reader["CreatorId"]);
                if (reader["ArticleStatusId"] != DBNull.Value)
                    _article.ArticleStatusId = Convert.ToInt32(reader["ArticleStatusId"]);
                if (reader["AuthorId"] != DBNull.Value)
                    _article.AuthorId = Convert.ToInt32(reader["AuthorId"]);
                if (reader["PostDate"] != DBNull.Value)
                    _article.PostDate = Convert.ToDateTime(reader["PostDate"]);
                if (reader["AllowLanguageSpecificTags"] != DBNull.Value)
                    _article.AllowLanguageSpecificTags = Convert.ToBoolean(reader["AllowLanguageSpecificTags"]);
                if (reader["RowGuid"] != DBNull.Value)
                    _article.RowGuid = new Guid(reader["RowGuid"].ToString());
                if (reader["ModifiedDate"] != DBNull.Value)
                    _article.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
                if (reader["CommentsTypeId"] != DBNull.Value)
                    _article.CommentsTypeId = Convert.ToInt32(reader["CommentsTypeId"]);
                if (reader["EnableModeteration"] != DBNull.Value)
                    _article.EnableModeteration = Convert.ToBoolean(reader["EnableModeteration"]);
                if (reader["SiteId"] != DBNull.Value)
                    _article.SiteId = Convert.ToInt32(reader["SiteId"]);
                if (reader["ArticleTypeID"] != DBNull.Value)
                    _article.ArticleTypeID = Convert.ToInt32(reader["ArticleTypeID"]);
                if (reader["ViewsCount"] != DBNull.Value)
                    _article.ViewsCount = Convert.ToInt32(reader["ViewsCount"]);
                if (reader["CommentsCount"] != DBNull.Value)
                    _article.CommentsCount = Convert.ToInt32(reader["CommentsCount"]);
                if (reader["CreatorName"] != DBNull.Value)
                    _article.CreatorName = Convert.ToString(reader["CreatorName"].ToString());
                _article.NewRecord = false;
                #endregion

                #region Article Languages
                List<ArticleLanguage> _articleLanguageList = new List<ArticleLanguage>();

                ArticleLanguage _articleLanguage = new ArticleLanguage();
                if (reader["ArticleLanguageId"] != DBNull.Value)
                    _articleLanguage.ArticleLanguageId = Convert.ToInt32(reader["ArticleLanguageId"]);

                if (reader["ArticleId"] != DBNull.Value)
                    _articleLanguage.ArticleId = Convert.ToInt32(reader["ArticleId"]);
                if (reader["LanguageId"] != DBNull.Value)
                    _articleLanguage.LanguageId = Convert.ToInt32(reader["LanguageId"]);
                if (reader["ArticleName"] != DBNull.Value)
                    _articleLanguage.ArticleName = Convert.ToString(reader["ArticleName"]);
                if (reader["ArticleContent"] != DBNull.Value)
                    _articleLanguage.ArticleContent = Convert.ToString(reader["ArticleContent"]);
                if (reader["ArticleAttachment"] != DBNull.Value)
                    _articleLanguage.ArticleAttachment = Convert.ToString(reader["ArticleAttachment"]);
                if (reader["AuthorAlias"] != DBNull.Value)
                    _articleLanguage.AuthorAlias = Convert.ToString(reader["AuthorAlias"]);
                if (reader["ArticleAlias"] != DBNull.Value)
                    _articleLanguage.ArticleAlias = Convert.ToString(reader["ArticleAlias"]);
                if (reader["LanguagePostDate"] != DBNull.Value)
                    _articleLanguage.PostDate = Convert.ToDateTime(reader["LanguagePostDate"]);
                if (reader["PublishStartDate"] != DBNull.Value)
                    _articleLanguage.PublishStartDate = Convert.ToDateTime(reader["PublishStartDate"]);
                if (reader["PublishEndDate"] != DBNull.Value)
                    _articleLanguage.PublishEndDate = Convert.ToDateTime(reader["PublishEndDate"]);
                if (reader["RevisionDate"] != DBNull.Value)
                    _articleLanguage.RevisionDate = Convert.ToDateTime(reader["RevisionDate"]);
                if (reader["ModifiedDate"] != DBNull.Value)
                    _articleLanguage.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]);
                if (reader["ArticleSummary"] != DBNull.Value)
                    _articleLanguage.ArticleSummary = Convert.ToString(reader["ArticleSummary"]);
                if (reader["ArticleSubTitle"] != DBNull.Value)
                    _articleLanguage.ArticleSubTitle = Convert.ToString(reader["ArticleSubTitle"]);
                if (reader["ArticleShortTitle"] != DBNull.Value)
                    _articleLanguage.ArticleShortTitle = Convert.ToString(reader["ArticleShortTitle"]);
                _articleLanguage.NewRecord = false;
                _articleLanguageList.Add(_articleLanguage);
                #endregion

                #region Article Section

                SiteSection _siteSection = new SiteSection();
                if (reader["SiteSectionId"] != DBNull.Value)
                    _siteSection.SiteSectionId = Convert.ToInt32(reader["SiteSectionId"]);
                if (reader["SiteSectionName"] != DBNull.Value)
                    _siteSection.Name = Convert.ToString(reader["SiteSectionName"]);
                if (reader["SiteSectionParentId"] != DBNull.Value)
                    _siteSection.SiteSectionParentId = Convert.ToInt32(reader["SiteSectionParentId"]);
                if (reader["SectionStatusId"] != DBNull.Value)
                    _siteSection.SectionStatusId = Convert.ToInt32(reader["SectionStatusId"]);
                if (reader["SiteId"] != DBNull.Value)
                    _siteSection.SiteId = Convert.ToInt32(reader["SiteId"]);
                if (reader["PersonId"] != DBNull.Value)
                    _siteSection.PersonId = Convert.ToInt32(reader["PersonId"]);
                if (reader["SecurityAccessTypeId"] != DBNull.Value)
                    _siteSection.SecurityAccessTypeId = Convert.ToInt32(reader["SecurityAccessTypeId"]);

                _siteSection.NewRecord = false;
                _article.CurrentSection = _siteSection;
                #endregion

                #region Article Type
                ArticleType _articleType = new ArticleType();
                if (reader["ArticleTypeID"] != DBNull.Value)
                    _articleType.ArticleTypeID = Convert.ToInt32(reader["ArticleTypeID"]);
                if (reader["ArticleTypeName"] != DBNull.Value)
                    _articleType.Name = Convert.ToString(reader["ArticleTypeName"]);
                if (reader["ArticleTypeCode"] != DBNull.Value)
                    _articleType.Code = Convert.ToString(reader["ArticleTypeCode"]);
                #endregion

                #region Author Information
                BusinessLogicLayer.Entities.Persons.Person _person = new Entities.Persons.Person();
                if (reader["AuthorId"] != DBNull.Value)
                    _person.BusinessEntityId = Convert.ToInt32(reader["AuthorId"]);
                if (reader["NameStyle"] != DBNull.Value)
                    _person.NameStyle = Convert.ToBoolean(reader["NameStyle"]);
                if (reader["PersonImage"] != DBNull.Value)
                    _person.PersonImage = Convert.ToString(reader["PersonImage"]);
                BusinessLogicLayer.Entities.Persons.PersonLanguages _personLanguages = new BusinessLogicLayer.Entities.Persons.PersonLanguages();
                if (reader["PersonLanguageId"] != DBNull.Value)
                    _personLanguages.PersonLanguageId = Convert.ToInt32(reader["PersonLanguageId"]);
                if (reader["AuthorId"] != DBNull.Value)
                    _personLanguages.PersonId = Convert.ToInt32(reader["AuthorId"]);
                if (reader["LanguageId"] != DBNull.Value)
                    _personLanguages.LanguageId = Convert.ToInt32(reader["LanguageId"]);
                if (reader["Title"] != DBNull.Value)
                    _personLanguages.Title = Convert.ToString(reader["Title"]);
                if (reader["FirstName"] != DBNull.Value)
                    _personLanguages.FirstName = Convert.ToString(reader["FirstName"]);
                if (reader["MiddleName"] != DBNull.Value)
                    _personLanguages.MiddleName = Convert.ToString(reader["MiddleName"]);
                if (reader["LastName"] != DBNull.Value)
                    _personLanguages.LastName = Convert.ToString(reader["LastName"]);
                if (reader["Suffix"] != DBNull.Value)
                    _personLanguages.Suffix = Convert.ToString(reader["Suffix"]);
                if (reader["DisplayName"] != DBNull.Value)
                    _personLanguages.DisplayName = Convert.ToString(reader["DisplayName"]);
                _person.PersonLanguages = new List<Entities.Persons.PersonLanguages>();
                _person.PersonLanguages.Add(_personLanguages);
                _article.Author = _person;
                #endregion

                _article.CurrentArticleLanguage = _articleLanguageList;
                _articleList.Add(_article);
            } reader.Close();
            return _articleList;
        }
Exemplo n.º 4
0
 public bool Update(ArticleType articletype ,int old_articleTypeID)
 {
     ArticleTypeDAC articletypeComponent = new ArticleTypeDAC();
     return articletypeComponent.UpdateArticleType( articletype.ArticleTypeID,  articletype.Name,  articletype.Code,  old_articleTypeID);
 }
Exemplo n.º 5
0
 public bool Insert(ArticleType articletype)
 {
     ArticleTypeDAC articletypeComponent = new ArticleTypeDAC();
     return articletypeComponent.InsertNewArticleType( articletype.ArticleTypeID,  articletype.Name,  articletype.Code);
 }