/// <summary> /// 检测LocationPath /// </summary> private void CheckLocationPath(string locationPath) { if (locationPath.IndexOf(',') != -1) { var arr = locationPath.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); AssertUtil.IsFalse(arr.Length >= 2, LanguageUtil.Translate("api_Business_Dictionary_CheckLocationPath")); } }
public void Test() { var s = "dsfsdfsdf"; var a = s.Substring(s.Length - 1, 1); var c = s.Substring(0, s.Length - 1); //AssertUtil.AreBigger(0, 0, "分类编号不能小于0"); AssertUtil.IsFalse(1 == 1, "分类编号不能小于0"); }
/// <summary> /// 检测板块是否有视频 /// </summary> /// <param name="plate"></param> private void CheckHasVideo(Plate plate) { var vedio = (from pv in this._plateVideoRepository.GetEntityList() join p in this._plateRepository.GetEntityList(CondtionEqualState()) on pv.PlateId equals p.Id join v in this._videoRepository.GetEntityList(CondtionEqualState()) on pv.VideoId equals v.Id where p.Id == plate.Id select v).AsQueryable(); AssertUtil.IsFalse(vedio.Any(), LanguageUtil.Translate("api_Business_Plate_CheckHasVideo_vedio").F(plate.Name, vedio.Count())); }
/// <summary> /// 检测分类下是否存在板块 /// </summary> /// <param name="category"></param> private void CheckHasPlate(Category category) { var plates = (from p in this._plateRepository.GetEntityList(CondtionEqualState()) join c in this._categoryRepository.GetEntityList(CondtionEqualState()) on p.CategoryId equals c.Id where c.LocationPath.StartsWith(category.LocationPath) select p ).AsQueryable(); AssertUtil.IsFalse(plates.Any(), LanguageUtil.Translate("api_Business_Category_CheckHasPlate").F(plates.Count())); }
/// <summary> /// 检测分类下是否存在可用的视频 /// </summary> /// <param name="category"></param> private void CheckHasVedio(Category category) { var vedios = (from video in this._videoRepository.GetEntityList(CondtionEqualState()) join cate in this._categoryRepository.GetEntityList(CondtionEqualState()) on video.CategoryId equals cate.Id where cate.LocationPath.StartsWith(category.LocationPath) && video.VideoState == 3 //TODO 刘强CheckState=1 select video ).AsQueryable(); AssertUtil.IsFalse(vedios.Any(), LanguageUtil.Translate("api_Business_Category_CheckHasVedio").F(vedios.Count())); }