コード例 #1
0
        private void update_Click(object sender, EventArgs e)
        {
            string        cmd = "", result = "";
            List <string> ModuleList         = new List <string>();
            List <string> BindingDirectories = new List <string>();

            foreach (ListViewItem item in modules.Items)
            {
                if (item.Checked)
                {
                    ModuleList.Add(item.Text);
                }
            }

            foreach (string item in customModules.Items)
            {
                ModuleList.Add(item);
            }

            foreach (string bnddir in bndDirs.Items)
            {
                BindingDirectories.Add(bnddir);
            }

            if (ModuleList.Count == 0)
            {
                ModuleList.Add("*NONE");
            }

            if (isSrvPgm)
            {
                cmd = "UPDSRVPGM SRVPGM(" + pgm.Text + ") MODULE(" + String.Join(" ", ModuleList) + ")";
                if (updSrvSrc.Checked)
                {
                    cmd += " EXPORT(*CURRENT)";
                }
                else
                {
                    cmd += " EXPORT(*SRCFILE)";
                    cmd += " SRCFILE(" + bndLib.Text + "/" + bndSpf.Text + ")";
                    cmd += " SRCMBR(" + bndMbr.Text + ")";
                }
            }
            else
            {
                cmd = "UPDPGM PGM(" + pgm.Text + ") MODULE(" + String.Join(" ", ModuleList) + ")";
            }

            if (BindingDirectories.Count > 0)
            {
                cmd += " BNDDIR(" + String.Join(" ", BindingDirectories) + ")";
            }

            actgrp.Text = actgrp.Text.Trim();
            if (actgrp.Text != "" && actgrp.Text != "*SAME")
            {
                cmd += " ACTGRP(" + actgrp.Text + ")";
            }

            result = IBMi.RemoteCommandResponse(cmd);

            if (result == "")
            {
                Editor.TheEditor.SetStatus(pgm.Text + " updated successfully.");
                this.Close();
            }
            else
            {
                MessageBox.Show(result, "Error");
            }
        }