/// <summary>
 /// 获取广告列表
 /// </summary>
 /// <param name="adType"></param>
 /// <returns></returns>
 public List <Model.AMS_Advertisement> GetAdvertList(Model.Enum.AdType adType)
 {
     try
     {
         List <Model.AMS_Advertisement> modelList = new List <Model.AMS_Advertisement>();
         StringBuilder strWhere = new StringBuilder();
         strWhere.Append(" [Type]='" + (int)adType + "'");
         DataSet ds = dal_advertisementView.GetList(strWhere.ToString());
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             modelList.Add(DataRowToAMS_Advertisement(ds.Tables[0].Rows[i]));
         }
         return(modelList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <summary>
 /// 获取广告
 /// </summary>
 /// <returns></returns>
 public static List <Model.AMS_Advertisement> GetAdvertList(Model.Enum.AdType adType)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.GetAdvertList(adType));
     }
     catch (EndpointNotFoundException ex)
     {
         throw new AMS.Model.CustomerException("连接服务器失败");
     }
     catch (CommunicationException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         ICommunicationObject ICommObjectService = bllService as ICommunicationObject;
         try
         {
             if (ICommObjectService.State == CommunicationState.Faulted)
             {
                 ICommObjectService.Abort();
             }
             else
             {
                 ICommObjectService.Close();
             }
         }
         catch
         {
             ICommObjectService.Abort();
         }
     }
 }
 public Model.AMS_AdvertisementSchoolCopy GetSchholAdvertByNum(string AdNum, string schoolNum, Model.Enum.AdType adType)
 {
     try
     {
         Model.AMS_AdvertisementSchoolCopy model = new Model.AMS_AdvertisementSchoolCopy();
         StringBuilder strWhere = new StringBuilder();
         strWhere.Append(" Number='" + schoolNum + "' and Num='" + AdNum + "' and [Type]='" + (int)adType + "'");
         DataSet ds = dal_advertisementcopyView.GetList(strWhere.ToString());
         if (ds.Tables[0].Rows.Count > 0)
         {
             return(DataRowToAMS_AdvertisementCopy(ds.Tables[0].Rows[0]));
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }