/// <summary>
 /// buttonDrop_Click - drop key at this location
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonDrop_Click(object sender, EventArgs e)
 {
     resetTimer();
     if (KeyLocation == -1)
     {
         Program.ShowErrorMessage(LanguageTranslation.BOX_LOCATION_NOT_SET, 3000);
         return;
     }
     CommonTasks.OpenKeyBox(KeyLocation, false);
     Program.logEvent("Box " + KeyLocation + " Opened By Administrator");
 }
Example #2
0
        /// <summary>
        /// buttonOpenDoor_Click - will open a locked door for an admin, give access to the keys without
        ///                     using access codes or cards.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonOpenDoor_Click(object sender, EventArgs e)
        {
            TimeOutOff();
            try
            {
                string boxNumber = CommonTasks.GetLocationFromKeypad();

                if (String.IsNullOrEmpty(boxNumber))
                {
                    Program.ShowErrorMessage(LanguageTranslation.INVALID_BOX_NUMBER, 3000);
                    return;
                }
                //check to see if this is a valid location
                int loc = -1;  //initialize as invalid

                if (CommonTasks.ValidBoxNumber(boxNumber))
                {
                    loc = CommonTasks.FindLocationNumber(boxNumber); //location number is 1-Max - box numbers are different sequence
                }

                // if this was not a valid box number - then location will be -1
                if (loc == -1)
                {
                    Program.ShowErrorMessage(LanguageTranslation.INVALID_BOX_NUMBER, 3000);
                    return;
                }
                else
                {
                    CommonTasks.OpenKeyBox(loc, false);
                    Program.logEvent("Box " + loc + " Opened by Admin");
                }
                resetTimer();
            }
            catch (Exception ex)
            {
                Program.logEvent("Admin dialogs - Open door task  exception " + ex.Message);
            }
        }