Merge pull request #48 from nb-tergen/microsoft-master

Update to "export list of instances" to allow this to be run for current instance only
This commit is contained in:
Tomek Melissa 2020-03-19 13:26:51 +01:00 коммит произвёл GitHub
Родитель 603e0fc9c7 941f606691
Коммит 9a7cbd0441
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 366 добавлений и 192 удалений

Просмотреть файл

@ -16,6 +16,12 @@
SAAS = 2
}
enum LCSProjectAllCurrent
{
ALL = 0,
CURRENT = 1
}
#region LCS enums
public enum ProjectDocScope { Methodology = 0, Artifact = 1 }

408
2LCS/Forms/MainForm.Designer.cs сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -715,9 +715,85 @@ namespace LCS.Forms
Cursor = Cursors.Default;
}
private void ExportListOfInstancesForAllProjects(LCSEnvironments _LCSEnvironments)
private void ExportEnvironmentUpdates(LCSEnvironments _LCSEnvironments)
{
notifyIcon.BalloonTipText = $"Exporting list of {_LCSEnvironments} instances for all LCS projects. Please wait...";
notifyIcon.BalloonTipText = $"Exporting list of Environment Updates to {_LCSEnvironments} environments for current project. Please wait...";
notifyIcon.BalloonTipTitle = $"Exporting list of Environment Updates";
notifyIcon.ShowBalloonTip(2000); //This setting might be overruled by the OS
var previousProject = _selectedProject;
var exportedActionDetailList = new List<ActionDetails>();
_httpClientHelper.ChangeLcsProjectId(_selectedProject.Id.ToString());
_httpClientHelper.LcsProjectTypeId = _selectedProject.ProjectTypeId;
RefreshChe();
RefreshSaas();
if (_LCSEnvironments == LCSEnvironments.ALL || _LCSEnvironments == LCSEnvironments.SAAS)
if (_saasInstancesList != null && _saasInstancesList.Count > 0)
{
foreach (var _instance in _saasInstancesList)
{
List<ActionDetails> actions = _httpClientHelper.GetEnvironmentHistoryDetails(_instance);
if (actions != null)
{
foreach (ActionDetails _action in actions)
{
_action.EnvironmentName = _instance.DisplayName;
exportedActionDetailList.Add(_action);
}
}
}
}
if (_LCSEnvironments == LCSEnvironments.ALL || _LCSEnvironments == LCSEnvironments.CHE)
if (_cheInstancesList != null && _cheInstancesList.Count > 0)
{
foreach (var _instance in _cheInstancesList)
{
List<ActionDetails> actions = _httpClientHelper.GetEnvironmentHistoryDetails(_instance);
if (actions != null)
{
foreach (ActionDetails _action in actions)
{
_action.EnvironmentName = _instance.DisplayName;
exportedActionDetailList.Add(_action);
}
}
}
}
SaveFileDialog savefile = new SaveFileDialog
{
FileName = $"D365FO {_LCSEnvironments} environment updates - 2LCS generated.csv",
Filter = "CSV files (*.csv)|*.csv|All files (*.*)|*.*"
};
if (savefile.ShowDialog() == DialogResult.OK)
{
try
{
using StreamWriter sw = new StreamWriter(savefile.FileName, false, Encoding.Unicode);
var csv = new CsvWriter(sw, CultureInfo.CurrentCulture);
csv.WriteRecords(exportedActionDetailList);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
_selectedProject = previousProject;
_httpClientHelper.ChangeLcsProjectId(_selectedProject.Id.ToString());
_httpClientHelper.LcsProjectTypeId = _selectedProject.ProjectTypeId;
SetLcsProjectText();
RefreshChe(false);
RefreshSaas(false);
}
private void ExportListOfInstancesForAllProjects(LCSEnvironments _LCSEnvironments, LCSProjectAllCurrent _LCSProjectAllCurrent)
{
notifyIcon.BalloonTipText = $"Exporting list of {_LCSEnvironments} instances for {_LCSProjectAllCurrent} LCS projects. Please wait...";
notifyIcon.BalloonTipTitle = $"Exporting list of {_LCSEnvironments} instances";
notifyIcon.ShowBalloonTip(2000); //This setting might be overruled by the OS
@ -726,7 +802,16 @@ namespace LCS.Forms
var previousProject = _selectedProject;
var exportedInstances = new List<ExportedInstance>();
Projects = _httpClientHelper.GetAllProjects();
if (_LCSProjectAllCurrent == LCSProjectAllCurrent.ALL)
{
Projects = _httpClientHelper.GetAllProjects();
}
else if (_LCSProjectAllCurrent == LCSProjectAllCurrent.CURRENT)
{
Projects = new List<LcsProject>();
Projects.Add(previousProject);
}
Projects = ExcludeProjectsForOrganization(Projects); //remove all internal projects for export.
foreach (var _project in Projects)
@ -2228,20 +2313,15 @@ namespace LCS.Forms
RefreshChe(false);
RefreshSaas(false);
}
private void AllInstancesExportToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportListOfInstancesForAllProjects(LCSEnvironments.ALL);
}
private void CloudHostedInstancesExportToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportListOfInstancesForAllProjects(LCSEnvironments.CHE);
ExportListOfInstancesForAllProjects(LCSEnvironments.CHE, LCSProjectAllCurrent.ALL);
}
private void MSHostedInstancesExportToolStripMenuItem_Click(object sender, EventArgs e)
{
ExportListOfInstancesForAllProjects(LCSEnvironments.SAAS);
ExportListOfInstancesForAllProjects(LCSEnvironments.SAAS, LCSProjectAllCurrent.ALL);
}
private void SaasRestartService_Click(object sender, EventArgs e)
@ -2327,6 +2407,32 @@ namespace LCS.Forms
}
Cursor = Cursors.Default;
}
private void allProjectsTSMExportAllInstances_Click(object sender, EventArgs e)
{
ExportListOfInstancesForAllProjects(LCSEnvironments.ALL, LCSProjectAllCurrent.ALL);
}
private void currentProjectTSMExportAllInstances_Click(object sender, EventArgs e)
{
ExportListOfInstancesForAllProjects(LCSEnvironments.ALL, LCSProjectAllCurrent.CURRENT);
}
private void allInstancesExportChangesTSM_Click(object sender, EventArgs e)
{
ExportEnvironmentUpdates(LCSEnvironments.ALL);
}
private void cloudInstancesExportChangesTSM_Click(object sender, EventArgs e)
{
ExportEnvironmentUpdates(LCSEnvironments.CHE);
}
private void saasInstancesExportChangesTSM_Click(object sender, EventArgs e)
{
ExportEnvironmentUpdates(LCSEnvironments.SAAS);
}
}
public static class StringExtension

Просмотреть файл

@ -163,10 +163,10 @@
<value>True</value>
</metadata>
<metadata name="cheInstanceContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
<value>197, 17</value>
</metadata>
<metadata name="mainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>295, 17</value>
<value>387, 17</value>
</metadata>
<metadata name="saasInstanceId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
@ -214,13 +214,16 @@
<value>True</value>
</metadata>
<metadata name="saasInstanceContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>482, 17</value>
<value>522, 17</value>
</metadata>
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>757, 17</value>
<value>716, 17</value>
</metadata>
<metadata name="notifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>905, 17</value>
<value>825, 17</value>
</metadata>
<metadata name="notifyIconContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>57</value>

Просмотреть файл

@ -591,6 +591,7 @@ namespace LCS.JsonObjects
public int ServicingAction { get; set; }
public string StartDate { get; set; }
public LcsEnvironmentActionStatus Status { get; set; }
public string EnvironmentName { get; set; }
}
public class EnvironmentHistoryDetailsData

2
2LCS/Properties/Settings.Designer.cs сгенерированный
Просмотреть файл

@ -12,7 +12,7 @@ namespace LCS.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));