예제 #1
0
 private void btnEditAddress_Click(object sender, System.EventArgs e)
 {
     if (!this.bwLoadAddresses.get_IsBusy())
     {
         Area area = (Area) this.listAreas.get_SelectedItem();
         if (((area == null) || (area == Area.Null)) || (area.Id == -1L))
         {
             Messages.ShowError("Выберите изменяемый набор адресов");
         }
         else
         {
             AreaAddressesForm form = new AreaAddressesForm(area);
             form.ShowDialog();
             if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
             {
                 area.SaveAddresses(form.getSelectedAddresses());
                 this.listAreas_SelectedIndexChanged(sender, e);
             }
             this.btnSearchAddresses.PerformClick();
         }
     }
 }
예제 #2
0
 private void tsbAddRestriction_Click(object sender, System.EventArgs e)
 {
     CalcPeriod period = this.bsCalcPeriods.get_Current() as CalcPeriod;
     if (period == null)
     {
         System.Windows.Forms.MessageBox.Show("Не выбран период");
     }
     else
     {
         ObjectList<LocalAddress> restrictionAddresses = period.GetRestrictionAddresses();
         AreaAddressesForm form = new AreaAddressesForm(this.addressesSource, restrictionAddresses);
         if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             ObjectList<LocalAddress> area = form.getSelectedAddresses();
             period.DeleteRestrictionAddresses();
             period.AddRestrictionAddresses(area);
             this.areaAddresses.Load(area, true);
         }
     }
 }