Esempio n. 1
0
        private void buttonPublicHolidaysSave_Click(object sender, EventArgs e)
        {
            PublicHolidaysWaitingForm waitingForm;
            DialogResult result;
            if (entry.Value != null)
            {
                if (ServicesProvider.GetInstance().GetNonWorkingDate().PublicHolidays.ContainsKey((DateTime)entry.Key))
                {
                    result = MessageBox.Show(MultiLanguageStrings.GetString(Ressource.GeneralSettings, "dateAlreadyExist.Text"), "",
                                             MessageBoxButtons.YesNo,
                                             MessageBoxIcon.Information);
                    if (result == DialogResult.Yes)
                    {
                        ServicesProvider.GetInstance().GetNonWorkingDate().PublicHolidays[(DateTime)entry.Key] = (string)entry.Value;
                        ServicesProvider.GetInstance().GetApplicationSettingsServices().UpdateNonWorkingDate(entry);
                        ServicesProvider.GetInstance().GetApplicationSettingsServices().FillNonWorkingDate();
                    }
                }
                else
                {
                    //display dialog
                    waitingForm = new PublicHolidaysWaitingForm();
                    result = waitingForm.ShowDialog();

                    ServicesProvider.GetInstance().GetNonWorkingDate().PublicHolidays.Add((DateTime)entry.Key, (string)entry.Value);
                    ServicesProvider.GetInstance().GetApplicationSettingsServices().AddNonWorkingDate(entry);
                    ServicesProvider.GetInstance().GetApplicationSettingsServices().FillNonWorkingDate();

                    if (result == DialogResult.Yes)
                    {
                        waitingForm.UpdateInstallmentsDate();
                    }
                }

                InitializeListViewPublicHolidays();
            }
            else
            {
                MessageBox.Show(MultiLanguageStrings.GetString(Ressource.GeneralSettings, "emptyPHDescription.Text"), "",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        private void buttonPublicHolidayDelete_Click(object sender, EventArgs e)
        {
            if (listViewPublicHolidays.SelectedItems.Count != 0)
            {
                ServicesProvider.GetInstance().GetNonWorkingDate().PublicHolidays.Remove((DateTime)entry.Key);
                ServicesProvider.GetInstance().GetApplicationSettingsServices().DeleteNonWorkingDate(entry);

                PublicHolidaysWaitingForm waitingForm;

                DialogResult result;

                if (entry.Value != null)
                {
                    waitingForm = new PublicHolidaysWaitingForm();
                    result = waitingForm.ShowDialog();
                    if (result == DialogResult.Yes)
                    {
                        waitingForm.UpdateInstallmentsDate((DateTime)entry.Key, ServicesProvider.GetInstance().GetContractServices().GetListOfInstallmentsOnDate((DateTime)entry.Key));
                    }
                }
            }
            else
                MessageBox.Show(MultiLanguageStrings.GetString(Ressource.GeneralSettings, "selectADate.Text"), "", MessageBoxButtons.OK, MessageBoxIcon.Information);

            InitializeListViewPublicHolidays();
        }