/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEdit_Click(object sender, System.EventArgs e) { int row = dataGridGPRSStation.CurrentRowIndex; if (row == -1) { return; } int id = int.Parse(dataGridGPRSStation[row, 0].ToString()); string name = dataGridGPRSStation[row, 1].ToString(); string team = dataGridGPRSStation[row, 2].ToString(); string addDrag = dataGridGPRSStation[row, 3].ToString(); float area = GetArea(dataGridGPRSStation[row, 4].ToString()); //int.Parse ( dataGridGPRSStation[ row, 4 ].ToString() ); string ip = dataGridGPRSStation[row, 5].ToString(); int grAddr = int.Parse(dataGridGPRSStation[row, 6].ToString()); int xgAddr = int.Parse(dataGridGPRSStation[row, 7].ToString()); string serverIP = dataGridGPRSStation[row, 8].ToString(); string remark = dataGridGPRSStation[row, 9].ToString(); //frmXGStationItem f = new frmXGStationItem(); frmGprsStationItem f = new frmGprsStationItem(); f.AdeState = ADEState.Edit; f.EditId = id; f.StationName = name; f.IpAddress = ip; f.GrAddress = grAddr; f.XgAddress = xgAddr; f.Remark = remark; f.Team = team; f.Area = area; f.AddDrug = addDrag; f.ServerIpAddress = serverIP; if (f.ShowDialog(this) == DialogResult.OK) { // edit gprs station // int grId, xgId; // get grstaion id // bool b = getGrXgID(id, out grId, out xgId); System.Diagnostics.Debug.Assert(b, "read gr xg id"); // update grstation name graddress with id // XGDB.UpdateGrStation(grId, f.StationName, grAddr); // get xgstation id // // update xgstation name xgaddress with xgid // XGDB.UpdateXGStation(xgId, f.StationName, xgAddr); // update gprs station name, ip ,commport, remark ,client // XGDB.UpdateGprsStation(id, f.StationName, f.IpAddress, f.Remark, f.Team, f.AddDrug, f.Area, f.ServerIpAddress, this.GetTeamOrder(f.Team)); LoadXGStationFromDB(); } }