Esempio n. 1
0
        /// <summary>
        /// SimpleAccess - simple access matchs a saved access code - 6 digits with digits entered here
        /// </summary>
        private void keyLocationChange()
        {
            try
            {
                string boxNumber = CommonTasks.GetLocationFromKeypad();
                resetTimer();
                if (String.IsNullOrEmpty(boxNumber))
                {
                    Program.ShowErrorMessage(LanguageTranslation.INVALID_LOCATION, 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_LOCATION, 3000);
                    return;
                }
                // the admin task has password at location 0
                else if (loc == 0) // this the admin location - use different task to change admin password
                {
                    Program.ShowErrorMessage(LanguageTranslation.USE_CHANGE_ADMIN_PWORD, 3000);
                    return;
                }
                else
                {
                    TimeOutOff();
                    KeyLocationChangeTasksForm keyLocChangeDlg = new KeyLocationChangeTasksForm(loc);

                    keyLocChangeDlg.ShowDialog();
                    resetTimer();
                }
            }
            catch (Exception ex)
            {
                Program.logError("Admin dialogs - SimpleAccess -change access task  exception " + ex.Message);
            }
        }
Esempio n. 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);
            }
        }