protected void Page_Load(object sender, EventArgs e)
        {
            string sportID = Request.QueryString["SportID"];
            //Delete Teams
            //Delete Team Image First
            //Delete Team Players
            //Delete Record in Sport League BT

            //Delete Team players
            PlayerServiceClient playerClient = new PlayerServiceClient();
            string dl_Player = playerClient.Dl_PlayersBySportID(sportID);

            //Delete Team Image
            FileClient flClient = new FileClient();
            string     dl_Image = flClient.deleteTeamImageBySportID(sportID);

            //Delete from  SportLeague Bridging table
            LeagueClient lgClient         = new LeagueClient();
            string       dl_BridgingTable = lgClient.dl_SprotLeague_BTByID(sportID);

            //Now delete the team
            int LoggedID               = Convert.ToInt32(Session["ID"]);
            TeamServiceClient tsc      = new TeamServiceClient();
            string            dl_Sport = tsc.DeleteTeamByID(sportID);

            if (dl_Sport.Contains("success"))
            {
                Response.Redirect("TeamManagement.aspx?UserID=" + LoggedID);
            }
        }
Beispiel #2
0
 public IEnumerable <Player> GetPlayers()
 {
     using (var client = new PlayerServiceClient())
     {
         return(client.GetPlayers());
     }
 }
Beispiel #3
0
 public IHttpActionResult DeletePlayer(int id)
 {
     using (var client = new PlayerServiceClient())
     {
         if (client.Delete(id))
         {
             return(Ok("Deleted Successfully"));
         }
         return(BadRequest("Cannot be Deleted"));
     }
 }
Beispiel #4
0
 public IHttpActionResult UpdatePlayer(Player player)
 {
     using (var client = new PlayerServiceClient())
     {
         if (client.Update(player))
         {
             return(Ok("Updated Successfully"));
         }
         return(BadRequest("Cannot be Updated"));
     }
 }
Beispiel #5
0
 public IHttpActionResult InsertPlayer(Player player)
 {
     using (var client = new PlayerServiceClient())
     {
         if (client.Insert(player))
         {
             return(Ok("Inserted Successfully"));
         }
         return(BadRequest("Cannot be Inserted"));
     }
 }
Beispiel #6
0
 public IHttpActionResult GetPlayer(int id)
 {
     using (var client = new PlayerServiceClient())
     {
         if (client.GetPlayer(id) != null)
         {
             return(Ok(client.GetPlayer(id)));
         }
         return(NotFound());
     }
 }
Beispiel #7
0
 public App()
 {
     SERVICE_ADDRESS = System.Windows.Browser.HtmlPage.Document.DocumentUri;
     serviceAddress = "http://" + SERVICE_ADDRESS.Host + ":" + SERVICE_ADDRESS.Port + "/Wist/PlayerService.svc";
     add = new EndpointAddress(serviceAddress);
     this.Startup += this.Application_Startup;
     this.Exit += this.Application_Exit;
     this.UnhandledException += this.Application_UnhandledException;
     InitializeComponent();
     client = new PlayerServiceClient(binding, add);
 }
Beispiel #8
0
        public static PlayerServiceClient GetPlayerServiceClient()
        {
            if (_playerServiceClient != null && _playerServiceClient.State == CommunicationState.Faulted)
            {
                RecreateAllChannels();
            }

            if (_playerServiceClient == null)
            {
                _playerServiceClient = new PlayerServiceClient(_defaultBinding, new EndpointAddress(Host + "Player"));
            }
            return(_playerServiceClient);
        }
Beispiel #9
0
        /// <summary>
        /// Убивает все коммуникационные объекты и создает новые.
        /// </summary>
        public static void RecreateAllChannels()
        {
            KillChannel(_searchServiceClient);
            KillChannel(_playlistServiceClient);
            KillChannel(_playerServiceClient);
            KillChannel(_userServiceClient);

            _searchServiceClient   = null;
            _playlistServiceClient = null;
            _playerServiceClient   = null;
            _userServiceClient     = null;

            if (ChannelsWereChanged != null)
            {
                ChannelsWereChanged(null, null);
            }
        }
Beispiel #10
0
		public static void Open(string host) {
			CustomBinding binding = new CustomBinding(
				new BinaryMessageEncodingBindingElement(),
				new TcpTransportBindingElement());

			SearchService = new SearchServiceClient(binding, new EndpointAddress(host + "Search"));
			PlaylistService = new PlaylistServiceClient(binding, new EndpointAddress(host + "Playlist"));
			PlayerService = new PlayerServiceClient(binding, new EndpointAddress(host + "Player"));

            pOpenedServices = 0;

			SearchService.OpenCompleted += OnServiceOpenCompleted;
			PlaylistService.OpenCompleted += OnServiceOpenCompleted;
			PlayerService.OpenCompleted += OnServiceOpenCompleted;

			SearchService.OpenAsync();
			PlaylistService.OpenAsync();
			PlayerService.OpenAsync();
		}
Beispiel #11
0
        public static void Open(string host)
        {
            CustomBinding binding = new CustomBinding(
                new BinaryMessageEncodingBindingElement(),
                new TcpTransportBindingElement());

            SearchService   = new SearchServiceClient(binding, new EndpointAddress(host + "Search"));
            PlaylistService = new PlaylistServiceClient(binding, new EndpointAddress(host + "Playlist"));
            PlayerService   = new PlayerServiceClient(binding, new EndpointAddress(host + "Player"));

            pOpenedServices = 0;

            SearchService.OpenCompleted   += OnServiceOpenCompleted;
            PlaylistService.OpenCompleted += OnServiceOpenCompleted;
            PlayerService.OpenCompleted   += OnServiceOpenCompleted;

            SearchService.OpenAsync();
            PlaylistService.OpenAsync();
            PlayerService.OpenAsync();
        }
 public PlayerServiceClientLiveTests()
 {
     _serviceUnderTest = TestServiceProvider.GetService(typeof(IPlayerServiceClient)) as PlayerServiceClient;
 }
Beispiel #13
0
        /// <summary>
        /// Убивает все коммуникационные объекты и создает новые.
        /// </summary>
        public static void RecreateAllChannels()
        {
            KillChannel(_searchServiceClient);
            KillChannel(_playlistServiceClient);
            KillChannel(_playerServiceClient);
            KillChannel(_userServiceClient);

            _searchServiceClient = null;
            _playlistServiceClient = null;
            _playerServiceClient = null;
            _userServiceClient = null;

            if (ChannelsWereChanged != null)
                ChannelsWereChanged(null, null);
        }
Beispiel #14
0
        public static PlayerServiceClient GetPlayerServiceClient()
        {
            if (_playerServiceClient != null && _playerServiceClient.State == CommunicationState.Faulted)
            {
                RecreateAllChannels();
            }

            if (_playerServiceClient == null)
                _playerServiceClient = new PlayerServiceClient(_defaultBinding, new EndpointAddress(Host + "Player"));
            return _playerServiceClient;
        }