示例#1
0
        /*
         * 用户登陆方法,检查用户名,密码,和身份
         * 密码正确返回 true 错误返回 false
         */
        public static bool User_Login(string uid, string pwd, string limit)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select * from user_info");
            stringBuilder.Append(" where ");
            stringBuilder.Append("User_id='");
            stringBuilder.Append(uid);
            stringBuilder.Append("' and User_pwd=");
            stringBuilder.Append(pwd);
            stringBuilder.Append(" and User_limit=");
            stringBuilder.Append(limit);
            SqlDataReader sqlDataReader = DBhelp.ExecuteReader(stringBuilder.ToString());

            if (sqlDataReader.Read())
            {
                sqlDataReader.Close();
                return(true);
            }
            else
            {
                sqlDataReader.Close();
                return(false);
            }
        }
示例#2
0
        //check admin password
        public static SqlDataReader adminPassword(string Uid, string pwd)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select * from admin");
            stringBuilder.Append(" where ");
            stringBuilder.Append("admin_id=");
            stringBuilder.Append(Uid);
            stringBuilder.Append(" and password=");
            stringBuilder.Append(pwd);
            return(DBhelp.ExecuteReader(stringBuilder.ToString()));
        }
示例#3
0
        //search id exists
        public static SqlDataReader ExistsID(string Uid)
        {
            Uid = Uid.Trim();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select * from reader_info");
            stringBuilder.Append(" where ");
            stringBuilder.Append("reader_id=");
            stringBuilder.Append(Uid);
            SqlDataReader sqlDataReader = DBhelp.ExecuteReader(stringBuilder.ToString());

            return(sqlDataReader);
        }
        public static SqlDataReader Statistic()
        {
            /*
             * 维护中 select count(*) from config where Meter_malfunc=0 and 开始维护时间 is not null
             * 正常select count(*) from config where Meter_malfunc=1
             * 所有select count(*) from config
             * 故障select count(*) from config where Meter_malfunc=0
             */
            StringBuilder querystr = new StringBuilder();

            querystr.Append("select count(*) from config");
            return(DBhelp.ExecuteReader(querystr.ToString()));
        }
示例#5
0
        public static string return_state(string sernum)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select state from lend_list");
            stringBuilder.Append(" where ");
            stringBuilder.Append("sernum=");
            stringBuilder.Append(sernum);
            SqlDataReader sqlDataReader = DBhelp.ExecuteReader(stringBuilder.ToString());
            string        state         = "";

            while (sqlDataReader.Read())
            {
                state = sqlDataReader["state"].ToString();
            }
            sqlDataReader.Close();
            return(state);
        }
示例#6
0
        /*
         * 获取用户账号
         */
        public static string Get_num(string uname, string pwd)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select * from user_info");
            stringBuilder.Append(" where ");
            stringBuilder.Append("User_name='");
            stringBuilder.Append(uname);
            stringBuilder.Append("' and User_pwd=");
            stringBuilder.Append(pwd);
            SqlDataReader sqlDataReader = DBhelp.ExecuteReader(stringBuilder.ToString());

            if (sqlDataReader.Read())
            {
                string num = sqlDataReader[0].ToString();
                sqlDataReader.Close();
                return(num);
            }
            else
            {
                sqlDataReader.Close();
                return(null);
            }
        }