private void generateSQLToolStripMenuItem_Click(object sender, EventArgs e) { FileSelect SelectFile = new FileSelect(); SelectFile.ShowDialog(); if (SelectFile.Success) { IBMiUtils.UsingQTEMPFiles(new[] { "Q_GENSQL" }); if (IBMi.RemoteCommand(SelectFile.getCommand())) { OpenSource(new RemoteSource("", "QTEMP", "Q_GENSQL", "Q_GENSQL", "SQL", false)); } else { MessageBox.Show("Error generating SQL source."); } } }
private void create_Click(object sender, EventArgs e) { bool isValid = true; lib.Text = lib.Text.Trim(); spf.Text = spf.Text.Trim(); if (!IBMiUtils.IsValueObjectName(lib.Text)) { isValid = false; } if (!IBMiUtils.IsValueObjectName(spf.Text)) { isValid = false; } if (isValid) { if (IBMi.IsConnected()) { string cmd = "CRTSRCPF FILE(" + lib.Text + "/" + spf.Text + ") RCDLEN(" + rcdLen.Value.ToString() + ") CCSID(" + ccsid.Text + ")"; if (IBMi.RemoteCommand(cmd) == false) { Editor.TheEditor.AddTool("Member Browse", new MemberBrowse(lib.Text, spf.Text)); this.Close(); } else { MessageBox.Show(lib.Text.Trim() + "/" + spf.Text.Trim() + " not created."); } } else { Directory.CreateDirectory(IBMiUtils.GetLocalDir(lib.Text, spf.Text)); Editor.TheEditor.AddTool("Member Browse", new MemberBrowse(lib.Text, spf.Text)); } } else { MessageBox.Show("SPF information not valid."); } }
private void create_Click(object sender, EventArgs e) { Boolean isValid = true; string Command = ""; if (!IBMiUtils.IsValueObjectName(lib.Text)) { isValid = false; } if (!IBMiUtils.IsValueObjectName(spf.Text)) { isValid = false; } if (!IBMiUtils.IsValueObjectName(mbr.Text)) { isValid = false; } if (isValid) { _lib = lib.Text.Trim(); _spf = spf.Text.Trim(); _mbr = mbr.Text.Trim(); _type = (type.Text.Trim() == "" ? "*NONE" : type.Text.Trim()); _text = (text.Text.Trim() == "" ? "*BLANK" : "'" + text.Text.Trim() + "'"); Command = "ADDPFM FILE(" + _lib + "/" + _spf + ") MBR(" + _mbr + ") TEXT(" + _text + ") SRCTYPE(" + _type + ")"; if (IBMi.RemoteCommand(Command)) //No error { created = true; this.Close(); } else { MessageBox.Show("Member not created.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("Provided member information not valid.", "Invalid member.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void generateSQLToolStripMenuItem_Click(object sender, EventArgs e) { FileSelect SelectFile = new FileSelect(); SelectFile.ShowDialog(); if (SelectFile.Success) { new Thread((ThreadStart) delegate { IBMi.RemoteCommand(SelectFile.getCommand()); string resultFile = IBMiUtils.DownloadMember("QTEMP", "Q_GENSQL", "Q_GENSQL", "SQL"); if (resultFile != "") { this.Invoke((MethodInvoker) delegate { Editor.TheEditor.AddMemberEditor(new Member(resultFile, "QTEMP", "Q_GENSQL", "Q_GENSQL", "SQL", false), GetBoundLangType("SQL")); }); } }).Start(); } }
private void toolStripButton1_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to delete all spool files of user " + IBMi.CurrentSystem.GetValue("username") + "? This process can take some time.", "Continue", MessageBoxButtons.YesNo, MessageBoxIcon.Hand); if (result == DialogResult.Yes) { Editor.TheEditor.SetStatus("Deleting all spool files.."); new Thread((ThreadStart) delegate { if (IBMi.RemoteCommand("DLTSPLF FILE(*SELECT)") == true) { this.Invoke((MethodInvoker) delegate { Editor.TheEditor.SetStatus("Spool files deleted."); spoolList.Items.Clear(); }); } else { MessageBox.Show("Failed to delete all spool files."); } }).Start(); } }
private void button2_Click(object sender, EventArgs e) { IBMi.CurrentSystem.SetValue("useuserlibl", userLibl.Checked.ToString().ToLower()); if (userLibl.Checked) { this.Close(); } else { label2.Text = ""; label2.Update(); //Add a default library if (listBox1.Items.Count == 0) { listBox1.Items.Add("SYSTOOLS"); } string s = ""; foreach (string item in listBox1.Items) { if (IBMiUtils.IsValueObjectName(item.Trim())) { s += item.Trim() + ','; } else { label2.Text = "Invalid library: " + item.Trim(); label2.Update(); return; } } if (!IBMiUtils.IsValueObjectName(textBox2.Text.Trim())) { label2.Text = "Invalid current library."; label2.Update(); return; } string origLibl = IBMi.CurrentSystem.GetValue("datalibl"); string origCur = IBMi.CurrentSystem.GetValue("curlib"); IBMi.CurrentSystem.SetValue("datalibl", s.Remove(s.Length - 1, 1)); //Remove last comma IBMi.CurrentSystem.SetValue("curlib", textBox2.Text.Trim()); //Remove last comma Boolean Success = IBMi.RemoteCommand($"CHGLIBL LIBL({ IBMi.CurrentSystem.GetValue("datalibl").Replace(',', ' ')}) CURLIB({ IBMi.CurrentSystem.GetValue("curlib") })"); if (!Success) { IBMi.CurrentSystem.SetValue("datalibl", origLibl); IBMi.CurrentSystem.SetValue("curlib", origCur); MessageBox.Show("Library list contains invalid libraries.", "Library list", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { this.Close(); } } }