private void CreateNewSpace(Dictionary<string, string> dict) { //If room already exists, give an message foreach (var spaceCompare in dbc.DataSet.space) { if (spaceCompare.space_number == dict["Total"]) { //Found a duplicate -> quit MessageBox.Show("Het lokaal, " + dict["Total"] + ", is al in gebruik. Kies graag het lokaal in uit de lijst."); space = null; return; } } //Multiplies Length and Width by 100 to convert Meters to Centimeters space = new Space(dict["Total"], dict["Floor"], dict["Building"], dict["Room"], (int)(Double.Parse(dict["Length"])*100), (int)(Double.Parse(dict["Width"])*100), false); //To the database SaveNewSpace(space); //Message to the user MessageBox.Show(space.ToString(), "U heeft een nieuwe ruimte aangemaakt."); }
private void SaveNewSpace(Space space) { //Add Space to database DataRow anyRow = dbc.DataSet.space.NewRow(); anyRow["space_number"] = space.Room; anyRow["floor"] = space.Floor; anyRow["building"] = space.Building; anyRow["roomnumber"] = space.Roomnumber; anyRow["final"] = space.Final; anyRow["length"] = space.Length; anyRow["width"] = space.Width; dbc.DataSet.space.Rows.Add(anyRow); dbc.SpaceTableAdapter.Update(dbc.DataSet.space); }
public void OpenPanel(Space spacenr) { PlacementController.placedProductList.Clear(); hoofdscherm.placement.space = spacenr; //this.SpaceNumberTitle.Text = space.Room; this.SpaceNumberTextbox.Text = space.Room; this.SpaceDimensionsTextbox.Text = space.Length + " + " + space.Width; hoofdscherm.Size = new Size(1150, 750); hoofdscherm.MinimumSize = new Size(1100, 720); hoofdscherm.placement.Visible = true; hoofdscherm.placement.Enabled = true; //Update the data (size and colour of the PlacedProduct, information of the ProductList and ProductInfo) hoofdscherm.placement.fixData(); hoofdscherm.placement.controller.placeProducts(); hoofdscherm.placement.BringToFront(); }
//Activate when a new space is being made public void NewSpace() { SpaceInfoDialog spaceInfoDialog = new SpaceInfoDialog(); spaceInfoDialog.ShowDialog(); switch (spaceInfoDialog.DialogResult) { case DialogResult.Yes: CreateNewSpace(spaceInfoDialog.SpaceInfo); break; case DialogResult.OK: CreateNewSpace(spaceInfoDialog.SpaceInfo); space = null; break; default: space = null; break; } //Dispose after use spaceInfoDialog.Dispose(); }
//all spaces are collected from the database public void GetSpaces_FromDatabase() { foreach (var space in this.DataSet.space) { var s1 = new Space(space.space_number, space.floor, space.building, space.roomnumber,space.length,space.width,space.final); } }
public void OpenPanel(Space space) { throw new NotImplementedException(); }
public void OpenPanel(Space spacenr) { placedProducts.Clear(); PlacedProduct.List.Clear(); PlacedProduct.StaticList.Clear(); ProductGrid grid = (ProductGrid) view; space = spacenr; //this.SpaceNumberTitle.Text = space.Room; grid.spaceNumberTextbox.Text = space.Room; grid.spaceSizeTextbox.Text = space.Length + " + " + space.Width; meterWidth = (float) space.Width/100; meterHeight = (float) space.Length/100; tileSize = meterWidth/10; if (spacenr.Final) { ((ProductList)grid.Get(ProductGrid.PropertyEnum.List)).LockRoom(); } else { ((ProductList)grid.Get(ProductGrid.PropertyEnum.List)).UnlockRoom(); } LayoutChanged(this, null); //Update the data (size and colour of the PlacedProduct, information of the ProductList and ProductInfo) PlaceProducts(); grid.Invalidate(); grid.BringToFront(); }