Ejemplo n.º 1
0
        /// <summary>
        /// ChangePassword - replace the password and the given location
        /// </summary>
        /// <param name="lc - location"></param>
        /// <param name="pswd- password"></param>
        /// <returns> true if password change is make</returns>
        public bool ChangePassword(int lc, string currentpswd, string newpswd)
        {
            KeyPassword keyPasswrd = null;

            foreach (KeyPassword kp in keypasswords)
            {
                if (kp.loc == lc)
                {
                    keyPasswrd = kp;
                    break;
                }
            }
            if (keyPasswrd == null)
            {
                Program.logEvent("KeyPassword - no location found" + lc.ToString());
                Program.SqlManager.ErrorDatabaseEntry("", "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "KeyPassword - no location found" + lc.ToString(), "", 0);
                return(false);   ///location not found - what happened here
            }
            else
            {
                foreach (string p in keyPasswrd.PasswordList)
                {
                    if (currentpswd == p)
                    {
                        keyPasswrd.PasswordList.Remove(p);
                        keyPasswrd.PasswordList.Add(newpswd);
                        return(true);
                    }
                }
                Program.logEvent("KeyPassword - PasswordList - 'currentpswd' not found for this location.");
                Program.SqlManager.ErrorDatabaseEntry("", "", DateTime.Now.ToString(), Program.KIOSK_ID, 0, "KeyPassword - PasswordList - 'currentpswd' not found for this location.", "", 0);
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ChangeTimeAccessType - replace the AccessTimeType of the given location
        /// </summary>
        /// <param name="lc - location"></param>
        /// <param name="pswd- password"></param>
        /// <returns> true if password change is made</returns>
        public bool ChangeTimeAccessType(int lc, accessTimeType type)
        {
            KeyPassword keyPasswrd = null;

            foreach (KeyPassword kp in keypasswords)
            {
                if (kp.loc == lc)
                {
                    keyPasswrd = kp;
                    break;
                }
            }
            if (keyPasswrd == null)
            {
                Program.logEvent("KeyPassword - no location found" + lc.ToString());
                return(false);   ///location not found - what happened here
            }
            else
            {
                keyPasswrd.accessTimeIntType = (int)type;
                return(true);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ChangeEndTime - change the end time a box is available for this location
        /// </summary>
        /// <param name="lc"></param>
        /// <param name="CardNo"></param>
        /// <returns></returns>
        public bool ChangeEndTime(int lc, DateTime Endtime)
        {
            KeyPassword keyPasswrd = null;

            foreach (KeyPassword kp in keypasswords)
            {
                if (kp.loc == lc)
                {
                    keyPasswrd = kp;
                    break;
                }
            }
            if (keyPasswrd == null)
            {
                Program.logEvent("ChangeEndTime - no location found" + lc.ToString());
                return(false);   ///location not found - what happened here
            }
            else
            {
                keyPasswrd.endAccessTimeframe = Endtime;
                return(true);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// ChangeNumberofUses - change the number of remaining uses for this box location
        /// </summary>
        /// <param name="lc"></param>
        /// <param name="CardNo"></param>
        /// <returns></returns>
        public bool ChangeLimitedNumberofUses(int lc, int uses)
        {
            KeyPassword keyPasswrd = null;

            foreach (KeyPassword kp in keypasswords)
            {
                if (kp.loc == lc)
                {
                    keyPasswrd = kp;
                    break;
                }
            }
            if (keyPasswrd == null)
            {
                Program.logEvent("ChangeNumberofUses - no location found " + lc.ToString());
                return(false);   ///location not found - what happened here
            }
            else
            {
                keyPasswrd.LimitedUseCount = uses;
                return(true);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// ChangeGenericData - change the genericdata field for this location
        /// </summary>
        /// <param name="lc"></param>
        /// <param name="CardNo"></param>
        /// <returns></returns>
        public bool ChangeGenericData(int lc, string Data)
        {
            KeyPassword keyPasswrd = null;

            foreach (KeyPassword kp in keypasswords)
            {
                if (kp.loc == lc)
                {
                    keyPasswrd = kp;
                    break;
                }
            }
            if (keyPasswrd == null)
            {
                Program.logDebug("ChangeGenericData - no location found" + lc.ToString());
                return(false);   ///location not found - what happened here
            }
            else
            {
                keyPasswrd.genericData = Data;
                return(true);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// ChangeCardNumber - change the four digit card number for this location
        /// </summary>
        /// <param name="lc"></param>
        /// <param name="CardNo"></param>
        /// <returns></returns>
        public bool ChangeCardNumber(int lc, string CardNo)
        {
            KeyPassword keyPasswrd = null;

            foreach (KeyPassword kp in keypasswords)
            {
                if (kp.loc == lc)
                {
                    keyPasswrd = kp;
                    break;
                }
            }
            if (keyPasswrd == null)
            {
                Program.logDebug("ChangeCardNumber - no location found" + lc.ToString());
                return(false);   ///location not found - what happened here
            }
            else
            {
                keyPasswrd.cardNumber = CardNo;
                return(true);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// AddKeyPassword - add a new key password location object
 ///                - not used by application - only test harness
 /// </summary>
 /// <param name="keypassword"></param>
 public void AddKeyPassword(KeyPassword keypassword)
 {
     keypasswords.Add(keypassword);
 }