private void CountryView_Load(object sender, EventArgs e)
        {
            if (!DesignMode)
            {
                h3Required3.SetMaxWidth(370);
                lblYear.SetMaxWidth(370);

                DemoRepository demo = new DemoRepository();
                model = demo.GetCountryLevelStatsRecent();
                CreateIncomeStatusDropdown(comboBox1);
                bsCountryDemo.DataSource = model;
            }
        }
示例#2
0
        private bool SaveDemo()
        {
            countryDemographyView1.DoValidate();
            model = countryDemographyView1.GetDemo();
            if (!model.IsValid() || !countryDemographyView1.IsValid())
            {
                MessageBox.Show(Translations.ValidationError, Translations.ValidationErrorTitle);
                return false;
            }

            int userId = ApplicationData.Instance.GetUserId();
            var demo = new DemoRepository();
            demo.Save(model, userId);
            return true;
        }
        private void doSave_Click(object sender, EventArgs e)
        {
            countryView1.DoValidate();
            if (!country.IsValid())
            {
                MessageBox.Show(Translations.ValidationError, Translations.ValidationErrorTitle);
                return;
            }
            countryDemographyView1.DoValidate();
            countryStats = countryDemographyView1.GetDemo();
            if (countryStats != null && (!countryStats.IsValid() || !countryDemographyView1.IsValid()))
            {
                MessageBox.Show(Translations.ValidationError, Translations.ValidationErrorTitle);
                return;
            }
            if (!adminLevelTypesControl1.HasAggregatingLevel())
            {
                MessageBox.Show(Translations.MustMakeAggregatingLevel, Translations.ValidationErrorTitle);
                return;
            }

            int userId = ApplicationData.Instance.GetUserId();
            demo.UpdateCountry(country, userId);
            if(countryStats != null)
                demo.Save(countryStats, userId);
            var selected = diseasePickerControl1.GetSelectedItems();
            var available = diseasePickerControl1.GetUnselectedItems();
            diseases.SaveSelectedDiseases(selected, true, userId);
            diseases.SaveSelectedDiseases(available, false, userId);
            OnClose();
        }