コード例 #1
0
        /// <summary>
        /// 更新硬广
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Model.Enum.HandleResult UpdateHardAd(Model.AMS_HardAdModel model)
        {
            IWCFService.IAdvertManageService advertService = WcfAccessProxy.AMS_ServiceProxy.CreateChannelAdvertManageService();
            bool error = false;

            try
            {
                return(advertService.UpdateHardAd(model));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManage.SeatManageComm.WriteLog.Write(string.Format("更新硬广遇到异常,异常模块:{0};信息:{1}", ex.Source, ex.Message));
                throw ex;
            }
            finally
            {
                ICommunicationObject ICommObjectService = advertService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 根据Id获取播放列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public AdvertManage.Model.AMS_HardAdModel GetHardAdById(int id)
        {
            Model.AMS_HardAdModel model    = null;
            StringBuilder         strWhere = new StringBuilder();

            strWhere.Append(" id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int)
            };
            parameters[0].Value = id;
            DataSet ds = hardAdDal.GetList(strWhere.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                model = DataRowToAMS_HardAdModel(ds.Tables[0].Rows[0]);
            }
            return(model);
        }
コード例 #3
0
        public AMS_HardAdModel GetHardAdByNum(string number)
        {
            StringBuilder strWhere = new StringBuilder();

            strWhere.Append(" Number=@Number");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Number", SqlDbType.NVarChar)
            };
            parameters[0].Value = number;
            DataSet ds = hardAdDal.GetList(strWhere.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Model.AMS_HardAdModel model = DataRowToAMS_HardAdModel(ds.Tables[0].Rows[0]);
                return
                    (model);
            }
            return(null);
        }
コード例 #4
0
        public List <AMS_HardAdModel> GetHardAdList()
        {
            try
            {
                StringBuilder strWhere = new StringBuilder();
                List <AdvertManage.Model.AMS_HardAdModel> list = new List <Model.AMS_HardAdModel>();

                DataSet ds = hardAdDal.GetList(null, null);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Model.AMS_HardAdModel model = DataRowToAMS_HardAdModel(ds.Tables[0].Rows[i]);
                    list.Add(model);
                }

                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
 /// <summary>
 /// 获取硬广,并且执行添加到学校数据库操作
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static bool GetHardAd(int id)
 {
     try
     {
         Model.AMS_HardAdModel hardAdModel = BLL.AMS_HardAdBLL.GetHardAdById(id);
         if (hardAdModel != null)
         {
             SeatManage.ClassModel.HardAdvertInfo seathardAdvert = SeatManage.Bll.AMS_HardAd.GetHardAdvertByNum(hardAdModel.Number);
             if (seathardAdvert != null)
             {
                 seathardAdvert.AdvertImage = hardAdModel.AdImage;
                 seathardAdvert.EffectDate  = hardAdModel.EffectDate;
                 seathardAdvert.EndDate     = hardAdModel.EndDate;
                 if (SeatManage.Bll.AMS_HardAd.UpdateHardAdvert(seathardAdvert) == SeatManage.EnumType.HandleResult.Successed)
                 {
                     return(true);
                 }
             }
             else
             {
                 seathardAdvert              = new SeatManage.ClassModel.HardAdvertInfo();
                 seathardAdvert.AdvertImage  = hardAdModel.AdImage;
                 seathardAdvert.EffectDate   = hardAdModel.EffectDate;
                 seathardAdvert.EndDate      = hardAdModel.EndDate;
                 seathardAdvert.HardAdvertNo = hardAdModel.Number;
                 if (SeatManage.Bll.AMS_HardAd.AddHardAd(seathardAdvert) == SeatManage.EnumType.HandleResult.Successed)
                 {
                     return(true);
                 }
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }