Exemplo n.º 1
0
        /// <summary>
        /// 获取用户答题答案信息
        /// </summary>
        /// <returns>DataSet类型,返回用户答题答案信息数据集</returns>
        public DataSet FillDs()
        {
            string str = "select distinct RANK()over(order by UserName) as ID,UserName,examTime,PaperID from UserAnswer inner join UserInfo on UserInfo.UserID=UserAnswer.userID";

            SH.SqlCom(str, CommandType.Text);
            return(SH.SqlFillDs());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取角色授权信息数据集
        /// </summary>
        /// <param name="RoleID">角色编号</param>
        /// <returns>DataSet类型,表示角色授权信息数据集</returns>
        public DataSet FillDs(string RoleID)
        {
            string str = "select RoleID,RoleName,HasDuty_userManage,HasDuty_courseManage,HasDuty_paperSetup,HasDuty_userPaperList,HasDuty_Role,HasDuty_paperLists,HasDuty_userScore,HasDuty_QuestionManage from Role where RoleID=@RoleID";

            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("@RoleID", RoleID);
            return(SH.SqlFillDs());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取用户成绩信息
        /// </summary>
        /// <param name="PaperID">试卷编号</param>
        /// <returns>DataSet类型,返回用户成绩信息数据集</returns>
        public DataSet FillDs(string PaperID)
        {
            string str = "select UserInfo.UserID,UserName,PaperID,Score,examTime,JudgeTime from UserInfo right join score on UserInfo.UserID=score.userID where 1=1";

            if (PaperID != "")
            {
                str += (" and PaperID=" + PaperID);
            }
            SH.SqlCom(str, CommandType.Text);
            return(SH.SqlFillDs());
        }
Exemplo n.º 4
0
 /// <summary>
 /// 获取用户信息
 /// </summary>
 /// <returns>DateSet类型,返回用户信息数据集</returns>
 public DataSet UserFill()
 {
     SH = new SqlHelp();
     string str = "select UserID,UserName,RoleId from UserInfo";
     SH.SqlCom(str, CommandType.Text);
     return SH.SqlFillDs();
 }
Exemplo n.º 5
0
        /// <summary>
        /// 获取试卷信息数据集
        /// </summary>
        /// <returns>DataSet类型,表示试卷信息数据集</returns>
        public DataSet FillDs()
        {
            string str = "select PaperID,PaperName from Paper select courseName,PaperName,PaperState from Paper left join Course on Paper.courseID=Course.courseID";

            SH.SqlCom(str, CommandType.Text);
            return(SH.SqlFillDs());
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取题库信息
        /// </summary>
        /// <returns>DataSet类型,返回单选题,多选题,判断题,填空题,简答题的数据集</returns>
        public DataSet FillDs()
        {
            string str = "select*from singleProblem select*from multiProblem select*from judgeProblem select*from fillBlankProblem select*from questionProblem";

            SH.SqlCom(str, CommandType.Text);
            return(SH.SqlFillDs());
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取科目信息
        /// </summary>
        /// <returns>DataSet类型,返回科目信息数据集</returns>
        public DataSet FillDs()
        {
            string str = "select *from Course";

            SH.SqlCom(str, CommandType.Text);
            return(SH.SqlFillDs());
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <returns>DateSet类型,返回用户信息数据集</returns>
        public DataSet UserFill()
        {
            SH = new SqlHelp();
            string str = "select UserID,UserName,RoleId from UserInfo";

            SH.SqlCom(str, CommandType.Text);
            return(SH.SqlFillDs());
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取试卷临时详细信息
        /// </summary>
        /// <param name="Type">试题类型</param>
        /// <returns>DataSet类型,返回试卷临时详细信息数据集</returns>
        public DataSet FillDs(List <PaperDetail> pd, string Type)
        {
            string str = "if exists (select name from sysobjects where type='u' and name='a')drop table a create table a(type varchar(50),titleID int,Mark int,WriteTime int)";

            SH.SqlCom(str, CommandType.Text);
            SH.SqlENQ();
            foreach (PaperDetail a in pd)
            {
                str = "insert a values(@type,@titleID,@Mark,@WriteTime)";
                string[] str0 = { "@type", "@titleID", "@Mark", "@WriteTime" };
                string[] str1 = { a.Type, a.TitleID.ToString(), a.Mark.ToString(), a.WriteTime.ToString() };
                SH.SqlCom(str, CommandType.Text);
                SH.SqlPar(str0, str1);
                SH.SqlES();
            }
            string strsql = "";

            switch (Type)
            {
            case "singleProblem":
                strsql = "select a.*,courseID,title,answerA,answerB,answerC,answerD,answer from a left join singleProblem on a.TitleID=singleProblem.ID where Type=@type";
                break;

            case "multiProblem":
                strsql = "select a.*,courseID,title,answerA,answerB,answerC,answerD,answer from a left join multiProblem on a.TitleID=multiProblem.ID where Type=@type";
                break;

            case "judgeProblem":
                strsql = "select a.*,courseID,title,answer from a left join judgeProblem on a.TitleID=judgeProblem.ID where Type=@type";
                break;

            case "fillBlankProblem":
                strsql = "select a.*,courseID,FrontTitle,backTitle,answer from a left join fillBlankProblem on a.TitleID=fillBlankProblem.ID where Type=@type";
                break;

            case "questionProblem":
                strsql = "select a.*,courseID,Title,answer from a left join questionProblem on a.TitleID=questionProblem.ID where Type=@type";
                break;

            default:
                break;
            }
            SH.SqlCom(strsql, CommandType.Text);
            SH.SqlPar("@type", Type);
            return(SH.SqlFillDs());
        }
Exemplo n.º 10
0
        /// <summary>
        /// 读取用户信息
        /// </summary>
        /// <param name="UserID">用户编号</param>
        /// <returns>UserInfo类型,存储用户信息实体</returns>
        public UserInfo UserRead(string UserID)
        {
            SH = new SqlHelp();
            string str = "select UserID,UserPwd,UserName,RoleId from UserInfo where UserID=@UserID";

            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("@UserID", UserID);
            DataSet  ds   = SH.SqlFillDs();
            UserInfo user = new UserInfo(ds.Tables[0].Rows[0].ItemArray[0].ToString(), ds.Tables[0].Rows[0].ItemArray[1].ToString(), ds.Tables[0].Rows[0].ItemArray[2].ToString(), (int)ds.Tables[0].Rows[0].ItemArray[3]);

            return(user);
        }
Exemplo n.º 11
0
 /// <summary>
 /// 读取用户信息
 /// </summary>
 /// <param name="UserID">用户编号</param>
 /// <returns>UserInfo类型,存储用户信息实体</returns>
 public UserInfo UserRead(string UserID)
 {
     SH = new SqlHelp();
     string str = "select UserID,UserPwd,UserName,RoleId from UserInfo where UserID=@UserID";
     SH.SqlCom(str, CommandType.Text);
     SH.SqlPar("@UserID", UserID);
     DataSet ds= SH.SqlFillDs();
     UserInfo user =new UserInfo( ds.Tables[0].Rows[0].ItemArray[0].ToString(), ds.Tables[0].Rows[0].ItemArray[1].ToString(), ds.Tables[0].Rows[0].ItemArray[2].ToString(), (int)ds.Tables[0].Rows[0].ItemArray[3] );
     return user;
 }