private void tsbCounterChange_Click(object sender, System.EventArgs e)
 {
     if ((this.m_House != AIS.SN.Model.DomainObjects.House.Null) && ((this.bsHouseAreas.get_Current() != null) && (this.bsHouseAreas.get_Current() != HouseArea.Null)))
     {
         HistoryHouseAreasAddChangeForm form = new HistoryHouseAreasAddChangeForm(this.bsHouseAreas.get_Current() as HouseArea, true);
         form.set_Text("Изменение истории площади дома");
         form.btnAddChange.set_Text("Изменить");
         if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             this.bsHouseAreas.set_DataSource(HouseArea.FindAllByHouseId(this.m_House.Id));
         }
     }
 }
 private void tsbEditSelected_Click(object sender, System.EventArgs e)
 {
     if (this.dgvHouses.SelectedCells.get_Count() == 0)
     {
         System.Windows.Forms.MessageBox.Show("Выберите элементы для редактирования", "Ошибка", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
     }
     HouseArea houseAreas = new HouseArea();
     HistoryHouseAreasAddChangeForm form = new HistoryHouseAreasAddChangeForm(houseAreas, false);
     if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         HouseArea houseArea = form.GetHouseArea();
         System.Collections.Generic.List<int> list = new System.Collections.Generic.List<int>();
         foreach (System.Windows.Forms.DataGridViewCell cell in this.dgvHouses.SelectedCells)
         {
             if (list.LastIndexOf(cell.get_RowIndex()) == -1)
             {
                 if (houseArea.Total != 0M)
                 {
                     this.dgvHouses.Rows.get_Item(cell.get_RowIndex()).Cells.get_Item("NewTotalSquare").set_Value(houseArea.Total);
                 }
                 if (houseArea.Heating != 0M)
                 {
                     this.dgvHouses.Rows.get_Item(cell.get_RowIndex()).Cells.get_Item("NewHeating").set_Value(houseArea.Heating);
                 }
                 if (houseArea.Living != 0M)
                 {
                     this.dgvHouses.Rows.get_Item(cell.get_RowIndex()).Cells.get_Item("NewLiving").set_Value(houseArea.Living);
                 }
                 if (houseArea.Floor != 0M)
                 {
                     this.dgvHouses.Rows.get_Item(cell.get_RowIndex()).Cells.get_Item("NewFloor").set_Value(houseArea.Floor);
                 }
                 if (houseArea.TotalOi != 0M)
                 {
                     this.dgvHouses.Rows.get_Item(cell.get_RowIndex()).Cells.get_Item("NewTotalOi").set_Value(houseArea.TotalOi);
                 }
                 if (houseArea.LivingMkd != 0M)
                 {
                     this.dgvHouses.Rows.get_Item(cell.get_RowIndex()).Cells.get_Item("NewLivingMkd").set_Value(houseArea.LivingMkd);
                 }
                 if (houseArea.TotalMkd != 0M)
                 {
                     this.dgvHouses.Rows.get_Item(cell.get_RowIndex()).Cells.get_Item("NewTotalMKd").set_Value(houseArea.TotalMkd);
                 }
                 if (houseArea.NotLivingMkd != 0M)
                 {
                     this.dgvHouses.Rows.get_Item(cell.get_RowIndex()).Cells.get_Item("NewNotLivingMKd").set_Value(houseArea.NotLivingMkd);
                 }
                 if (houseArea.NotSubscribe != 0M)
                 {
                     this.dgvHouses.Rows.get_Item(cell.get_RowIndex()).Cells.get_Item("NewNotSubscribe").set_Value(houseArea.NotSubscribe);
                 }
                 list.Add(cell.get_RowIndex());
             }
         }
     }
     this.btnSave.set_Enabled(this.ValidateSavingOptions());
 }
 private void tsbCounterAdd_Click(object sender, System.EventArgs e)
 {
     HistoryHouseAreasAddChangeForm form = new HistoryHouseAreasAddChangeForm(this.m_House.Id);
     form.set_Text("Добавление записи в историю площади дома");
     form.ShowDialog(this);
     if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
     {
         form.HouseArea.SaveChanges();
         this.bsHouseAreas.Add(form.HouseArea);
     }
 }