private void AddStudentButt_Click(object sender, EventArgs e) { GdpDrive Gdp = new GdpDrive(); Searcher SER = new Searcher(); SER.TableName = "participant"; SER.idField.Add("PID"); SER.idData.Add(studentInfoGrid.Rows[0].Cells[0].Value); SER.Fields.Add("PID"); Gdp.Query(ref SER); if (SER.array.Count > 0) { MessageBox.Show("该学生已存在!"); return; } List <dynamic> values = new List <dynamic>(); for (int i = 0; i < 5; i++) { values.Add(studentInfoGrid.Rows[0].Cells[i].Value); } Gdp.AddTableRecord("participant", values); MessageBox.Show("添加成功!"); }
private void signUpButt_Click(object sender, EventArgs e) { // 选择地图上的学校,点击报名 if (signUpGrid.Rows[0].Cells[0].Value == null) { MessageBox.Show("请选择学校"); } else { string PTID = logForm.textBox_User.Text; string TTID = Convert.ToString(signUpGrid.Rows[0].Cells[0].Value); Searcher pJudge = new Searcher(); pJudge.TableName = "PANexus"; pJudge.idField.Add("PID"); pJudge.idData.Add(PTID); pJudge.idField.Add("TID"); pJudge.idData.Add(TTID); pJudge.Fields.Add("TID"); GdpDrive Gdp = new GdpDrive(); Gdp.Query(ref pJudge); if (pJudge.array.Count > 0) { MessageBox.Show("请勿重复报名!"); return; } Gdp.AddTableRecord("PANexus", pJudge.idData); MessageBox.Show("报名成功!"); } }
private bool UserJudge(UserLog User) { Searcher ER = new Searcher(); switch (flag) { case 2: ER.TableName = "participant"; ER.idField.Add("PID"); break; case 3: ER.TableName = "organizer"; ER.idField.Add("OID"); break; default: ER.TableName = "Admin"; ER.idField.Add("AID"); break; } ER.idField.Add("PassWord"); ER.idData.Add(User.name); ER.idData.Add(User.password); ER.Fields.Add("PassWord"); GdpDrive Gdp = new GdpDrive(); Gdp.Query(ref ER); if (ER.array.Count > 0) { return(true); } else { return(false); } }
private void AddProButt_Click(object sender, EventArgs e) { GdpDrive Gdp = new GdpDrive(); Searcher SER = new Searcher(); List <dynamic> values = new List <dynamic>(); if (SiteID < 0) { MessageBox.Show("未选中活动点!"); return; } SER.TableName = "SANexus"; SER.idField.Add("SID"); SER.idData.Add(SiteID); SER.Fields.Add("TID"); Gdp.Query(ref SER); if (SER.array.Count > 0) { MessageBox.Show("该地已有活动!"); return; } SER.idField[0] = "TID"; SER.idData[0] = Convert.ToString(proInfoGrid.Rows[0].Cells[0].Value); Gdp.Query(ref SER); if (SER.array.Count > 0) { MessageBox.Show("该活动ID已存在!"); return; } DialogResult dr = MessageBox.Show("请确认日期格式如2008-8-8!", "警告", MessageBoxButtons.OKCancel); if (dr == DialogResult.Cancel) { return; } values.Clear(); for (int i = 0; i < 5; i++) { values.Add(proInfoGrid.Rows[0].Cells[i].Value); } try { Gdp.AddTableRecord("Activity", values); } catch { MessageBox.Show("日期格式有误!"); return; } values.Clear(); values.Add(proInfoGrid.Rows[0].Cells[0].Value); values.Add(SiteID); Gdp.AddTableRecord("SANexus", values); values.Clear(); values.Add(logForm.textBox_User.Text); values.Add(proInfoGrid.Rows[0].Cells[0].Value); Gdp.AddTableRecord("OANexus", values); }
// 在地图上点击学校,获取支教信息 private void axMapControl_Main_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e) { // 选择学校 IMap pMap = axMapControl_Main.Map; IEnumLayer pEnumLayer = pMap.get_Layers(null, true); pEnumLayer.Reset(); ILayer pLayer = pEnumLayer.Next(); IFeatureLayer pFeatureLayer; while (pLayer != null) { if (pLayer.Name == "china") { pFeatureLayer = (IFeatureLayer)pLayer; pFeatureLayer.Selectable = false; } pLayer = pEnumLayer.Next(); } IGeometry selectGeometry = null; IEnvelope pEnv; IActiveView pActiveView = axMapControl_Main.ActiveView; pEnv = axMapControl_Main.TrackRectangle(); if (pEnv.IsEmpty == true) { ESRI.ArcGIS.esriSystem.tagRECT r; r.bottom = e.y + 5; r.top = e.y - 5; r.left = e.x - 5; r.right = e.x + 5; pActiveView.ScreenDisplay.DisplayTransformation.TransformRect(pEnv, ref r, 4); pEnv.SpatialReference = pActiveView.FocusMap.SpatialReference; } selectGeometry = pEnv as IGeometry; axMapControl_Main.Map.ClearSelection(); axMapControl_Main.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); axMapControl_Main.Map.SelectByShape(selectGeometry, null, false); axMapControl_Main.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); // 显示信息 ISelection pselect = pMap.FeatureSelection; IEnumFeatureSetup pEnumFeatureSetup = (IEnumFeatureSetup)pselect; pEnumFeatureSetup.AllFields = true; IEnumFeature pEnumFeature = (IEnumFeature)pEnumFeatureSetup; //pEnumFeature.Reset(); pfeature = pEnumFeature.Next(); if (pfeature == null) { return; } SiteID = pfeature.get_Value(0); GdpDrive Gdp = new GdpDrive(); Searcher GDs = new Searcher(); GDs.TableName = "SANexus"; GDs.idField.Add("SID"); GDs.idData.Add(SiteID); GDs.Fields.Add("TID"); Gdp.Query(ref GDs); if (GDs.array.Count < 1) { MessageBox.Show("该地区无支教活动!"); return; } LookUp(GDs.array[0][0]); //resultGrid.Rows[0].Cells[0].Value = name; //signUpGrid.Rows[0].Cells[0].Value = pfeature.get_Value(2).ToString(); }
List <List <dynamic> > ActivityQuery(string TID) { List <List <dynamic> > AR = new List <List <dynamic> >(); Searcher ER = new Searcher(); if (TID != null) { ER.idField.Add("TID"); ER.idData.Add(TID); } ER.TableName = "Activity"; ER.Fields.Add("ActName"); ER.Fields.Add("ActStart"); ER.Fields.Add("ActEnd"); ER.Fields.Add("Describe"); ER.Fields.Add("TID"); Gdp.Query(ref ER); if (ER.array.Count < 1) { return(null); } Searcher ERs = new Searcher(); Searcher ERo = new Searcher(); Searcher ERg = new Searcher(); Searcher ERa = new Searcher(); for (int i = 0; i < ER.array.Count; i++) { //获取地点编号 ERa.TableName = "SANexus"; ERa.idField.Clear(); ERa.idField.Add("TID"); ERa.idData.Clear(); ERa.idData.Add(ER.array[i][4]); ERa.Fields.Clear(); ERa.Fields.Add("SID"); ERa.array.Clear(); Gdp.Query(ref ERa); //获取地点名称 ERs.TableName = "site"; ERs.idField.Clear(); ERs.idField.Add("OBJECTID"); ERs.idData.Clear(); ERs.idData.Add(ERa.array[0][0]); ERs.Fields.Clear(); ERs.Fields.Add("Name"); ERs.array.Clear(); Gdp.Query(ref ERs); //根据活动信息中的TID,查询对应的OID; ERo.TableName = "OANexus"; ERo.idField.Clear(); ERo.idField.Add("TID"); ERo.idData.Clear(); ERo.idData.Add(ER.array[i][4]); ERo.Fields.Clear(); ERo.Fields.Add("OID"); ERo.array.Clear(); Gdp.Query(ref ERo); //根据查询到的OID,获取组织名称 ERg.TableName = "organizer"; ERg.idField.Clear(); ERg.idField.Add("OID"); ERg.idData.Clear(); ERg.idData.Add(ERo.array[0][0]); ERg.Fields.Clear(); ERg.Fields.Add("FullName"); ERg.array.Clear(); Gdp.Query(ref ERg); List <dynamic> ar = new List <dynamic>(); ar.Add(ER.array[i][4]); ar.Add(ER.array[i][0]); ar.Add(ERg.array[0][0]); ar.Add(ERs.array[0][0]); ar.Add(ER.array[i][2]); ar.Add(ER.array[i][3]); ar.Add(ER.array[i][4]); AR.Add(ar); } return(AR); }