private void SetControlLocation()
        {
            PermitMoving moving = Permit.LoadLastMoving(Database);

            if (moving == null ||
                moving.Moving.Id == 1 || moving.Moving.Id == 3)
            {
                SetEntryControlLocation();
            }
            else if (moving.Moving.Id == 2)
            {
                SetExitControlLocation();
            }
            else
            {
                MessagePermitIsClosed();
            }
        }
        private void CreateEntry()
        {
            PermitMoving lastMoving = Permit.LoadLastMoving(Database);

            if (lastMoving == null ||
                lastMoving.Moving.Id != 2 ||
                (lastMoving.Moving.Id == 2 &&
                 IgnoreMovingError(lastMoving)))
            {
                PermitMoving moving = PermitMoving.CreateEntry(Permit);
                moving.EntryPoint = EntryPoint;
                moving.User       = Database.ConnectedUser;

                PermitMovingForm form = new PermitMovingForm(Database, moving);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    Close();
                }
            }
        }