async void AddStoredProcedure(string body, object idobject)
        {
            string id = idobject as string;
            try
            {
                Documents.StoredProcedure sp = new Documents.StoredProcedure();
                sp.Body = body;
                sp.Id = id;

                ResourceResponse<Documents.StoredProcedure> newsp;
                using (PerfStatus.Start("CreateStoredProcedure"))
                {
                    newsp = await this.client.CreateStoredProcedureAsync((this.Parent.Tag as Documents.DocumentCollection).GetLink(this.client), sp, Program.GetMain().GetRequestOptions());
                }

                this.Nodes.Add(new DocumentNode(this.client, newsp.Resource, ResourceType.StoredProcedure));

                // set the result window
                string json = newsp.Resource.ToString();

                Program.GetMain().SetResultInBrowser(json, null, false, newsp.ResponseHeaders);

            }
            catch (AggregateException e)
            {
                Program.GetMain().SetResultInBrowser(null, e.InnerException.ToString(), true);
            }
            catch (Exception e)
            {
                Program.GetMain().SetResultInBrowser(null, e.ToString(), true);
            }
        }
Beispiel #2
0
        async void AddStoredProcedure(string body, string id)
        {
            try
            {
                Documents.StoredProcedure sp = new Documents.StoredProcedure();
                sp.Body = body;
                sp.Id = id;

                ResourceResponse<Documents.StoredProcedure> newsp =  await this.client.CreateStoredProcedureAsync((this.Parent.Tag as Documents.DocumentCollection).SelfLink, sp);

                this.Nodes.Add(new DocumentNode(this.client, newsp.Resource, ResourceType.StoredProcedure));

                // set the result window
                string json = newsp.Resource.ToString();

                Program.GetMain().SetResultInBrowser(json, null, false, newsp.ResponseHeaders);

            }
            catch (AggregateException e)
            {
                Program.GetMain().SetResultInBrowser(null, e.InnerException.ToString(), true);
            }
            catch (Exception e)
            {
                Program.GetMain().SetResultInBrowser(null, e.ToString(), true);
            }
        }