private void DeleteButton_Click(object sender, EventArgs e) { // check authentication GPLC.Auth(GPLCAuthority.Administrator); ModelUtil.deleteProject((marker as ProjectMarker).ProjectData.id); //refresh map GPLC.Refresh(); this.Parent.Dispose(); }
private void InputButton_Click(object sender, EventArgs e) { try { // parse long id = long.Parse(textBox_project_id.Text); string name = textBox_project_Name.Text.Trim(); string addr = richTextBox_project_addr.Text.Trim(); double lat = double.Parse(textBox_latlng_lat.Text.Trim()); double lng = double.Parse(textBox_latlng_lng.Text.Trim()); // check name if (name.Length < 4) { throw new FormatException("Name長度必須超過4"); } // check latlng if (lat > 90 || lat < -90 || lng > 180 || lat < -180) { throw new FormatException("Latlng value out of bound"); } // check authentication GPLC.Auth(GPLCAuthority.Administrator); // update database if (InputButton.Text.Equals("Modify")) { long oid = (marker as ProjectMarker).ProjectData.id; ModelUtil.updateProject(id, name, addr, lat, lng, oid); } else { ModelUtil.insertProject(id, name, addr, lat, lng); } //refresh map GPLC.Refresh(); this.Parent.Dispose(); } catch (FormatException ex) { label_info.Text = ex.Message; } catch (UnauthorizedException ex) { MessageBox.Show(ex.Message, "Fatal Error"); Application.Exit(); } }