/// <summary> /// 获取通知 /// </summary> private void GetAdvert() { try { string path = AppDomain.CurrentDomain.BaseDirectory; SeatManage.Bll.FileOperate fileoperator = new SeatManage.Bll.FileOperate(); List <AMS_Advertisement> advertList = SeatManage.Bll.AdvertisementOperation.GetAdList(false, AdType.None); foreach (AMS_Advertisement advert in advertList) { switch (advert.Type) { case AdType.SchoolNotice: { SchoolNoteInfo model = SchoolNoteInfo.ToModel(advert.AdContent); model.ID = advert.ID; model.InitializeUsage(); if (!Directory.Exists(path + "images\\AdImage\\NoteImage\\")) { Directory.CreateDirectory(path + "images\\AdImage\\NoteImage\\"); } if (fileoperator.FileDownLoad(path + "images\\AdImage\\NoteImage\\" + model.NoteImagePath, model.NoteImagePath, SeatManageSubsystem.SchoolNotice)) { _SchoolNote.Add(model); } else { SeatManage.SeatManageComm.WriteLog.Write(string.Format("校园通知初始化失败:{0}", advert.Num)); } } break; } } } catch (Exception ex) { SeatManage.SeatManageComm.WriteLog.Write(string.Format("校园通知初始化失败:{0}", ex.Message)); } }
/// <summary> /// 获取广告 /// </summary> private void GetAdvert() { try { string path = AppDomain.CurrentDomain.BaseDirectory; SeatManage.Bll.FileOperate fileoperator = new SeatManage.Bll.FileOperate(); List <AMS_Advertisement> advertList = SeatManage.Bll.AdvertisementOperation.GetAdList(false, AdType.None); foreach (AMS_Advertisement advert in advertList) { switch (advert.Type) { case AdType.PopAd: { if (_popAdvert != null) { break; } _popAdvert = PopAdvertInfo.ToModel(advert.AdContent); _popAdvert.ID = advert.ID; _popAdvert.InitializeUsage(); if (!Directory.Exists(path + "images\\AdImage\\PopImage\\")) { Directory.CreateDirectory(path + "images\\AdImage\\PopImage\\"); } if (!fileoperator.FileDownLoad(path + "images\\AdImage\\PopImage\\" + _popAdvert.PopImagePath, _popAdvert.PopImagePath, SeatManageSubsystem.PopAd)) { _popAdvert = null; SeatManage.SeatManageComm.WriteLog.Write(string.Format("弹窗广告初始化失败:{0}", advert.Num)); } } break; case AdType.PromotionAd: { PromotionAdvertInfo model = PromotionAdvertInfo.ToModel(advert.AdContent); model.ID = advert.ID; model.InitializeUsage(); if (!Directory.Exists(path + "images\\AdImage\\PromotionImage\\")) { Directory.CreateDirectory(path + "images\\AdImage\\PromotionImage\\"); } if (fileoperator.FileDownLoad(path + "images\\AdImage\\PromotionImage\\" + model.AdImagePath, model.AdImagePath, SeatManageSubsystem.PromotionAd)) { _promotionAdvert.Add(model); } else { SeatManage.SeatManageComm.WriteLog.Write(string.Format("推广广告初始化失败:{0}", advert.Num)); } } break; case AdType.ReaderAd: { if (_readerAdvert != null) { break; } _readerAdvert = ReaderAdvertInfo.ToModel(advert.AdContent); _readerAdvert.ID = advert.ID; _readerAdvert.InitializeUsage(); if (!Directory.Exists(path + "images\\AdImage\\ReaderImage\\")) { Directory.CreateDirectory(path + "images\\AdImage\\ReaderImage\\"); } if (!fileoperator.FileDownLoad(path + "images\\AdImage\\ReaderImage\\" + _readerAdvert.ReaderAdImagePath, _readerAdvert.ReaderAdImagePath, SeatManageSubsystem.ReaderAd)) { _readerAdvert = null; SeatManage.SeatManageComm.WriteLog.Write(string.Format("读者广告初始化失败:{0}", advert.Num)); } } break; case AdType.SchoolNotice: { SchoolNoteInfo model = SchoolNoteInfo.ToModel(advert.AdContent); model.ID = advert.ID; model.InitializeUsage(); if (!Directory.Exists(path + "images\\AdImage\\NoteImage\\")) { Directory.CreateDirectory(path + "images\\AdImage\\NoteImage\\"); } if (fileoperator.FileDownLoad(path + "images\\AdImage\\NoteImage\\" + model.NoteImagePath, model.NoteImagePath, SeatManageSubsystem.SchoolNotice)) { _schoolNote.Add(model); } else { SeatManage.SeatManageComm.WriteLog.Write(string.Format("推广广告初始化失败:{0}", advert.Num)); } } break; case AdType.TitleAd: { _titleAdvert = TitleAdvertInfoV2.ToModel(advert.AdContent); _titleAdvert.ID = advert.ID; _titleAdvert.InitializeUsage(); } break; } } _userGuide = SeatManage.Bll.T_SM_SystemSet.GetUserGuide(); if (_userGuide != null) { if (!Directory.Exists(path + "images\\AdImage\\UserGuide\\")) { Directory.CreateDirectory(path + "images\\AdImage\\UserGuide\\"); } foreach (string file in _userGuide.ImageFilePath) { if (!fileoperator.FileDownLoad(path + "images\\AdImage\\UserGuide\\" + file, file, SeatManageSubsystem.UserGuide)) { SeatManage.SeatManageComm.WriteLog.Write("使用手册初始化失败"); } } } } catch (Exception ex) { SeatManage.SeatManageComm.WriteLog.Write(string.Format("广告初始化失败:{0}", ex.Message)); } }