/// <summary>
        /// 添加命令
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Model.Enum.HandleResult AddAMS_CommandList(Model.AMS_CommandList model)
        {
            AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
            bool error = false;

            try
            {
                return(bllService.AddAMS_CommandList(model));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManage.SeatManageComm.WriteLog.Write(string.Format("根据学校编号获取设备列表遇到错误,异常来自:{0};信息:{1}", ex.Source, ex.Message));
                throw ex;
            }
            finally
            {
                ICommunicationObject ICommObjectService = bllService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
        /// <summary>
        /// 根据设备id查找设备
        /// </summary>
        /// <param name="No"></param>
        /// <returns></returns>
        public static Model.AMS_Device GetDevicebyID(int id)
        {
            AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
            bool error = false;

            try
            {
                return(bllService.GetDevicebyID(id));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManage.SeatManageComm.WriteLog.Write(string.Format("根据id查看设备信息遇到错误,异常来自:{0};信息:{1}", ex.Source, ex.Message));
                throw ex;
            }
            finally
            {
                ICommunicationObject ICommObjectService = bllService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 添加优惠券打印次数
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static AMS.Model.Enum.HandleResult AddSlipPrintInfo(List <Model.View_SlipPrintInfo> modelList)
        {
            AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
            bool error = false;

            try
            {
                return(bllService.AddSlipPrintInfo(modelList));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManage.SeatManageComm.WriteLog.Write(string.Format("添加优惠券打印次数遇到异常,异常模块:{0};信息:{1}", ex.Source, ex.Message));
                throw ex;
            }
            finally
            {
                ICommunicationObject ICommObjectService = bllService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
        /// <summary>
        /// 更新设备状态
        /// </summary>
        /// <param name="deviceNo"></param>
        /// <param name="stateUpdateTime"></param>
        /// <returns></returns>
        public static Model.Enum.HandleResult UpdateDeviceStatus(string deviceNo, DateTime stateUpdateTime)
        {
            AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
            bool error = false;

            try
            {
                return(bllService.UpdateDeviceStatus(deviceNo, stateUpdateTime));
            }
            catch (Exception ex)
            {
                error = true;
                SeatManage.SeatManageComm.WriteLog.Write(string.Format("更新设备状态遇到错误,异常来自:{0};信息:{1}", ex.Source, ex.Message));
                throw ex;
            }
            finally
            {
                ICommunicationObject ICommObjectService = bllService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
        /// <summary>
        /// 根据学校编号获取设备列表
        /// </summary>
        /// <param name="schoolNum"></param>
        /// <param name="flag">表示是否获取更新的</param>
        /// <returns></returns>
        public static List <Model.AMS_Device> GeDeviceModelBySchoolNum(string schoolNum, bool flag)
        {
            AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
            bool error = false;

            try
            {
                return(bllService.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 = bllService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
 public static AMS.Model.Enum.HandleResult AddNewSlipCustomerList(List <AMS.Model.AMS_SlipCustomer> model)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         foreach (AMS.Model.AMS_SlipCustomer item in model)//
         {
             if (bllService.AddNewSlipCustomer(item) != "")
             {
                 return(AMS.Model.Enum.HandleResult.Failed);
             }
         }
         return(AMS.Model.Enum.HandleResult.Successed);
     }
     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();
         }
     }
 }
예제 #7
0
        /// <summary>
        /// 用户登录操作,登录成功,返回用户Model
        /// 验证错误返回null。
        /// 有异常直接throw到上层。
        /// </summary>
        /// <param name="loginName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static AMS.Model.AMS_UserInfo Login(string loginName, string password)
        {
            //return new Model.AMS_UserInfo() { ID = 1, UserName = "******", UserPwd = "skdfjalkdsjalkjf", LoginId = "user" };

            //登录方法代理
            AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
            try
            {
                return(bllService.Login(loginName, password));
            }
            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 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();
         }
     }
 }
 /// <summary>
 /// 删除广告副本
 /// </summary>
 /// <returns></returns>
 public static bool DeleteAdvertisementCopy(Model.AMS_AdvertisementSchoolCopy model)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.DeleteAdvertisementCopy(model));
     }
     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();
         }
     }
 }
 /// <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();
         }
     }
 }
 /// <summary>
 /// 根据类型获取对应的程序信息
 /// </summary>
 /// <param name="programType"></param>
 /// <returns></returns>
 public static AMS.Model.ProgramUpgrade GetProgramInfoByProgramType(Model.Enum.SeatManageSubsystem programType)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.GetProgramInfoByProgramType(programType));
     }
     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();
         }
     }
 }
 /// <summary>
 /// 根据学号和学校编号获取用户信息
 /// </summary>
 /// <param name="cardNo"></param>
 /// <param name="schoolNum"></param>
 /// <returns></returns>
 public static AppUserInfo GetAppUserInfoByCardNoAndSchoolNum(string cardNo, string schoolNum)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.GetAppUserInfoByCardNoAndSchoolNum(cardNo, schoolNum));
     }
     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();
         }
     }
 }
예제 #13
0
 /// <summary>
 /// 添加新的打印模板
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static string AddNewPrintTemplate(AMS.Model.AMS_PrintTemplate model)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.AddNewPrintTemplate(model));
     }
     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();
         }
     }
 }
 /// <summary>
 /// 获取学校信息(是否显示校区)
 /// </summary>
 /// <param name="isShowCampus"></param>
 public static List <AMS.Model.AMS_ProvinceSchoolInfo> GetProvinceSchoolInfo()
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.GetSchoolList());
     }
     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();
         }
     }
 }
 /// <summary>
 /// 获取最后的日期
 /// </summary>
 /// <param name="SchoolNum"></param>
 /// <returns></returns>
 public static DateTime LastSeatUsageUploadDate(string SchoolNum)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.LastSeatUsageUploadDate(SchoolNum));
     }
     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();
         }
     }
 }
 /// <summary>
 /// 下发文件
 /// </summary>
 /// <returns></returns>
 public static int IssuedSlipCommand(Model.SlipReleaseCampus model)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.AddNewCampusCommandList(model));
     }
     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();
         }
     }
 }
 /// <summary>
 /// 根据条件获取下发记录信息
 /// </summary>
 /// <returns></returns>
 public static List <AMS.Model.AMS_CommandDetail> GetCommandListByCondition(string schoolId, int issuedType, int issuedHandleResult)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.GetCommandDetailList(schoolId, (AMS.Model.Enum.CommandType)issuedType, (Model.Enum.CommandHandleResult)issuedHandleResult));
     }
     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();
         }
     }
 }
예제 #18
0
 /// <summary>
 /// 下发命令
 /// </summary>
 /// <returns></returns>
 public static bool AddCommand(Model.AMS_IssureList command, List <int> schoolIDList)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.AddCommand(command, schoolIDList));
     }
     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();
         }
     }
 }
예제 #19
0
 /// <summary>
 /// 获取命令
 /// </summary>
 /// <returns></returns>
 public static List <Model.AMS_IssureList> GetCommandState(Model.Enum.IsureCommandType command, int schoolID, Model.Enum.CommandHandleResult state)
 {
     AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
     try
     {
         return(bllService.GetCommandState(command, schoolID, state));
     }
     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();
         }
     }
 }
        /// <summary>
        /// 获取学校信息的操作。
        /// </summary>
        /// <returns></returns>
        public static List <AMS.Model.AMS_ProvinceSchoolInfo> GetSchoolList()
        {
            AMS.IBllService.IAdvertManageBllService bllService = AMS.ServiceConnectChannel.AdvertManageBllServiceChannel.CreateServiceChannel();
            try
            {
                return(bllService.GetSchoolList());
            }
            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();
                }
            }

            //AMS.Model.AMS_Device device1 = new Model.AMS_Device() { Id = 1, Number = "20203301", Flag = true };
            //AMS.Model.AMS_Device device2 = new Model.AMS_Device() { Id = 2, Number = "20203302", Flag = true };
            //AMS.Model.AMS_Device device3 = new Model.AMS_Device() { Id = 3, Number = "20203303", Flag = true };
            //AMS.Model.AMS_Device device4 = new Model.AMS_Device() { Id = 4, Number = "20203304", Flag = true };
            //AMS.Model.AMS_Campus campus1 = new Model.AMS_Campus() { Id = 1, Number = "202033", Name = "厦门校区", Address = "厦门市思明区普陀山旁边" };
            //campus1.Device.Add(device1);
            //campus1.Device.Add(device2);
            //AMS.Model.AMS_Campus campus2 = new Model.AMS_Campus() { Id = 2, Number = "202034", Name = "泉州校区", Address = "泉州市未名区" };
            //campus2.Device.Add(device3);
            //AMS.Model.AMS_Campus campus3 = new Model.AMS_Campus() { Id = 3, Number = "202033", Name = "丁家桥" };

            //AMS.Model.AMS_School school = new Model.AMS_School() { Id = 1, Number = "202001", Name = "厦门大学" };
            //school.Campus.Add(campus1);
            //school.Campus.Add(campus2);
            //AMS.Model.AMS_School school2 = new Model.AMS_School() { Id = 2, Number = "202001", Name = "东南大学" };

            //List<Model.AMS_School> list = new List<Model.AMS_School>();
            //List<AMS.Model.AMS_ProvinceSchoolInfo> provinceSchools = new List<Model.AMS_ProvinceSchoolInfo>();
            //AMS.Model.AMS_ProvinceSchoolInfo provinceSchool = new Model.AMS_ProvinceSchoolInfo() { ProvinceName = "福建省", ID = 1 };
            //list.Add(school);
            //list.Add(school2);
            //provinceSchool.Schools = list;
            //provinceSchools.Add(provinceSchool);
            //return provinceSchools;
        }