private string getResult(string currentPassword)
        {
            TimeOutOff();
            KeyPadForm keyNumberDlg = new KeyPadForm(LanguageTranslation.CHANGE_PASSWORD, false, Program.PASSWORD_SIZE, true, false);

            resetTimer();
            keyNumberDlg.ShowDialog();

            if (!keyNumberDlg.bOK)
            {
                Program.ShowErrorMessage(LanguageTranslation.NEW_PASSWORD_CANCELLED, 3000);
                return(currentPassword);
            }
            string result = keyNumberDlg.Result;

            while (result.Length > Program.PASSWORD_SIZE)
            {
                Program.ShowErrorMessage(LanguageTranslation.PASSWORD_LENGTH_ERROR + Program.PASSWORD_SIZE + LanguageTranslation.PASSWORD_LENGTH_ERROR_2, 3000);

                keyNumberDlg.ShowDialog();

                result = keyNumberDlg.Result;
                if (!keyNumberDlg.bOK)
                {
                    Program.ShowErrorMessage(LanguageTranslation.NEW_PASSWORD_CANCELLED, 3000);
                    return(currentPassword);
                }
            }
            return(keyNumberDlg.Result);
        }
        private void buttonEndDoor_Click(object sender, EventArgs e)
        {
            KeyPadForm end = new KeyPadForm(LanguageTranslation.ENTER_END_DOOR, false, 3, true, false);

            end.ShowDialog();
            if (end.Result == "")
            {
                return;
            }

            int temp = int.Parse(end.Result);

            if (temp < 1 || temp > Program.NUMBER_RELAYS)
            {
                Program.ShowErrorMessage(LanguageTranslation.BOX_NUMBER_NOT_EXIST, 3000);
                return;
            }
            if (temp < Startbox)
            {
                Program.ShowErrorMessage(LanguageTranslation.START_BOX_GREATER_END_BOX, 4000);
                return;
            }

            Endbox = int.Parse(end.Result);
            textBoxEndingDoorNumber.Text = end.Result;
        }
Exemplo n.º 3
0
        /// <summary>
        /// GetLocationFromKeypad - use the keypad to have user enter a number for cabinet keybox
        /// </summary>
        /// <returns></returns>
        public static string GetLocationFromKeypad()
        {
            KeyPadForm keypad = new KeyPadForm(LanguageTranslation.ENTER_BOX_NUMBER, true, Program.LOCATION_SIZE, true, false);

            keypad.ShowDialog();

            if (!keypad.bOK)
            {
                return("");  //was a cancel
            }

            return(keypad.Result);
        }
        private void ButtonOpenDoorDelay_Click(object sender, EventArgs e)
        {
            KeyPadForm delay = new KeyPadForm(LanguageTranslation.ENTER_DOOR_DELAY, false, 4, true, false);

            delay.ShowDialog();
            if (delay.Result == "")
            {
                return;
            }

            DoorDelay = int.Parse(delay.Result);
            textBoxOpenDoorDelay.Text = delay.Result;
        }
        private void buttonLimitedUses_Click(object sender, EventArgs e)
        {
            KeyPadForm uses = new KeyPadForm(LanguageTranslation.ENTER_LIMITED_USES, false, 5, true, false);

            uses.ShowDialog();

            if (uses.bOK)
            {
                limitUsesUpDown.Value = int.Parse(uses.Result);
            }
            else
            {
                Program.logEvent("Limited Time Entry Cancelled");
            }
        }
Exemplo n.º 6
0
        private void buttonPhone_Click(object sender, EventArgs e)
        {
            KeyPadForm IDForm = new KeyPadForm(LanguageTranslation.ENTER_PHONE_NUMBER, false, 10, true, true);

            IDForm.ShowDialog();

            if (IDForm.bOK)
            {
                Program.logEvent("User entered Email Address: " + IDForm.Result);
                textBoxPhone.Text = IDForm.Result;
            }
            else
            {
                Program.logEvent("User cancelled phone number change");
            }
        }
        /// <summary>
        /// buttonNewNumber_Click - change number of location
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonChangeAccessCode_Click(object sender, EventArgs e)
        {
            string PasswordtoChange;

            if (Program.passwordMgr.FindPassword(boxNumber).Count > 1)
            {
                TimeOutOff();
                KeyPadForm CurrentPwordEntry = new KeyPadForm(LanguageTranslation.ENTER_CODE, false, Program.PASSWORD_SIZE, true, false);
                CurrentPwordEntry.ShowDialog();
                resetTimer();

                if (!CurrentPwordEntry.bOK)
                {
                    Program.ShowErrorMessage(LanguageTranslation.CANCELLED, 3000);
                    return;
                }

                if (!(Program.passwordMgr.FindPassword(boxNumber).Contains(CurrentPwordEntry.Result)))
                {
                    Program.ShowErrorMessage(LanguageTranslation.ACCESS_CODE_NOT_FOUND, 3000);
                    return;
                }
                PasswordtoChange = CurrentPwordEntry.Result;
            }
            else
            {
                PasswordtoChange = Program.passwordMgr.FindPassword(boxNumber).First <string>();
            }
            TimeOutOff();
            KeyPadForm keyNumberDlg = new KeyPadForm(LanguageTranslation.ENTER_NEW_CODE, false, Program.PASSWORD_SIZE, true, false);

            keyNumberDlg.ShowDialog();
            resetTimer();

            if (!keyNumberDlg.bOK)
            {
                Program.ShowErrorMessage(LanguageTranslation.NEW_NUMBER_CANCELLED, 3000);
                return;
            }

            textBoxAccessCode.Text = textBoxAccessCode.Text.Replace(PasswordtoChange, keyNumberDlg.Result);
        }
        private void buttonSetEndTime_Click(object sender, EventArgs e)
        {
            KeyPadForm setend = new KeyPadForm(LanguageTranslation.ENTER_END_TIME, false, 4, true, true, GenericDataEntryType.Time);

            setend.ShowDialog();

            if (setend.bOK)
            {
                try
                {
                    timePickerEnd.Value = new DateTime(2000, 1, 1, int.Parse(setend.Result.Split(':')[0]), int.Parse(setend.Result.Split(':')[1]), 0);
                }
                catch (Exception ex)
                {
                    Program.ShowErrorMessage(LanguageTranslation.INVALID_TIME, 3000);
                }
            }
            else
            {
                Program.logEvent("End Time Entry Cancelled");
            }
        }
        private void buttonChangeCardNumber_Click(object sender, EventArgs e)
        {
            string cardNumber = Program.passwordMgr.FindCardNumber(boxNumber);;

            if ((String.IsNullOrEmpty(cardNumber)) || (cardNumber.Length != Program.NUMBER_CREDIT_CARD_DIGITS))
            {
                cardNumber = "0000";
            }

            TimeOutOff();
            KeyPadForm keyNumberDlg = new KeyPadForm(LanguageTranslation.ENTER_CARD_NUMBER, false, Program.NUMBER_CREDIT_CARD_DIGITS, true, false);

            keyNumberDlg.ShowDialog();
            resetTimer();

            if (!keyNumberDlg.bOK)
            {
                Program.ShowErrorMessage(LanguageTranslation.NEW_NUMBER_CANCELLED, 3000);
                return;
            }

            textBoxCardNumber.Text = keyNumberDlg.Result;
        }