Ejemplo n.º 1
0
        private void wallsGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var ws      = (WallSize)wallsGrid.SelectedRows[0].DataBoundItem;
            var ws_edit = new WallSize {
                Height = ws.Height, Length = ws.Length, NumberOfWalls = ws.NumberOfWalls
            };

            switch (e.ColumnIndex)
            {
            //walls edit
            case 3:
                using (var frm = new WallAddEditForm(ws_edit))
                {
                    frm.Theme = this.Theme;
                    frm.Style = this.Style;
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        ws.Height        = ws_edit.Height;
                        ws.Length        = ws_edit.Length;
                        ws.NumberOfWalls = ws_edit.NumberOfWalls;
                        wallsGrid.Refresh();
                    }
                }
                break;

            //walls delete
            case 4:
                db.WallSizes.Remove(ws);
                wallSizeBindingSource.Remove(ws);
                wallsGrid.Refresh();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
 public WallAddEditForm(WallSize obj)
 {
     InitializeComponent();
     WallSizeInfo = obj;
     wallSizeBindingSource.DataSource = WallSizeInfo;
 }