//存在相同的广告 public bool ExistSameAdvert(string Num, string Name, AMS.Model.Enum.AdType adType) { try { StringBuilder strWhere = new StringBuilder(); strWhere.Append(" (Num='" + Num + "' or Name='" + Name + "') and [Type]='" + (int)adType + "'"); DataSet ds = dal_advertisementView.GetList(strWhere.ToString()); if (ds.Tables[0].Rows.Count > 0) { return(true); } else { return(false); } } catch (Exception ex) { throw ex; } }
public static bool ExistSameAdvert(string Num, string Name, AMS.Model.Enum.AdType adType) { AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel(); try { return(bllService.ExistSameAdvert(Num, Name, 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(); } } }