public bool compare(MainRoad mainRoad) { if (mrID != mainRoad.id) return false; if (prID != mainRoad.programID) return false; if (mrName != mainRoad.name) return false; if (mrPath != mainRoad.path) return false; return true; }
public bool isDirty() { foreach (MainRoad mainRoad in mainRoadList) { if (mainRoad.needDelete) return true; } ObservableCollection<MainRoad> tempMainRoadList = program.getAllRelatedMainRoad(); if (tempMainRoadList == null) tempMainRoadList = new ObservableCollection<MainRoad>(); if (tempMainRoadList.Count != mainRoadList.Count) return true; foreach (MainRoad mainRoad in mainRoadList) { int mainRoadID = mainRoad.id; MainRoad mainRoadCopy = new MainRoad(); mainRoadCopy.id = mainRoadID; mainRoadCopy.select(); if (!mainRoad.compare(mainRoadCopy)) return true; } return false; }
private void AddMainRoadButtonClick(object sender, RoutedEventArgs e) { MainRoad mainRoad = new MainRoad(); mainRoad.programID = program.id; mainRoadList.Add(mainRoad); //把左栏遮盖, 让用户在右侧画线. mainWindow.mask(); mapControlMouseDown = delegate(object sender2, IMapControlEvents2_OnMouseDownEvent e2) { GisUtil.ResetToolbarControl(toolbarControl); onMapControlMouseDown(); return true; }; }
public ObservableCollection<MainRoad> getAllRelatedMainRoad() { if (!isValid(new List<string>() { "prName", "pID" })) return null; ObservableCollection<MainRoad> mainRoadList = new ObservableCollection<MainRoad>(); string sqlCommand = String.Format(@"select mrID from MainRoad where prID={0}", prID); Sql sql = new Sql(); SqlDataReader reader = sql.selectAllMainRoadIDByPrID(sqlCommand); if (reader.HasRows) { while (reader.Read()) { int mrID = Int32.Parse(reader[0].ToString()); MainRoad mainRoad = new MainRoad(); mainRoad.id = mrID; mainRoad.select(); mainRoadList.Add(mainRoad); } sql.closeConnection(); return mainRoadList; } else { sql.closeConnection(); return null; } }