Ejemplo n.º 1
0
        public User selectByName(String uName)
        {
            DataBaseDao.getConnect();
            User            user       = null;
            String          sqlQuare   = "select * from tb_user where userName=@para1";
            MySqlCommand    sqlCommand = new MySqlCommand(sqlQuare, DataBaseDao.conn);
            MySqlDataReader reader     = null;

            try
            {
                sqlCommand.Parameters.AddWithValue("para1", "lisi");
                reader = sqlCommand.ExecuteReader();
                if (reader.Read())
                {
                    user = new User(reader.GetString("userName"), reader.GetString("userPWD"), reader.GetInt32("age"), reader.GetString("phone"), reader.GetInt32("value"));
                }
            }
            catch (MySqlException ex)
            {
                if (reader != null)
                {
                    reader.Close();
                }
                //记录日志
            }
            finally {
                if (reader != null)
                {
                    reader.Close();
                }
                DataBaseDao.closeCon();
            }
            return(user);
        }
Ejemplo n.º 2
0
        public ActionResult AdminPage()
        {
            var data = DataBaseDao.unapproved();

            if (data != null)
            {
                return(View(data));
            }
            else
            {
                return(View("NoData"));
            }
        }
Ejemplo n.º 3
0
 public ActionResult Approve(DataBase data)
 {
     DataBaseDao.ApproveLink(data);
     return(View("Success"));
 }
Ejemplo n.º 4
0
 public ActionResult Save(DataBase data)
 {
     DataBaseDao.NewLink(data);
     return(View("Success"));
 }
Ejemplo n.º 5
0
        // GET: DataBase
        public ActionResult Index()
        {
            var data = DataBaseDao.getAll();

            return(View(data));
        }