private void tsbChange_Click(object sender, System.EventArgs e)
 {
     AccountHouseHolder currentAccountHouseHolder = this.GetCurrentAccountHouseHolder();
     if (currentAccountHouseHolder == AccountHouseHolder.Null)
     {
         System.Windows.Forms.MessageBox.Show("Выберите элемент для изменения");
     }
     else
     {
         AccountHouseHolderHistoryAddChangeForm form = new AccountHouseHolderHistoryAddChangeForm(currentAccountHouseHolder);
         form.ShowDialog(this);
         if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
         {
             currentAccountHouseHolder.SaveChanges();
             this.UpdateAccountHouseHolderHistory();
         }
     }
 }
예제 #2
0
 private void btnSelectProvider_Click(object sender, System.EventArgs e)
 {
     this.m_Account = (Account) this.m_AccountBS.get_DataSource();
     if (this.m_isNewAccount)
     {
         AccountHouseHolderHistoryAddChangeForm form;
         if ((this.m_Account.HouseHolderId > 0L) || (this.m_AccountHouseHolder.Id > 0L))
         {
             form = new AccountHouseHolderHistoryAddChangeForm(this.m_AccountHouseHolder, false);
         }
         else
         {
             form = new AccountHouseHolderHistoryAddChangeForm(this.m_AccountHouseHolder, true);
         }
         if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             this.m_AccountHouseHolder = form.AccountHouseHolder;
             this.tbxAccountHolder.set_Text(this.m_AccountHouseHolder.ToString());
             if (this.onAccountHouseHolderSelected != null)
             {
                 this.onAccountHouseHolderSelected(this.m_AccountHouseHolder);
             }
         }
     }
     else
     {
         new AccountHouseHolderHistoryForm(this.m_Account.Id).ShowDialog();
         this.m_AccountHouseHolder = AIS.SN.Model.DomainObjects.AccountHouseHolder.FindActualValueByAccountId(this.m_Account.Id);
         this.tbxAccountHolder.set_Text(this.m_AccountHouseHolder.ToString());
         if (this.onAccountHouseHolderSelected != null)
         {
             this.onAccountHouseHolderSelected(this.m_AccountHouseHolder);
         }
         Apartment apartment = Apartment.FindById(this.m_Account.ApartmentId);
         bool flag = false;
         foreach (ApartmentHouseHolder holder in apartment.GetApartmentHouseHolders())
         {
             if ((this.m_AccountHouseHolder.OrgId == holder.OrgId) && (this.m_AccountHouseHolder.FromDate == holder.FromDate))
             {
                 flag = true;
             }
         }
         if (this.m_AccountHouseHolder == AIS.SN.Model.DomainObjects.AccountHouseHolder.Null)
         {
             flag = true;
         }
         if (!flag)
         {
             new ApartmentHouseHolder { ApartmentId = this.m_Account.ApartmentId, OrgId = this.m_AccountHouseHolder.OrgId, FromDate = this.m_AccountHouseHolder.FromDate }.SaveChanges();
         }
     }
 }
 private void tsbAdd_Click(object sender, System.EventArgs e)
 {
     AccountHouseHolder accountHouseHolder = new AccountHouseHolder {
         AccountId = this.m_accountId
     };
     AccountHouseHolderHistoryAddChangeForm form = new AccountHouseHolderHistoryAddChangeForm(accountHouseHolder);
     form.ShowDialog(this);
     if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         accountHouseHolder.SaveChanges();
         this.UpdateAccountHouseHolderHistory();
     }
 }