Exemplo n.º 1
0
        internal ErrorModel DeleteAccount(string id)
        {
            ErrorModel errorModel = new ErrorModel();

            //Demo purposes only.  The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call.
            SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate,
                                                                      AggCatAppSettings.ConsumerKey,
                                                                      AggCatAppSettings.ConsumerSecret,
                                                                      AggCatAppSettings.SamlIdentityProviderId,
                                                                      AggCatAppSettings.CustomerId);
            ServiceContext ctx = new ServiceContext(validator);
            AggregationCategorizationService svc = new AggregationCategorizationService(ctx);

            try
            {
                long longId = Convert.ToInt64(id);
                svc.DeleteAccount(longId);
                errorModel.Error   = null;
                errorModel.Success = true;
            }
            catch (AggregationCategorizationException ex)
            {
                errorModel.Error   = ex.ToString();
                errorModel.Success = false;
            }

            return(errorModel);
        }
Exemplo n.º 2
0
 protected void AccountsGridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         int  row       = Convert.ToInt32(e.CommandArgument);
         long accountId = long.Parse(AccountsGridView.DataKeys[row].Value.ToString());
         if (e.CommandName == "ViewTransactions")
         {
             Response.Redirect("ViewTransactions.aspx?Account=" + accountId);
         }
         if (e.CommandName == "DeleteAccount")
         {
             AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name);
             svc.DeleteAccount(accountId);
             FillAccountsList();
         }
     }
     catch (Exception ex)
     {
         Master.ErrorMessage = "Error occurred while calling " + e.CommandName + ": " + ex.Message;
     }
 }
        internal ErrorModel DeleteAccount(string id)
        {
            ErrorModel errorModel = new ErrorModel();

            //Demo purposes only.  The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call.
            SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate,
                                                                      AggCatAppSettings.ConsumerKey,
                                                                      AggCatAppSettings.ConsumerSecret,
                                                                      AggCatAppSettings.SamlIdentityProviderId,
                                                                      AggCatAppSettings.CustomerId);
            ServiceContext ctx = new ServiceContext(validator);
            AggregationCategorizationService svc = new AggregationCategorizationService(ctx);
            try
            {
                long longId = Convert.ToInt64(id);
                svc.DeleteAccount(longId);
                errorModel.Error = null;
                errorModel.Success = true;
            }
            catch (AggregationCategorizationException ex)
            {
                errorModel.Error = ex.ToString();
                errorModel.Success = false;
            }

            return errorModel;
        }