Пример #1
0
        ///<summary>Handle the Cubicle.DragDone event</summary>
        void mapAreaControl_DragDone(object sender, EventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            Control asControl     = null;
            MapArea clinicMapItem = null;

            if (sender is MapAreaRoomControl)
            {
                asControl     = (Control)sender;
                clinicMapItem = ((MapAreaRoomControl)sender).MapAreaItem;
            }
            else if (sender is MapAreaDisplayLabelControl)
            {
                asControl     = (Control)sender;
                clinicMapItem = ((MapAreaDisplayLabelControl)sender).MapAreaItem;
            }
            else
            {
                return;
            }
            //recalculate XPos and YPos based on new location in the panel
            PointF xy = ConvertScreenLocationToXY(asControl.Location, PixelsPerFoot);

            clinicMapItem.XPos = Math.Round(xy.X, 3);
            clinicMapItem.YPos = Math.Round(xy.Y, 3);
            //save new cubicle location to db
            MapAreas.Update(clinicMapItem);
            //alert the parent
            mapAreaControl_Changed(sender, new EventArgs());
        }
Пример #2
0
 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);
     }
 }