protected void gvShareKeys_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }
            ShareKey sk = ShareKey.ShareKeyWithID(e.Keys[0].ToString());

            if (sk == null)
            {
                throw new InvalidOperationException("Unknown key: " + e.Keys[0].ToString());
            }
            sk.Name                   = (string)e.NewValues["Name"] ?? String.Empty;
            sk.CanViewCurrency        = (bool)e.NewValues["CanViewCurrency"];
            sk.CanViewTotals          = (bool)e.NewValues["CanViewTotals"];
            sk.CanViewFlights         = (bool)e.NewValues["CanViewFlights"];
            sk.CanViewAchievements    = (bool)e.NewValues["CanViewAchievements"];
            sk.CanViewVisitedAirports = (bool)e.NewValues["CanViewVisitedAirports"];
            if (sk.FCommit())
            {
                gvShareKeys.EditIndex = -1;
                RefreshSharekeys();
            }
            else
            {
                e.Cancel = true;
            }
        }
        protected void btnCreateShareLink_Click(object sender, EventArgs e)
        {
            ShareKey sk = new ShareKey(Page.User.Identity.Name)
            {
                Name                   = txtShareLinkName.Text,
                CanViewCurrency        = ckShareLinkCurrency.Checked,
                CanViewFlights         = ckShareLinkFlights.Checked,
                CanViewTotals          = ckShareLinkTotals.Checked,
                CanViewAchievements    = ckShareLinkAchievements.Checked,
                CanViewVisitedAirports = ckShareLinkAirports.Checked
            };

            try
            {
                sk.FCommit();
                txtShareLinkName.Text       = string.Empty;
                ckShareLinkCurrency.Checked = ckShareLinkFlights.Checked = ckShareLinkTotals.Checked = ckShareLinkAchievements.Checked = ckShareLinkAirports.Checked = true;
                gvShareKeys.EditIndex       = -1;
                RefreshSharekeys();
            }
            catch (MyFlightbookValidationException ex)
            {
                lblShareKeyErr.Text = ex.Message;
            }
        }