예제 #1
0
        /// <summary>
        /// 根据学校编号获取设备列表
        /// </summary>
        /// <param name="schoolNum"></param>
        /// <param name="flag">表示是否获取更新的</param>
        /// <returns></returns>
        public static List <AdvertManage.Model.AMS_DeviceModel> GeDeviceModelBySchoolNum(string schoolNum, bool flag)
        {
            IWCFService.IAdvertManageService advertService = WcfAccessProxy.AMS_ServiceProxy.CreateChannelAdvertManageService();
            bool error = false;

            try
            {
                return(advertService.GeDeviceModelBySchoolNum(schoolNum, flag));
            }
            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();
                }
            }
        }