void myMenuItemQueryDocument_Click(object sender, EventArgs e)
        {
            this.currentQueryCommandContext = new CommandContext();
            this.currentQueryCommandContext.IsFeed = true;

            // reset continuation token
            this.currentContinuation = null;

            Program.GetMain().SetCrudContext(this, string.Format(CultureInfo.InvariantCulture, "Query Documents from Collection {0}", (this.Tag as Documents.DocumentCollection).Id),
                false, "select * from c", this.QueryDocuments, this.currentQueryCommandContext);

        }
 void myMenuItemDeleteDocumentCollection_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     context.IsDelete = true;
     Program.GetMain().SetCrudContext(this, "Delete DocumentCollection", false, x, this.DeleteDocumentCollection, context);
 }
 void myMenuItemUpdateDocumentCollection_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     Program.GetMain().SetCrudContext(this, "Replace DocumentCollection", false, x, this.UpdateDocumentCollection, context);
 }
Beispiel #4
0
 void myMenuItemQueryDocument_Click(object sender, EventArgs e)
 {
     this.currentQueryCommandContext = new CommandContext();
     this.currentQueryCommandContext.IsFeed = true; 
     Program.GetMain().SetCrudContext(string.Format("Query Documents from Collection {0}", (this.Tag as Documents.DocumentCollection).Id),
         false, "select * from c", this.QueryDocuments, this.currentQueryCommandContext);
     
 }
 void myMenuItemDelete_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     context.IsDelete = true;
     Program.GetMain().SetCrudContext(this, "Delete " + this.resourceType.ToString(), false, x, this.DeleteNode, context);
 }
 public void SetNextPageVisibility(CommandContext commandContext)
 {
     this.btnExecuteNext.Enabled = commandContext.HasContinuation || !commandContext.QueryStarted;
 }
Beispiel #7
0
 void myMenuItemDeleteDatabase_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     context.IsDelete = true;
     Program.GetMain().SetCrudContext("Delete database", false, x, this.DeleteDatabase, context);
 }
        public void SetCrudContext(TreeNode node, string name, bool showId, string bodytext, Action<string, object> func, CommandContext commandContext = null)
        {
            if (commandContext == null)
            {
                commandContext = new CommandContext();
            }

            this.treeView1.SelectedNode = node;

            this.currentCrudName = name;

            this.currentOperation = func;
            this.tabCrudContext.Text = name;
            this.tbCrudContext.Text = bodytext;

            this.toolStripBtnExecute.Enabled = true;
            this.tbCrudContext.ReadOnly = commandContext.IsDelete;

            // the whole left split panel.
            this.splitContainerInner.Panel1Collapsed = false;
            //the split panel inside Tab. Panel1: Id, Panel2: Edit CRUD.
            this.splitContainerIntabPage.Panel1Collapsed = !showId;

            this.tbResponse.Text = "";

            //the split panel at right bottom. Panel1: NextPage, Panel2: Browser.
            if (commandContext.IsFeed)
            {
                this.ButtomSplitContainer.Panel1Collapsed = false;
                this.ButtomSplitContainer.Panel1.Controls.Clear();
                this.ButtomSplitContainer.Panel1.Controls.Add(this.feedToolStrip);
            }
            else if (commandContext.IsCreateTrigger)
            {
                this.ButtomSplitContainer.Panel1Collapsed = false;
                this.ButtomSplitContainer.Panel1.Controls.Clear();
                this.ButtomSplitContainer.Panel1.Controls.Add(this.triggerPanel);
            }
            else
            {
                this.ButtomSplitContainer.Panel1Collapsed = true;
            }

            this.SetNextPageVisibility(commandContext);

            if (string.Compare(name, "Create documentCollection", StringComparison.OrdinalIgnoreCase) == 0 ||
                string.Compare(name, "Replace DocumentCollection", StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (string.Compare(name, "Create documentCollection", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    cbIndexingPolicyDefault.Enabled = true;
                }
                else
                {
                    cbIndexingPolicyDefault.Enabled = false;
                }

                if (this.tabControl.TabPages.Contains(this.tabCrudContext))
                {
                    this.tabControl.TabPages.Insert(0, this.tabDocumentCollectionPolicy);
                    this.tabControl.TabPages.Remove(this.tabCrudContext);
                }
                this.tabControl.SelectedTab = this.tabDocumentCollectionPolicy;
            }
            else
            {
                if (this.tabControl.TabPages.Contains(this.tabDocumentCollectionPolicy))
                {
                    this.tabControl.TabPages.Remove(this.tabDocumentCollectionPolicy);
                    this.tabControl.TabPages.Insert(0, this.tabCrudContext);
                }
                this.tabControl.SelectedTab = this.tabCrudContext;
            }
        }
        void myMenuItemQueryDocument_Click(object sender, EventArgs e)
        {
            this.currentQueryCommandContext = new CommandContext();
            this.currentQueryCommandContext.IsFeed = true;

            // reset continuation token
            this.currentContinuation = null;

            Program.GetMain().SetCrudContext(this, OperationType.Query, ResourceType.Document, "select * from c", this.QueryDocumentsAsync, this.currentQueryCommandContext);

        }
 void myMenuItemReplaceDocumentCollection_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     Program.GetMain().SetCrudContext(this, OperationType.Replace, ResourceType.DocumentCollection, x, this.ReplaceDocumentCollectionAsync, context);
 }
 void myMenuItemDeleteDatabase_Click(object sender, EventArgs e)
 {
     string x = this.Tag.ToString();
     CommandContext context = new CommandContext();
     context.IsDelete = true;
     Program.GetMain().SetCrudContext(this, OperationType.Delete,  ResourceType.Database, x, this.DeleteDatabaseAsync, context);
 }
Beispiel #12
0
        public void SetCrudContext(string name, bool showId, string bodytext, Action<string, string> func, CommandContext commandContext = null)
        {
            if(commandContext == null)
            {
                commandContext = new CommandContext();
            }

            this.currentOperation = func;
            this.tabCrudContext.Text = name;
            this.tbCrudContext.Text = bodytext;

            this.toolStripBtnExecute.Enabled = true;
            this.tbCrudContext.ReadOnly = commandContext.IsDelete;

            this.splitContainerInner.Panel1Collapsed = false;
            this.splitContainerIntabPage.Panel1Collapsed = !showId;

            this.tbResponse.Text = "";

            this.tabControl.SelectedTab = this.tabCrudContext;
            this.ButtomSplitContainer.Panel1Collapsed = !commandContext.IsFeed;
            this.SetNextPageVisibility(commandContext);
        }