Beispiel #1
0
        //插入管理员数据
        public void insertAdminInfo(AdminInfo admin)
        {
            string        sql     = "insert into admins values('" + admin.getname() + "','" + admin.getpw() + "')";
            SQLiteCommand command = new SQLiteCommand(sql, dbConnection);

            command.ExecuteNonQuery();
        }
Beispiel #2
0
        //插入管理员信息
        private void insertAdmin(string msg)
        {
            string[]  args  = msg.Split('#');
            AdminInfo admin = new AdminInfo(resumeSpecStr(args[0]), resumeSpecStr(args[1]), false);

            //如果管理员已存在则返回已存在消息
            if (mDataManager.isAdminNameExists(resumeSpecStr(args[0])))
            {
                mSocket.Send(Encoding.UTF8.GetBytes(MyProtocol.head_insertAdmin + MyProtocol.body_exists));
                Console.WriteLine("insert denied(exist):" + admin.getname());
                return;
            }
            //插入
            mDataManager.insertAdminInfo(admin);
            //发送成功消息
            mSocket.Send(Encoding.UTF8.GetBytes(MyProtocol.head_insertAdmin + MyProtocol.body_success));
            Console.WriteLine("insert an administrator:" + admin.getname());
        }
Beispiel #3
0
        //更新管理员密码(传过来的新密码为密文)
        public void updateAdminPw(string name, string newPw)
        {
            AdminInfo     admin   = new AdminInfo(name, newPw, false);
            string        sql     = "update admins set pw='" + admin.getpw() + "' where name='" + admin.getname() + "'";
            SQLiteCommand command = new SQLiteCommand(sql, dbConnection);

            command.ExecuteNonQuery();
        }