private void Init(AdminLevelType type, IWizardStep step, bool demoOnly, int? cid) { countryDemoId = cid; isDemoOnly = demoOnly; locationType = type; prev = step; SettingsRepository settings = new SettingsRepository(); DemoRepository demo = new DemoRepository(); if (!isDemoOnly) demoDate = demo.GetCountryDemoRecent().DateDemographyData; if (!isSingleImport) { nextType = settings.GetNextLevel(locationType.LevelNumber); stepTitle = isDemoOnly ? Translations.UpdateDemography + " - " + locationType.DisplayName : Translations.ImportAdminLevels + locationType.DisplayName; importer = new AdminLevelDemoImporter(locationType, countryDemoId); } else stepTitle = Translations.Demography + " - " + locationType.DisplayName; updater = new AdminLevelDemoUpdater(locationType, countryDemoId); InitializeComponent(); }
private void CheckStatus() { var settings = new SettingsRepository(); var status = settings.GetStartUpStatus(); if (!status.ShouldShowStartup()) OnFinished(); tblTasks.Visible = false; this.SuspendLayout(); tblTasks.Controls.Clear(); int rowIndex = tblTasks.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize }); tblTasks.Controls.Add(CreateLabel("1. " + Translations.StartUpStepCountry, status.HasEnteredCountrySettings), 0, rowIndex); var ctrl = new H3Link { Text = status.HasEnteredCountrySettings ? Translations.EditLink : Translations.StartLink, Anchor = AnchorStyles.Bottom | AnchorStyles.Left, Margin = new Padding(3, 3, 3, 5), TextColor = Color.FromArgb(255, 255, 255) }; ctrl.ClickOverride += () => { LoadWiz(new StepCountrySettings(demo.GetCountry())); }; tblTasks.Controls.Add(ctrl, 1, rowIndex); rowIndex = tblTasks.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize }); tblTasks.Controls.Add(CreateLabel("2. " + Translations.StartUpStepDiseases, status.HasEnteredDiseaseDetails), 0, rowIndex); if (status.HasEnteredCountrySettings) { var ctrl2 = new H3Link { Text = status.HasEnteredDiseaseDetails ? Translations.EditLink : Translations.StartLink, Anchor = AnchorStyles.Bottom | AnchorStyles.Left, Margin = new Padding(3, 3, 3, 5), TextColor = Color.FromArgb(255, 255, 255) }; ctrl2.ClickOverride += () => { LoadWiz(new StepDiseases()); }; tblTasks.Controls.Add(ctrl2, 1, rowIndex); } bool hasFinishedPrevStep = status.HasEnteredDiseaseDetails; var countryDemo = demo.GetCountryDemoRecent(); int stepCount = 3; foreach (var al in status.AdminLevelTypes) { rowIndex = tblTasks.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize }); tblTasks.Controls.Add(CreateLabel(stepCount + ". " + Translations.StartUpStepAdminLevels + al.LevelName, al.HasEntered), 0, rowIndex); if(hasFinishedPrevStep) { var ctrl3 = new H3Link { Text = al.HasEntered ? Translations.EditLink : Translations.StartLink, Anchor = AnchorStyles.Bottom | AnchorStyles.Left, Margin = new Padding(3, 3, 3, 5), TextColor = Color.FromArgb(255, 255, 255) }; int levelNumber = al.Level - 1; ctrl3.ClickOverride += () => { LoadWiz(new StepAdminLevelImport(settings.GetNextLevel(levelNumber), null, countryDemo.Id)); }; tblTasks.Controls.Add(ctrl3, 1, rowIndex); hasFinishedPrevStep = al.HasEntered; } stepCount++; } if (ConfigurationManager.AppSettings["DeveloperMode"] == "QA") { rowIndex = tblTasks.RowStyles.Add(new RowStyle { SizeType = SizeType.AutoSize }); var skipLink = new H3Link { Text = "Skip Start Up", Anchor = AnchorStyles.Bottom | AnchorStyles.Left, Margin = new Padding(3, 3, 3, 5), TextColor = Color.FromArgb(255, 255, 255) }; skipLink.ClickOverride += skipLink_ClickOverride; tblTasks.Controls.Add(skipLink, 0, rowIndex); } this.ResumeLayout(); tblTasks.Visible = true; }