private void butOK_Click(object sender, EventArgs e) { try { if (PIn.Double(textBoxXPos.Text) < 0) { textBoxXPos.Focus(); MessageBox.Show(Lan.g(this, "Invalid XPos")); return; } if (PIn.Double(textBoxYPos.Text) < 0) { textBoxYPos.Focus(); MessageBox.Show(Lan.g(this, "Invalid YPos")); return; } if (PIn.Double(textBoxWidthFeet.Text) <= 0) { textBoxWidthFeet.Focus(); MessageBox.Show(Lan.g(this, "Invalid Width")); return; } if (PIn.Double(textBoxHeightFeet.Text) <= 0) { textBoxHeightFeet.Focus(); MessageBox.Show(Lan.g(this, "Invalid Height")); return; } if (PIn.Int(textBoxExtension.Text) < 0) { textBoxExtension.Focus(); MessageBox.Show(Lan.g(this, "Invalid Extension")); return; } if (MapItem.ItemType == MapItemType.DisplayLabel && PIn.String(textBoxDescription.Text) == "") { textBoxDescription.Focus(); MessageBox.Show(Lan.g(this, "Invalid Text")); return; } MapItem.Extension = PIn.Int(textBoxExtension.Text); MapItem.XPos = PIn.Double(textBoxXPos.Text); MapItem.YPos = PIn.Double(textBoxYPos.Text); MapItem.Width = PIn.Double(textBoxWidthFeet.Text); MapItem.Height = PIn.Double(textBoxHeightFeet.Text); MapItem.Description = PIn.String(textBoxDescription.Text); if (MapItem.IsNew) { MapAreas.Insert(MapItem); } else { MapAreas.Update(MapItem); } DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void butBuildFromPhoneTable_Click(object sender, EventArgs e) { if (MessageBox.Show("This action will clear all information from clinicmapitem table and recreated it from current phone table rows. Would you like to continue?", "", MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes) { return; } mapAreaPanel.Clear(true); List <Phone> phones = Phones.GetPhoneList(); int defaultSizeFeet = 6; int row = 1; int column = 0; for (int i = 0; i < 78; i++) { if (row >= 7) { if (++column > 8) { column = 3; row++; } } else { if (++column > 10) { column = 1; row++; } if (row == 7) { column = 3; //row=8; } } //Phone phone=phones[i]; MapArea clinicMapItem = new MapArea(); clinicMapItem.Description = ""; clinicMapItem.Extension = i; //phone.Extension; clinicMapItem.Width = defaultSizeFeet; clinicMapItem.Height = defaultSizeFeet; clinicMapItem.XPos = (1 * column) + ((column - 1) * defaultSizeFeet); clinicMapItem.YPos = 1 + ((row - 1) * defaultSizeFeet); mapAreaPanel.AddCubicle(clinicMapItem); MapAreas.Insert(clinicMapItem); } }