Exemplo n.º 1
0
        protected void RemoveGuestButtonClick(
            object sender,
            EventArgs e)
        {
            var gatewayUrl = GetIFrameGatewayUrl((sender as HtmlInputButton).Attributes["data-fid"]);

            if (!string.IsNullOrEmpty(gatewayUrl))
            {
                var connectionId = GetIFrameConnectionId((sender as HtmlInputButton).Attributes["data-fid"]);
                if (connectionId != Guid.Empty)
                {
                    if (!string.IsNullOrEmpty(_guestId.Value))
                    {
                        var guestId = Guid.Empty;
                        if (Guid.TryParse(_guestId.Value, out guestId))
                        {
                            var script        = string.Empty;
                            var sharingClient = new SharingClient(string.Format("{0}/api/Sharing/", gatewayUrl));
                            if (!sharingClient.RemoveGuest(guestId))
                            {
                                script = "alert('guest not found or failed to remove guest');";
                            }
                            else
                            {
                                script = string.Format("alert('removed guest: {0}');", guestId);
                            }
                            ClientScript.RegisterClientScriptBlock(GetType(), Guid.NewGuid().ToString(), script, true);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected void RemoveGuestButtonClick(
     object sender,
     EventArgs e)
 {
     if (!string.IsNullOrEmpty(_guestId.Value))
     {
         var guestId = Guid.Empty;
         if (Guid.TryParse(_guestId.Value, out guestId))
         {
             var script = string.Empty;
             if (!sharingClient.RemoveGuest(guestId))
             {
                 script = "alert('guest not found or failed to remove guest');";
             }
             else
             {
                 script = string.Format("alert('removed guest: {0}');", guestId);
             }
             ClientScript.RegisterClientScriptBlock(GetType(), Guid.NewGuid().ToString(), script, true);
         }
     }
 }