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); } }
public IEnumerable <Player> GetPlayers() { using (var client = new PlayerServiceClient()) { return(client.GetPlayers()); } }
public IHttpActionResult DeletePlayer(int id) { using (var client = new PlayerServiceClient()) { if (client.Delete(id)) { return(Ok("Deleted Successfully")); } return(BadRequest("Cannot be Deleted")); } }
public IHttpActionResult UpdatePlayer(Player player) { using (var client = new PlayerServiceClient()) { if (client.Update(player)) { return(Ok("Updated Successfully")); } return(BadRequest("Cannot be Updated")); } }
public IHttpActionResult InsertPlayer(Player player) { using (var client = new PlayerServiceClient()) { if (client.Insert(player)) { return(Ok("Inserted Successfully")); } return(BadRequest("Cannot be Inserted")); } }
public IHttpActionResult GetPlayer(int id) { using (var client = new PlayerServiceClient()) { if (client.GetPlayer(id) != null) { return(Ok(client.GetPlayer(id))); } return(NotFound()); } }
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); }
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); }
/// <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); } }
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; }
/// <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); }
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; }