Exemple #1
0
 private void btnAddresses_Click(object sender, System.EventArgs e)
 {
     base.set_UseWaitCursor(true);
     AreaAddressesForm form = new AreaAddressesForm(this.addressesSource, this.addressesDest);
     if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
     {
         this.addressesSource = form.GetAddressesSource();
         this.addressesDest = form.GetAddressesDest();
         base.set_UseWaitCursor(false);
     }
 }
 private void changetoolStripButton_Click(object sender, System.EventArgs e)
 {
     AreaAddressesForm form = new AreaAddressesForm(this.addressesSource, this.addressesDest);
     if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
     {
         this.addressesSource = form.GetAddressesSource();
         this.addressesDest = form.GetAddressesDest();
         this.bsAddress.set_DataSource(this.addressesDest);
         if (this.AddressSelected != null)
         {
             this.AddressSelected();
         }
     }
 }
 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();
         }
     }
 }
Exemple #4
0
 private void tsAddress_Click(object sender, System.EventArgs e)
 {
     AreaAddressesForm form;
     User user = ((User) this.bsUsers.get_Current()) ?? User.Null;
     Area area = new Area();
     this.addresses = LocalAddress.GetByUserId(user);
     area.SaveChanges();
     area.SaveAddresses(this.addresses);
     if (this.addresses.get_Count() == 0)
     {
         form = new AreaAddressesForm(this.addressesSource, this.addressesDest);
     }
     else
     {
         form = new AreaAddressesForm(area);
     }
     if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
     {
         this.addressesDest = form.GetAddressesDest();
         foreach (LocalAddress address in this.addressesDest)
         {
             if (!this.addresses.Contains(address))
             {
                 new UserAddress { UserId = user.Id, AdrId = address.Id }.SaveChanges();
             }
         }
         foreach (LocalAddress address3 in this.addresses)
         {
             if (!this.addressesDest.Contains(address3))
             {
                 UserAddress.DeleteByUserAndAddress(address3, user);
             }
         }
         area.DeleteWithRelations();
         this.addresses.Clear();
         this.addressesDest.Clear();
         this.addressesSource.Clear();
     }
 }
Exemple #5
0
 protected override void SelectObject(object sender, System.EventArgs e)
 {
     AreaAddressesForm form;
     if (((this.addressesSource.get_Count() == 0) && (this.addressesDest.get_Count() == 0)) && this.IsByUser)
     {
         this.addressesSource = LocalAddress.GetUserAddresses();
         if (this.addressesSource.get_Count() == 0)
         {
             Messages.ShowMessage("Адресный план для данного пользователя пустой");
             return;
         }
     }
     if (this.m_SelectedByUserArea == Area.Null)
     {
         form = new AreaAddressesForm(this.addressesSource, this.addressesDest);
         this.addressesSource = form.GetAddressesSource();
         if (base.txt.get_Text() != "")
         {
             this.addressesDest = form.GetAddressesDest();
         }
     }
     else
     {
         form = new AreaAddressesForm(this.m_SelectedByUserArea);
     }
     form.ShowDialog(this);
     if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         this.m_SelectedByUserArea = form.SelectedByUserArea;
         this.addressesDest = form.GetAddressesDest();
         this.addressesSource = form.GetAddressesSource();
         this.Fill();
     }
 }
Exemple #6
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);
         }
     }
 }