private void btn_AddLocation_Click(object sender, EventArgs e) { frm_AddLocation frm = new frm_AddLocation(); frm.ShowDialog(); locationID = frm.locID; UpdateFields(); }
private void btn_addLocation_Click(object sender, EventArgs e) { frm_AddLocation frm = new frm_AddLocation(); frm.ShowDialog(); Loc = frm.locID; txt_Location.Text = Loc.ToLocationString(); }
public static bool IsValidLocation(DatabaseHelper.LocationStruct str) { if (str.postCode > 0 && !string.IsNullOrEmpty(str.city) && !string.IsNullOrEmpty(str.address)) { return(true); } else { return(false); } }
private void btn_addLocation_Click(object sender, EventArgs e) { frm_AddLocation frm = new frm_AddLocation(); frm.ShowDialog(); Loc = frm.locID; txt_Location.Text = Loc.ToLocationString(); //foreach (DataRow row in DatabaseHelper.GetTable("Location", null, null, true).Rows) //{ // if (row["Location ID"].ToString() == Location.ToString()) // txt_Location.Text = row["Address"].ToString() + ", " + row["City"].ToString(); //} }
public frm_AddOffice(DatabaseHelper.LocationStruct str) { InitializeComponent(); this.locationID = str; if (DatabaseHelper.IsValidLocation(locationID)) { txt_Location.Text = locationID.ToLocationString(); } //foreach (DataRow row in DatabaseHelper.GetTable("Location").Rows) //{ // if (row["Location ID"].ToString() == locationID.ToString()) // { // txt_Location.Text = row["Address"].ToString() + ", " + row["City"].ToString() + ", " + // row["Postcode"]; // btn_AddLocation.Enabled = false; // } //} }
private void SetLocation() { LocationStruct loc = new LocationStruct(int.Parse(txt_Postcode.Text), txt_Address.Text, txt_City.Text); if (locCmbRelationship.ContainsKey(loc)) { MessageBox.Show("This location already exists. Please use the dropdown box to select this pre-existing location"); } else { locID = loc; } //string query = string.Format("INSERT INTO Location(Postcode,City, Address) VALUES ({0},'{1}','{2}')", int.Parse(txt_Postcode.Text), txt_City.Text, txt_Address.Text); //OleDbDataReader reader = DatabaseHelper.ExecuteQuery(query); //DataTable tbl = DatabaseHelper.GetTable("Location", null, null, true); //foreach (DataRow row in tbl.Rows) //{ // if (row["Address"].ToString() == txt_Address.Text) // locID = int.Parse(row["Location ID"].ToString()); //} Close(); }
private void btn_prexistingLocation_Click(object sender, EventArgs e) { locID = locCmbRelationship.FirstOrDefault(x => x.Value == cmb_Location.SelectedIndex).Key; Close(); }