コード例 #1
0
 private void SaveRow(System.Windows.Forms.DataGridViewRow row)
 {
     HouseArea area = row.get_DataBoundItem() as HouseArea;
     bool flag = false;
     if (row.Cells.get_Item("NewTotalSquare").get_Value() != null)
     {
         area.Total = System.Convert.ToDecimal(row.Cells.get_Item("NewTotalSquare").get_Value());
         flag = true;
     }
     if (row.Cells.get_Item("NewHeating").get_Value() != null)
     {
         area.Heating = System.Convert.ToDecimal(row.Cells.get_Item("NewHeating").get_Value());
         flag = true;
     }
     if (row.Cells.get_Item("NewLiving").get_Value() != null)
     {
         area.Living = System.Convert.ToDecimal(row.Cells.get_Item("NewLiving").get_Value());
         flag = true;
     }
     if (row.Cells.get_Item("NewFloor").get_Value() != null)
     {
         area.Floor = System.Convert.ToDecimal(row.Cells.get_Item("NewFloor").get_Value());
         flag = true;
     }
     if (row.Cells.get_Item("NewTotalOi").get_Value() != null)
     {
         area.TotalOi = System.Convert.ToDecimal(row.Cells.get_Item("NewTotalOi").get_Value());
         flag = true;
     }
     if (row.Cells.get_Item("NewLivingMkd").get_Value() != null)
     {
         area.LivingMkd = System.Convert.ToDecimal(row.Cells.get_Item("NewLivingMkd").get_Value());
         flag = true;
     }
     if (row.Cells.get_Item("NewTotalMKd").get_Value() != null)
     {
         area.TotalMkd = System.Convert.ToDecimal(row.Cells.get_Item("NewTotalMKd").get_Value());
         flag = true;
     }
     if (row.Cells.get_Item("NewNotLivingMkd").get_Value() != null)
     {
         area.NotLivingMkd = System.Convert.ToDecimal(row.Cells.get_Item("NewNotLivingMkd").get_Value());
         flag = true;
     }
     if (row.Cells.get_Item("NewNotSubscribe").get_Value() != null)
     {
         area.NotSubscribe = System.Convert.ToDecimal(row.Cells.get_Item("NewNotSubscribe").get_Value());
         flag = true;
     }
     if (flag)
     {
         area.Id = -1L;
         area.FromDate = this.dbFromDate.Value;
         area.DocId = this.selectOrgDocument.SelectedOrgDocument.Id;
         area.Created = System.DateTime.Today;
         area.SaveChanges();
     }
 }
コード例 #2
0
 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();
     }
 }
コード例 #3
0
 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();
         }
     }
 }