private void button2_Click(object sender, EventArgs e) { try { string station_name = textBox2.Text; string station_code = textBox3.Text; string thequery = "INSERT INTO stations (st_name, st_code) VALUES ('" + station_name + "','" + station_code + "')"; con_db adduser = new con_db(); if (adduser.Insert(thequery)) { MessageBox.Show("Station added successfully"); globals.Clearallboxes(this); listView1.Items.Clear(); Getallstations(); } else { MessageBox.Show("Station add failed!!"); } } catch { MessageBox.Show("An Error occured please contact the system administrator"); } }
private void button2_Click(object sender, EventArgs e) { try { string username = textusrername.Text; string password = textpassword.Text; string phone = textphone.Text; string dob = dateTimedob.Text; string gender = combogender.Text; string email = textemail.Text; string thequery = ""; //= "INSERT INTO admns (admName, admPass,phone,dob,gender,email) VALUES ('"+username+"','"+password +"','"+phone+"','"+dob+"','"+gender+"','"+email+"')"; if ((textpassword.Text == textverify.Text) && (textpassword.Text != "")) { if (comboaccess.Text == "Administrator") { thequery = "INSERT INTO admns (usrname, usrpswrd,phone,dob,gender,email) VALUES ('" + username + "','" + password + "','" + phone + "','" + dob + "','" + gender + "','" + email + "')"; } else if (comboaccess.Text == "General User") { thequery = "INSERT INTO gnrlusers (usrname, usrpswrd,email,phone,gender,dob) VALUES ('" + username + "','" + password + "','" + email + "','" + phone + "','" + gender + "','" + dob + "')"; } else { labelcantuser.Visible = true; } con_db adduser = new con_db(); if (adduser.Insert(thequery)) { MessageBox.Show("User added successfully"); globals.Clearallboxes(this); } else { MessageBox.Show("User add failed!!"); } } else { labelcantuser.Text = "Passwords Do Not Match Please Verify Your Password"; labelcantuser.Visible = true; } } catch { MessageBox.Show("An Error occured please contact the system administrator"); } }
private void button2_Click(object sender, EventArgs e) { try { con_db qrychart = new con_db(); int size = upload.mystackx.Count; MessageBox.Show("size is " + size); //testing for (int i = 0; i < size; i++) { string sql = "INSERT INTO coordinates (chart_number, actualcoord) VALUES ('" + globals.chartnumber + "',GeomFromText('POINT(" + upload.mystackx.Pop() + " " + upload.mystacky.Pop() + ")'))"; qrychart.Insert(sql); MessageBox.Show("Popped point " + upload.mystackx.Pop() + "," + upload.mystacky.Pop()); //Testing point entry } MessageBox.Show("Success!!!"); Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/* public void Control_KeyUp(object sender, KeyEventArgs e) * { * if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) * { * this.SelectNextControl((Control)sender, true, true, true, true); * } * * }*/ private void button1_Click(object sender, EventArgs e) { try { if (get_indices()) { if (radioApendNo.Checked == true) { string season = comboBox1.SelectedText.ToString(); int chartno = int.Parse(textBox1.Text); // int chartduration = int.Parse(textBox4.Text); var dateon = dateTimePicker1.Value.ToString("yyyy/MM/dd"); var dateoff = dateTimePicker2.Value.ToString("yyyy/MM/dd"); var datedigitzed = System.DateTime.Now; // var range = comboBox2.SelectedText; con_db newentry = new con_db(); string sql = "INSERT INTO charts (chart_number,date_digitized,date_on,date_off,season,st_code) VALUES ('" + chartno + "','" + datedigitzed + "','" + dateon + "','" + dateoff + "','" + season + "','" + globals.stationcode + "')"; if (newentry.Insert(sql)) { globals.chartnumber = chartno; globals.x_date = dateon; Hide(); upload newform = new upload(); newform.ShowDialog(); Show(); globals.Clearallboxes(this); } else { MessageBox.Show("data not updated"); } } else if (radioApendYes.Checked == true) { int chartno = int.Parse(textBox3.Text); string sql = "SELECT * FROM charts WHERE chart_number ='" + chartno + "'AND st_code ='" + globals.stationcode + "'"; con_db newentry = new con_db(); if (newentry.SelectVerifyStation(sql)) { globals.chartnumber = chartno; Hide(); upload newform = new upload(); newform.ShowDialog(); Show(); } else { labelcantappend.Text = "Can not find chart to append"; labelcantappend.Visible = true; textBox3.Focus(); textBox3.SelectAll(); } } } } catch (Exception ex) { MessageBox.Show("" + ex.Message); } }