Пример #1
0
        public void userLog(userLog log)
        {
            //连接数据库
            MySqlConnection mysql = getMySqlConnection();

            try
            {
                mysql.Open();
                string       userLog       = "insert into userLog(username,dateTime, methods) VALUES('" + log.username + "','" + log.dateTime + "','" + log.methods + "')";
                MySqlCommand insertUserLog = new MySqlCommand(userLog, mysql);
                if (insertUserLog.ExecuteNonQuery() > 0)
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                string exception = ex.Message.ToString();
                /***********写入错误日志***************/
                return;
            }
            finally
            {
                mysql.Close();
            }
        }
Пример #2
0
        /// <summary>
        /// Read plain text user information
        /// <summary>
        public List <userLog> readUserLogHistory()
        {
            userLog        userInfo    = new userLog();
            List <userLog> userLogHist = new List <userLog>();

            string[] lines = File.ReadAllLines(Directory.GetCurrentDirectory() + "/userHistory.txt");
            foreach (string line in lines)
            {
                string[] col = line.Split(new char[] { ',' });
                userInfo.HostName = col[0];
                userInfo.UserName = col[1];
                userInfo.Password = col[2];
                userInfo.Port     = Int32.Parse(col[3]);
                userLogHistory.Add(userInfo);
            }
            return(userLogHist);
        }
Пример #3
0
        public ActionResult Climber_In([Bind(Include = "userID,timeStamp,stampRecord")] userLog userLog)
        {
            if (db.userdatas.Where(x => x.userID == userLog.userID).Any())
            {
                //creats a time stamp for the user when they sign in
                DateTime localDate = DateTime.Now;
                //converts time stamp to string to store in database
                string TimeStamp = localDate.ToString("MM/dd/yyyy HH:mm:ss.fff", CultureInfo.InvariantCulture);
                userLog.timeStamp = TimeStamp;


                int convert;
                var Temp_Record = db1.userLogs.Max(x => x.stampRecord);

                if (Temp_Record == null)
                {
                    Temp_Record         = "1";
                    userLog.stampRecord = Temp_Record;
                }
                else
                {
                    //convert int to string
                    convert = Int32.Parse(Temp_Record);
                    convert = convert + 1;
                    var NewStamp = convert.ToString();
                    userLog.stampRecord = NewStamp;
                }

                if (ModelState.IsValid)
                {
                    db1.userLogs.Add(userLog);
                    db1.SaveChanges();
                    Response.Write(@"<script language='javascript'>alert('Message: \n" + "Welcome!" + "');</script>");
                }

                return(View(userLog));
            }
            else
            {
                Response.Write(@"<script language='javascript'>alert('Message: \n" + "Your ID was Incorrect, Please Try again" + "');</script>");
                return(View());
            }
        }
Пример #4
0
 void Awake()
 {
     userLog = GameObject.FindGameObjectWithTag("UserLog").GetComponent <userLog>();
 }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     userLog = GameObject.FindGameObjectWithTag("UserLog").GetComponent <userLog>();
     Username.onValueChange.AddListener(delegate { usernameChanged(Username.text); });
     Password.onValueChange.AddListener(delegate { passwordChanged(Password.text); });
 }