/// <summary> /// Handles the Validated event for the TextBoxCellAreaCalc text box /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// If we are just refreshing the data, or the text has not really changed, /// then we don't want to do anything during this event. /// </remarks> private void TextBoxCellAreaCalc_Validated(object sender, EventArgs e) { if (this.m_InRefresh) { return; } if (!this.m_CellAreaCalcHasChanges) { return; } //Save the CellArea value DataSheet ds = this.DataFeed.GetDataSheet(Strings.DATASHEET_SPPIC_NAME); DataRow dr = ds.GetDataRow(); if (dr == null) { ds.BeginAddRows(); dr = ds.GetData().NewRow(); ds.GetData().Rows.Add(dr); ds.EndAddRows(); } ds.BeginModifyRows(); double cellArea = 0; if (double.TryParse(this.TextBoxCellAreaCalc.Text, out cellArea)) { dr[Strings.DATASHEET_SPPIC_CELL_AREA_COLUMN_NAME] = cellArea; } else { dr[Strings.DATASHEET_SPPIC_CELL_AREA_COLUMN_NAME] = DBNull.Value; } ds.EndModifyRows(); RefreshCalculatedValues(); this.m_CellAreaCalcHasChanges = false; }
public override void DeleteRows(IEnumerable <DataRow> rows) { DataSheet dssa = this.Project.GetDataSheet(Strings.DATASHEET_STATE_ATTRIBUTE_TYPE_NAME); DataSheet dsta = this.Project.GetDataSheet(Strings.DATASHEET_TRANSITION_ATTRIBUTE_TYPE_NAME); dssa.BeginModifyRows(); dsta.BeginModifyRows(); foreach (DataRow ParentRow in rows) { int GroupId = Convert.ToInt32(ParentRow[this.PrimaryKeyColumn.Name], CultureInfo.InvariantCulture); FixupChildReferences(dssa, GroupId); FixupChildReferences(dsta, GroupId); } dssa.EndModifyRows(); dsta.EndModifyRows(); base.DeleteRows(rows); }
private void ButtonBrowse_Click(object sender, System.EventArgs e) { string RasterFile = RasterUtilities.ChooseRasterFileName("Digital Elevation Model File", this); if (RasterFile == null) { return; } using (HourGlass h = new HourGlass()) { DataSheet ds = this.GetDataSheet(); DataRow dr = ds.GetDataRow(); string RasterFileName = Path.GetFileName(RasterFile); if (dr == null) { dr = ds.GetData().NewRow(); ds.BeginAddRows(); dr[Strings.DATASHEET_DIGITAL_ELEVATION_MODEL_FILE_NAME_COLUMN_NAME] = RasterFileName; ds.GetData().Rows.Add(dr); ds.EndAddRows(); } else { ds.BeginModifyRows(); dr[Strings.DATASHEET_DIGITAL_ELEVATION_MODEL_FILE_NAME_COLUMN_NAME] = RasterFileName; ds.EndModifyRows(); } ds.AddExternalInputFile(RasterFile); this.RefreshControls(); this.EnableButtons(); } }