예제 #1
0
        public bool CheckDepartment(int XDepartmentId)
        {
            SqlParameter[] Params = new SqlParameter[1];
            DataBase DB = new DataBase();
            string strsql = "SELECT * FROM Departmentmr WHERE DepartmentId =@DepartmentId";
            Params[0] = DB.MakeInParam("@DepartmentId", SqlDbType.Int, 4, XDepartmentId);

            SqlDataReader DR = DB.RunStrGetReader(strsql, Params);
            if (!DR.Read())
            {
                return false;
            }
            else
            {
                return true;
            }
        }
예제 #2
0
        //判断是否已经考试
        public bool IsTest(string UserID, int PaperID)
        {
            SqlParameter[] Params = new SqlParameter[2];

            DataBase DB = new DataBase();
            string strsql = "SELECT * FROM UserAnswermr WHERE UserID=@UserID AND PaperID=@PaperID";
            Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 20, UserID);
            Params[1] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, PaperID);

            SqlDataReader DR = DB.RunStrGetReader(strsql, Params);
            if (!DR.Read())
            {
                return false;
            }
            else
            {
                return true;
            }
        }
예제 #3
0
        //根据UserID判断该用户是否存在
        //输入:
        //      XUserID - 用户编号;
        //输出:
        //      用户存在:返回True;
        //      用户不在:返回False;
        public bool CheckUser(string XUserID)
        {
            SqlParameter[] Params = new SqlParameter[1];
            DataBase DB = new DataBase();
            string strsql = "SELECT * FROM Usersmr,Departmentmr,Rolemr WHERE UserID=@UserID AND Usersmr.DepartmentId = Departmentmr.DepartmentId And Usersmr.RoleId = Rolemr.RoleId";
            Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID);                  //教工姓名

            SqlDataReader DR = DB.RunStrGetReader(strsql, Params);
            if (!DR.Read())
            {
                return false;
            }
            else
            {
                return true;
            }
        }
예제 #4
0
        public bool CheckScore(string XUserID,int XPaperID)
        {
            SqlParameter[] Params = new SqlParameter[2];
            DataBase DB = new DataBase();
            string strsql = " SELECT * FROM Scoremr WHERE UserID =@UserID and PaperID= @PaperID";
            Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 20, XUserID);
            Params[1] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, XPaperID);

            SqlDataReader DR = DB.RunStrGetReader(strsql, Params);
            if (!DR.Read())
            {
                return false;
            }
            else
            {
                return true;
            }
        }
예제 #5
0
        public bool CheckRolemr(string XRoleName)
        {
            SqlParameter[] Params = new SqlParameter[1];
            DataBase DB = new DataBase();
            string strsql = "SELECT * FROM Rolemr WHERE RoleName =@RoleName";
            Params[0] = DB.MakeInParam("@RoleName", SqlDbType.VarChar, 20, XRoleName);

            SqlDataReader DR = DB.RunStrGetReader(strsql, Params);
            if (!DR.Read())
            {
                return false;
            }
            else
            {
                return true;
            }
        }