private void execRefRegion(string sPoints) { m2mMapPath path = new m2mMapPath(this.preType) { PathDot = sPoints }; if (this.isModify) { path.PathId = (this.cmbRegion.SelectedItem as DataRowView)["RegionId"].ToString(); path.PathName = (this.cmbRegion.SelectedItem as DataRowView)["RegionName"].ToString(); path.PathGroupID = (this.cmbRegion.SelectedItem as DataRowView)["pathGroupID"].ToString(); path.IsUpdate = true; } if ((path.ShowDialog() == DialogResult.OK) && this.pnlRegion.Visible) { DataTable dataSource = (DataTable)this.cmbRegion.DataSource; if (this.isModify) { DataRow row = dataSource.Rows.Find(path.PathId); if (row != null) { row["RegionDot"] = path.PathDot; row["RegionName"] = path.PathName; row["pathGroupID"] = path.PathGroupID; } this.btnModifyRegion_Click(null, null); } else { DataRow row2 = dataSource.NewRow(); row2["regionID"] = path.PathId; row2["regionName"] = path.PathName; row2["regionDot"] = path.PathDot; row2["pathGroupID"] = path.PathGroupID; dataSource.Rows.Add(row2); this.cmbRegion.SelectedIndex = this.cmbRegion.Items.Count - 1; } } }
private void execRefRegion(string sPoints) { m2mMapPath path = new m2mMapPath(this.preType) { PathDot = sPoints }; if (this.isModify) { path.PathId = (this.cmbRegion.SelectedItem as DataRowView)["RegionId"].ToString(); path.PathName = (this.cmbRegion.SelectedItem as DataRowView)["RegionName"].ToString(); path.PathGroupID = (this.cmbRegion.SelectedItem as DataRowView)["pathGroupID"].ToString(); path.IsUpdate = true; } if ((path.ShowDialog() == DialogResult.OK) && this.pnlRegion.Visible) { DataTable dataSource = (DataTable) this.cmbRegion.DataSource; if (this.isModify) { DataRow row = dataSource.Rows.Find(path.PathId); if (row != null) { row["RegionDot"] = path.PathDot; row["RegionName"] = path.PathName; row["pathGroupID"] = path.PathGroupID; } this.btnModifyRegion_Click(null, null); } else { DataRow row2 = dataSource.NewRow(); row2["regionID"] = path.PathId; row2["regionName"] = path.PathName; row2["regionDot"] = path.PathDot; row2["pathGroupID"] = path.PathGroupID; dataSource.Rows.Add(row2); this.cmbRegion.SelectedIndex = this.cmbRegion.Items.Count - 1; } } }