Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Location           temp = new Location();
            frmLocationDetails frm  = new frmLocationDetails(ref temp, true);

            Utils.ShowForm(this, frm, dgvLocation, () =>
            {
                //Refresh list
                locations = Loc.Select();
                loc       = new AggregatedPropertyBindingList <Loc>(locations);
                dgvLocation.DataSource = loc;
            });
        }
Exemple #2
0
        private void dgvLocation_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int      id   = (int)dgvLocation.Rows[e.RowIndex].Cells["Id"].Value;
            Location temp = null;
            var      q    = from c in locations where c.Id == id select c;

            temp = q.First();

            frmLocationDetails frm = new frmLocationDetails(ref temp);

            Utils.ShowForm(this, frm, dgvLocation, () =>
            {
                //Refresh list
                locations = Loc.Select();
                loc       = new AggregatedPropertyBindingList <Loc>(locations);
                dgvLocation.DataSource = loc;
            });
        }
Exemple #3
0
        public frmLocation()
        {
            InitializeComponent();
            CenterToScreen();
            this.locations = Loc.Select();
            dgvLocation.AutoGenerateColumns = false;
            //BindingList<Location> list = new BindingList<Location>(tempLocation);
            dgvLocation.Columns.Add("Id", "Id");
            dgvLocation.Columns["Id"].DataPropertyName = "Id";

            dgvLocation.Columns.Add("HouseNumber", "House Number");
            dgvLocation.Columns["HouseNumber"].DataPropertyName = "HouseNumber";

            dgvLocation.Columns.Add("StreetName", "Street Name");
            dgvLocation.Columns["StreetName"].DataPropertyName = "Street->Name";

            dgvLocation.Columns.Add("CityName", "City");
            dgvLocation.Columns["CityName"].DataPropertyName = "Street->City->Name";

            loc = new AggregatedPropertyBindingList <Location>(locations);

            dgvLocation.DataSource = loc;
        }