Exemplo n.º 1
0
        public List <SystemMessageES> List(int pageSize, int pageIndex, ArticleAccountType articleAccountType, Guid AccountId, bool isZH)
        {
            string GetDefault(string key)
            {
                return(Resources.ResourceManager.GetString(key, new System.Globalization.CultureInfo(isZH ? "zh" : "en")));
            }

            string GetIntro(string input)
            {
                if (string.IsNullOrEmpty(input))
                {
                    return(input);
                }
                var reg  = new Regex(@"<[^<]+>");
                var reg2 = new Regex(@"&[^&]+;");
                var s    = reg.Replace(input, "");

                s = reg2.Replace(s, "");
                s = s.Substring(0, Math.Min(s.Length, 50));
                return(s);
            }

            var list = new ArticleDAC().List(pageSize, pageIndex, articleAccountType, AccountId);

            list.ForEach(a =>
            {
                a.Title = a.Type == SystemMessageESType.Article ? a.Title : GetDefault(VerifyTypeList[int.Parse(a.Attach)]);
                a.Intro = a.Type == SystemMessageESType.Article ? GetIntro(a.Body) : (string.IsNullOrWhiteSpace(a.Body) ? (GetDefault(VerifyDefaultList[int.Parse(a.Attach)])) : a.Body);
                if (a.Type == SystemMessageESType.Verify)
                {
                    switch ((VerifyRecordType)int.Parse(a.Attach))
                    {
                    case VerifyRecordType.UserLv1Verified:
                        if (string.IsNullOrWhiteSpace(a.Body))
                        {
                            a.Body = Resources.ResourceManager.GetString("User_KYC_LV1_DefaultBody");
                        }
                        break;

                    case VerifyRecordType.UserLv1Reject:
                        break;

                    case VerifyRecordType.UserLv2Verified:
                        if (string.IsNullOrWhiteSpace(a.Body))
                        {
                            a.Body = Resources.ResourceManager.GetString("User_KYC_LV2_DefaultBody");
                        }
                        break;

                    case VerifyRecordType.UserLv2Reject:
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
            });

            return(list);
        }
Exemplo n.º 2
0
        public void PushArticle(int id)
        {
            var article = new ArticleDAC().GetById(id);
            var tags    = new List <string>();

            tags.Add(JPUSH_TAG);

            RegPushByTags(FiiiPayPushType.TYPE_ARTICLE, tags, id, article.Title, article.Descdescription, Guid.NewGuid().ToString());

            //var result = agent.Push(new PushPayload
            //{
            //    Audience = new { tag_and = tags.ToArray() },
            //    Platform = "all",
            //    Notification = new Notification
            //    {
            //        Alert = article.Title
            //    },
            //    Message = new Message
            //    {
            //        Content = article.Title,
            //        Extras = PushHelper.GetNewExtras(FiiiPayPushType.TYPE_ARTICLE, id)
            //    },
            //    Options = new Options { IsApnsProduction = IsPushProduction }
            //});
        }
Exemplo n.º 3
0
        public long GetTotalUnreadMessage(Guid merchantAccountId)
        {
            var count = MessagesComponent.GetMessagesCountByStatus(merchantAccountId, UserType.Merchant,
                                                                   MessageStatus.Normal);

            var sysCount = new ArticleDAC().GetUnreadCount(ArticleAccountType.FiiiPos, merchantAccountId);

            return(count + sysCount);
        }
Exemplo n.º 4
0
        public bool Insert(int ArticleId, int SiteSectionId, int CreatorId, int ArticleStatusId, int AuthorId, DateTime PostDate, bool AllowLanguageSpecificTags, Guid RowGuid, DateTime ModifiedDate, int CommentsTypeId, bool EnableModeteration)
        {
            ArticleDAC articleComponent = new ArticleDAC();
            int        id = 0;

            BusinessLogicLayer.Common.ContentEntityLogic.Insert(ref id, "CA", Guid.NewGuid(), DateTime.Now);
            ArticleId = id;
            return(articleComponent.InsertNewArticle(ArticleId, SiteSectionId, CreatorId, ArticleStatusId, AuthorId, PostDate, AllowLanguageSpecificTags, RowGuid, ModifiedDate, CommentsTypeId, EnableModeteration));
        }
Exemplo n.º 5
0
        public void PushArticle(int id)
        {
            var article = new ArticleDAC().GetById(id);

            var tags = new List <string>();

            tags.Add(JPUSH_TAG);

            RegPushByTags(FiiiPayPushType.TYPE_ARTICLE, tags, id, article.Title, article.Descdescription, Guid.NewGuid().ToString());
        }
Exemplo n.º 6
0
        public bool Insert(Article article)
        {
            ArticleDAC articleComponent = new ArticleDAC();
            int        id = 0;

            BusinessLogicLayer.Common.ContentEntityLogic.Insert(ref id, "CA", Guid.NewGuid(), DateTime.Now);
            article.ArticleId      = id;
            article.RowGuid        = Guid.NewGuid();
            article.ModifiedDate   = DateTime.Now;
            article.CommentsTypeId = 1;
            return(articleComponent.InsertNewArticle(article.ArticleId, article.SiteSectionId, article.CreatorId, article.ArticleStatusId, article.AuthorId, article.PostDate, article.AllowLanguageSpecificTags, article.RowGuid, article.ModifiedDate, article.CommentsTypeId, article.EnableModeteration));
        }
Exemplo n.º 7
0
        public GetFirstTitleAndNotReadCountOM GetFirstTitleAndNotReadCount(ArticleAccountType articleAccountType, Guid AccountId, bool isZH)
        {
            var tuple = new ArticleDAC().GetFirstTitleAndNotReadCount(articleAccountType, AccountId);

            var model = tuple.Item1;

            return(new GetFirstTitleAndNotReadCountOM
            {
                SysCount = tuple.Item2,
                Title = model == null ? null : model.Type == SystemMessageESType.Article ? model.Title : Resources.ResourceManager.GetString(VerifyTypeList[int.Parse(model.Attach)], new System.Globalization.CultureInfo(isZH ? "zh" : "en")),
                Timestamp = model?.CreateTime.ToUnixTime().ToString(),
                Count = MessagesComponent.GetMessagesCountByStatus(AccountId, UserType.User, MessageStatus.Normal)
            });
        }
Exemplo n.º 8
0
        public void OnekeyRead(Guid AccountId)
        {
            var list = new ArticleDAC().AllList(ArticleAccountType.FiiiPay, AccountId);

            list.ForEach(data =>
            {
                var model = new ReadRecord
                {
                    AccountId = AccountId,
                    TargetId  = data.Id,
                    Type      = (ReadRecordType)(int)data.Type
                };
                new ReadRecordDAC().Insert(model);
            });
        }
Exemplo n.º 9
0
        public string GetNews(int id)
        {
            var model = new ArticleDAC().GetById(id);

            if (model == null)
            {
                return(null);
            }

            var template = Resources.NewsTemplate;

            template = template.Replace("[Title]", model.Title);
            template = template.Replace("[PublishTime]", model.CreateTime.ToUnixTime().ToString());
            template = template.Replace("[Content]", model.Body);

            return(template);
        }
Exemplo n.º 10
0
        public List <Article> GetAllBySiteId(string SiteId)
        {
            ArticleDAC _articleComponent = new ArticleDAC();
            string     whereCondition    = "";

            if (!string.IsNullOrEmpty(SiteId) && SiteId != "0")
            {
                whereCondition = "SiteId = " + SiteId;
            }
            IDataReader    reader       = _articleComponent.GetAllArticle(whereCondition).CreateDataReader();
            List <Article> _articleList = new List <Article>();

            while (reader.Read())
            {
                if (_articleList == null)
                {
                    _articleList = new List <Article>();
                }
                Article _article = new Article();
                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"]);
                }
                _article.NewRecord = false;
                _articleList.Add(_article);
            }
            reader.Close();
            return(_articleList);
        }
Exemplo n.º 11
0
        public int UpdateDataset(System.Data.DataSet dataset)
        {
            ArticleDAC articlecomponent = new ArticleDAC();

            return(articlecomponent.UpdateDataset(dataset));
        }
Exemplo n.º 12
0
        public Article GetByID(int _articleId)
        {
            ArticleDAC  _articleComponent = new ArticleDAC();
            IDataReader reader            = _articleComponent.GetByIDArticle(_articleId);
            Article     _article          = null;

            while (reader.Read())
            {
                _article = new Article();
                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"]);
                }
                _article.NewRecord = false;
            }
            reader.Close();
            return(_article);
        }
Exemplo n.º 13
0
        public void Delete(int Original_ArticleId)
        {
            ArticleDAC articleComponent = new ArticleDAC();

            articleComponent.DeleteArticle(Original_ArticleId);
        }
Exemplo n.º 14
0
        public bool Update(int ArticleId, int SiteSectionId, int CreatorId, int ArticleStatusId, int AuthorId, DateTime PostDate, bool AllowLanguageSpecificTags, Guid RowGuid, DateTime ModifiedDate, int CommentsTypeId, bool EnableModeteration, int Original_ArticleId)
        {
            ArticleDAC articleComponent = new ArticleDAC();

            return(articleComponent.UpdateArticle(ArticleId, SiteSectionId, CreatorId, ArticleStatusId, AuthorId, PostDate, AllowLanguageSpecificTags, RowGuid, ModifiedDate, CommentsTypeId, EnableModeteration, Original_ArticleId));
        }
Exemplo n.º 15
0
        public bool Update(Article article, int old_articleId)
        {
            ArticleDAC articleComponent = new ArticleDAC();

            return(articleComponent.UpdateArticle(article.ArticleId, article.SiteSectionId, article.CreatorId, article.ArticleStatusId, article.AuthorId, article.PostDate, article.AllowLanguageSpecificTags, article.RowGuid, article.ModifiedDate, article.CommentsTypeId, article.EnableModeteration, old_articleId));
        }