Exemple #1
0
 /// <summary>
 /// 添加标签信息
 /// </summary>
 /// <param name="tagNamestr"></param>
 /// <param name="tagType"></param>
 /// <returns></returns>
 public ReturnValue AddTag(string tagNamestr, int tagType)
 {
     string[] tags = tagNamestr.Split(new char[] { ' ', ',', '-', ';' });
     ReturnValue retValue = new ReturnValue();
     using (TagInfoDal dal = new TagInfoDal())
     {
         foreach (string item in tags)
         {
             if (dal.AddTag(item, tagType))
             {
                 retValue.PutValue("ok", retValue.GetInt("ok") + 1);
             }
             else
             {
                 retValue.PutValue("error", retValue.GetInt("error") + 1);
             }
         }
     }
     log.Info(string.Format("Add Tags : ok {0} ,error {1}", retValue.GetInt("ok"), retValue.GetInt("error")));
     return retValue;
 }
Exemple #2
0
        public ReturnValue Delete(string ids)
        {
            ReturnValue retValue = new ReturnValue();

            string[] categoryIdArr = ids.Split(new Char[] { ',' });
            using (CategoryDal dal = new CategoryDal())
            {
                foreach (string item in categoryIdArr)
                {
                    if (dal.Delete(item))
                    {
                        retValue.PutValue("ok", retValue.GetInt("ok"));
                    }
                    else
                    {
                        retValue.PutValue("error", retValue.GetInt("error"));
                    }
                }
            }
            if (retValue.GetInt("error") != 0)
            {
                retValue.IsExists = false;
                retValue.Message = string.Format("删除分类失败,成功{0},失败{1}!", retValue.GetInt("ok"), retValue.GetInt("error"));
            }
            else
            {
                retValue.IsExists = true;
                retValue.Message = "删除分类成功!";
                ClearCache();//清除缓存
            }
            return retValue;
        }