Esempio n. 1
0
        private void btn_AddLocation_Click(object sender, EventArgs e)
        {
            frm_AddLocation frm = new frm_AddLocation();

            frm.ShowDialog();
            locationID = frm.locID;
            UpdateFields();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
 public static bool IsValidLocation(DatabaseHelper.LocationStruct str)
 {
     if (str.postCode > 0 && !string.IsNullOrEmpty(str.city) && !string.IsNullOrEmpty(str.address))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 4
0
        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();
            //}
        }
Esempio n. 5
0
 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;
     //    }
     //}
 }
Esempio n. 6
0
        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();
        }
Esempio n. 7
0
 private void btn_prexistingLocation_Click(object sender, EventArgs e)
 {
     locID = locCmbRelationship.FirstOrDefault(x => x.Value == cmb_Location.SelectedIndex).Key;
     Close();
 }