예제 #1
0
        private void frmPlot_Load(object sender, EventArgs e)
        {
            ReloadPlots();

            cbxPlotType.DataSource = cbxBindingSource;

            DAL.DAL          db            = new DAL.DAL();
            List <HouseType> lstHouseTypes = db.GetAllHouseTypes();

            cbxPlotType.SelectedIndex   = -1;
            cbxBindingSource.DataSource = lstHouseTypes;
            cbxPlotType.DisplayMember   = "HsType";
            cbxPlotType.ValueMember     = "ID";

            if (selectedPlotID != 0)
            {
                int rowIndex = -1;

                DataGridViewRow row = dgPlots.Rows
                                      .Cast <DataGridViewRow>()
                                      .Where(r => r.Cells[0].Value.ToString().Equals(selectedPlotID.ToString()))
                                      .First();

                rowIndex = row.Index;

                if (rowIndex > -1)
                {
                    dgPlots.Rows[rowIndex].Selected = true;
                    dgPlots.CurrentCell             = dgPlots.Rows[rowIndex].Cells[0];
                    PopulatePlotDetails();
                }
            }
        }
예제 #2
0
        private List <HouseType> GetHouseTypes()
        {
            DAL.DAL          db            = new DAL.DAL();
            List <HouseType> lstHouseTypes = db.GetAllHouseTypes();

            return(lstHouseTypes);
        }