Beispiel #1
0
        private void mnuInsert_Click(object sender, EventArgs e)
        {
            BioSeqInsert frm = new BioSeqInsert(lstSampleIDs.Items);
            DialogResult rc  = frm.ShowDialog();

            if (rc == DialogResult.OK) // then the config has the specs
            {
                Cursor.Current = Cursors.WaitCursor;
                int    ret;
                string function = "Replace";

                // If the InsertInputPath is local, copy it to UserFolder on the server.
                if (AppConfigHelper.InsertInputPath().StartsWith("[L]"))
                {
                    DirectoryHelper.FileCopy(AppConfigHelper.InsertInputPath(), "[S]" + AppConfigHelper.UserFolder(), true);
                }

                WSLProxyResponse WSLResponse;
                if (AppConfigHelper.InsertSampleReplace)
                {
                    WSLResponse = ServiceCallHelper.ReplaceSample(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); // Parameters are in appsettings.
                }
                else // Go ahead without prompting.
                {
                    function    = "Insert";
                    WSLResponse = ServiceCallHelper.InsertSample(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); // Parameters are in appsettings.
                }
                ServiceCallHelper.LoadConfig(AppConfigHelper.LoggedOnUser);                                                   // To retrieve StandardOutput and LastError.
                Cursor.Current = Cursors.Default;
                if (WSLResponse.ExitCode == 0)
                {
                    MessageBox.Show(AppConfigHelper.StandardOutput + Environment.NewLine + function + " completed successfully.", "Success", MessageBoxButtons.OK);
                    ReloadSampleIDs(); // Reload list with new sample ID.
                }
                else
                {
                    MessageBox.Show(function + " completed with error code " + WSLResponse.ExitCode.ToString() + "." + Environment.NewLine + Environment.NewLine +
                                    AppConfigHelper.StandardOutput + Environment.NewLine + AppConfigHelper.LastError, "Error", MessageBoxButtons.OK);
                }
            }
        }