private void EditTariffTypeRow(System.Windows.Forms.DataGridViewRow row, HouseWithServiceTariff house) { decimal num; if (decimal.TryParse((string) (row.Cells.get_Item("NewTariffTypeRate").get_Value() as string), ref num)) { HouseServiceTariffTypeWithTariff tariff = row.get_DataBoundItem() as HouseServiceTariffTypeWithTariff; tariff.Rate = new decimal?(num); tariff.HouseServiceTariffId = house.TariffId; tariff.Apply(); } }
private void EditTariffTypeRow(System.Windows.Forms.DataGridViewRow row, HouseWithServiceTariff house, bool isUpdating) { decimal num; if (decimal.TryParse((string) (row.Cells.get_Item("NewTariffTypeRate").get_Value() as string), ref num)) { HouseServiceTariffTypeWithTariff tariff = row.get_DataBoundItem() as HouseServiceTariffTypeWithTariff; tariff.Rate = new decimal?(num); if (isUpdating) { HouseServiceTariffTypeWithTariff tariff2 = HouseServiceTariffTypeWithTariff.FindByHouseIdAndServiceTypeIdAndTariffTypeId(house.Id, house.TariffServiceTypeId, tariff.TariffTypeId); tariff2.Rate = new decimal?(num); tariff2.HouseServiceTariffId = house.TariffId; if (tariff2.HouseServiceTariffTypeId == HouseServiceTariffType.Null.Id) { tariff2.InsertTariffType(); } else { tariff2.UpdateTariffType(); } } else { tariff.HouseServiceTariffId = house.TariffId; tariff.InsertTariffType(); } } }