/// <summary> /// 硬广图片二进制流 /// </summary> /// <summary> /// 新增一条硬广 /// </summary> public bool AddNewHardAd() { try { if (_AdImage.UriSource != null && !string.IsNullOrEmpty(_Number) && (_EndDate > _EffectDate)) { AMS_HardAdModel model = new AMS_HardAdModel(); model.Number = _Number; model.EffectDate = _EffectDate; model.EndDate = _EndDate; FileStream fs = new FileStream(_AdImage.UriSource.OriginalString, FileMode.Open, FileAccess.Read); byte[] btye = new byte[fs.Length]; fs.Read(btye, 0, Convert.ToInt32(fs.Length)); fs.Close(); model.AdImage = btye; if (AMS_HardAdBLL.AddHardAd(model) == AdvertManage.Model.Enum.HandleResult.Failed) { throw new Exception("添加硬广失败,详情请查看错误日志!"); } return(true); } else { throw new Exception("信息填写有误,请重新确认!"); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return(false); } }