Exemplo n.º 1
0
 /// <summary>
 /// 批量插入过滤词
 /// </summary>
 /// <param name="wordlist">过滤词集合</param>
 /// <param name="wt">过滤词类型</param>
 public void AddWordList(List<string> wordlist, CBB.CheckHelper.FilterWord.word_type wt)
 {
     List<FilterWordMoldel> list = new List<FilterWordMoldel>();
     foreach(string tempword in wordlist)
     {
         FilterWordMoldel fwm = new FilterWordMoldel();
         fwm.Is_enable = true;
         fwm.Type = Convert.ToInt32(wt);
         fwm.Word = tempword;
         list.Add(fwm);
     }
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<FilterWordMoldel> mc = md.GetCollection<FilterWordMoldel>("FilterWord");
         mc.InsertBatch(typeof(FilterWordMoldel), list);
     }
     catch (Exception es)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            es);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 按类型过滤关键字
        /// </summary>
        /// <param name="text">原始文本</param>
        /// <param name="wt">过滤类型枚举</param>
        /// <returns>被过滤的关键字集合</returns>
        public List<string> FilterText(ref string text, CBB.CheckHelper.FilterWord.word_type wt)
        {
            GetNewFilterWordController();

            _temp_del.SearchWord(ref text, CBB.CheckHelper.FilterWord.word_type.delete);

            if (wt == CBB.CheckHelper.FilterWord.word_type.delete)
            {
                return _fw_delete.SearchWord(ref text, wt);
            }
            else if (wt == CBB.CheckHelper.FilterWord.word_type.shift)
            {
                return _fw_shift.SearchWord(ref text, wt);
            }
            else {
                return _fw_trial.SearchWord(ref text, wt);
            }
        }
Exemplo n.º 3
0
        private CBB.ImageHelper.ImageSizeType[] SetImageSize(int artworkWidth, int artworkHeight, CBB.ImageHelper.ImageWaterMark wm)
        {
            CBB.ImageHelper.ImageSizeType[] imagetypes = null;

            imagetypes = new CBB.ImageHelper.ImageSizeType[]{
                    new CBB.ImageHelper.ImageSizeType(artworkWidth, artworkHeight, false,false, "", CBB.ImageHelper.ImageMakeMode.WButOnlyShrink, wm),
                    new CBB.ImageHelper.ImageSizeType(200,200,false,false,"_s", CBB.ImageHelper.ImageMakeMode.W,null),
                    new CBB.ImageHelper.ImageSizeType(150,150,false,false,"_p", CBB.ImageHelper.ImageMakeMode.Cut,null),
                    new CBB.ImageHelper.ImageSizeType(50,50,false,false,"_i", CBB.ImageHelper.ImageMakeMode.Cut,null)
                };

            return imagetypes;
        }
Exemplo n.º 4
0
 /// <summary>
 /// 查询指定类型的过滤词模型
 /// </summary>
 /// <param name="wt">过滤词类型枚举</param>
 /// <returns>过滤词模型集合</returns>
 public List<FilterWordMoldel> GetFilterWordModels(CBB.CheckHelper.FilterWord.word_type wt)
 {
     List<FilterWordMoldel> list = new List<FilterWordMoldel>();
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<FilterWordMoldel> mc = md.GetCollection<FilterWordMoldel>("FilterWord");
         IMongoQuery qc = Query.And(Query.EQ("Type", Convert.ToInt32(wt)));
         MongoCursor<FilterWordMoldel> mcr = mc.Find(qc);
         list.AddRange(mcr);
         return list;
     }
     catch (Exception es)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            es);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 查询指定类型的过滤词
 /// </summary>
 /// <param name="wt">过滤词类型枚举</param>
 /// <returns>过滤词集合</returns>
 public List<string> GetWord(CBB.CheckHelper.FilterWord.word_type wt)
 {
     List<FilterWordMoldel> list = new List<FilterWordMoldel>();
     List<string> wordlist = null;
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<FilterWordMoldel> mc = md.GetCollection<FilterWordMoldel>("FilterWord");
         IMongoQuery qc = Query.And(Query.EQ("Type", Convert.ToInt32(wt)));
         MongoCursor<FilterWordMoldel> mcr =  mc.Find(qc);
         list.AddRange(mcr);
         if (null != list)
         {
             wordlist = new List<string>();
             foreach (FilterWordMoldel fwm in list)
             {
                 wordlist.Add(fwm.Word.Trim());
             }
         }
         return wordlist;
     }
     catch (Exception es)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            es);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 依据类型删除过滤词
 /// </summary>
 /// <param name="wt">过滤词类型枚举值</param>
 public void DeleteWord(CBB.CheckHelper.FilterWord.word_type wt)
 {
     try
     {
         MongoDatabase md = MongoDBHelper.MongoDB;
         MongoCollection<FilterWordMoldel> mc = md.GetCollection<FilterWordMoldel>("FilterWord");
         IMongoQuery qc = Query.And(Query.EQ("Type", Convert.ToInt32(wt)));
         mc.Remove(qc);
     }
     catch (Exception es)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            es);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 检测关键字
 /// </summary>
 /// <param name="text">原始文本</param>
 /// <param name="wt">检测类型</param>
 /// <returns></returns>
 public static List<string> CheckFilterWord(ref string text,CBB.CheckHelper.FilterWord.word_type wt)
 {
     Moooyo.BiZ.FilterWord.FilterWordController.GetNewFilterWordController();
     return new Moooyo.BiZ.FilterWord.FilterWordController().FilterText(ref text, wt);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 批量插入
 /// </summary>
 /// <param name="_id">过滤词集合</param>
 /// <param name="wt">类型枚举</param>
 /// <returns></returns>
 public static CBB.ExceptionHelper.OperationResult UploadFilterWords(List<string> _id, CBB.CheckHelper.FilterWord.word_type wt)
 {
     try
     {
         Moooyo.BiZ.FilterWord.FilterWordOperation fwo = new BiZ.FilterWord.FilterWordOperation();
         fwo.AddWordList(_id, wt);
         return new CBB.ExceptionHelper.OperationResult(true);
     }
     catch (Exception ex)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            ex);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 按类型查询
 /// </summary>
 /// <param name="wt"></param>
 /// <returns></returns>
 public static List<Moooyo.BiZ.FilterWord.FilterWordMoldel> GetAllSystemFilterWord(CBB.CheckHelper.FilterWord.word_type wt)
 {
     try
     {
         Moooyo.BiZ.FilterWord.FilterWordOperation fwo = new BiZ.FilterWord.FilterWordOperation();
         return fwo.GetFilterWordModels(wt);
     }
     catch (Exception ex)
     {
         throw new CBB.ExceptionHelper.OperationException(
            CBB.ExceptionHelper.ErrType.SystemErr,
            CBB.ExceptionHelper.ErrNo.DBOperationError,
            ex);
     }
 }
Exemplo n.º 10
0
        public static CBB.ExceptionHelper.OperationResult BuildRankingTable(CBB.RankingHelper.IRankingAble ira, int year, int month, int dayofyear, int weekofyear)
        {
            try
            {
                //生成每日排名
                CBB.RankingHelper.RankingProvider.BuildDailyRankingTable(ira.GetDailyRankResultTableName(),
                    ira.GetDailyRankingTableName(), year, dayofyear);
                //生成每周排名
                CBB.RankingHelper.RankingProvider.BuildWeeklyRankingTable(ira.GetWeeklyRankResultTableName(),
                    ira.GetWeeklyRankingTableName(), year, weekofyear);
                //生成每月排名
                CBB.RankingHelper.RankingProvider.BuildMonthRankingTable(ira.GetPerMonthRankResultTableName(),
                    ira.GetPerMonthRankingTableName(), year, dayofyear);
                //生成每年排名
                CBB.RankingHelper.RankingProvider.BuildYearRankingTable(ira.GetEachYearRankResultTableName(),
                    ira.GetEachYearRankingTableName(), year);

                return new ExceptionHelper.OperationResult(true);
            }
            catch (System.Exception err)
            {
                throw new CBB.ExceptionHelper.OperationException(
                    CBB.ExceptionHelper.ErrType.SystemErr,
                    CBB.ExceptionHelper.ErrNo.DBOperationError,
                    err);
            }
        }