Esempio n. 1
0
        /// <summary>
        /// 添加用户角色
        /// </summary>
        /// <param name="RoleName">角色名称</param>
        public void AddRole(string RoleName)
        {
            string str = "select count(*)from Role";

            SH.SqlCom(str, CommandType.Text);
            string RoleID = ((int)SH.SqlES() + 1).ToString();

            str = "insert Role(RoleID,RoleName) values(@RoleID,@RoleName)";
            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("@RoleName", RoleName);
            SH.SqlPar("@RoleID", RoleID);
            SH.SqlENQ();
        }
Esempio n. 2
0
        /// <summary>
        /// 删除用户成绩信息
        /// </summary>
        /// <param name="PaperID">试卷编号</param>
        public void Delete(string PaperID)
        {
            string str = "select ID from score where PaperID=@PaperID";

            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("PaperID", PaperID);
            string ID = SH.SqlES().ToString();

            str = "delete score where ID=@ID update score set ID-=1 where ID>@ID";
            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("ID", ID);
            SH.SqlENQ();
        }
Esempio n. 3
0
        /// <summary>
        /// 添加科目信息
        /// </summary>
        /// <param name="CName">string类型,表示科目名称</param>
        public void AddCou(string CName)
        {
            string str = "select count(*)from Course";

            SH.SqlCom(str, CommandType.Text);
            string CID = ((int)SH.SqlES() + 1).ToString();

            str = "insert Course values(@courseID,@courseName)";
            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("@courseID", CID);
            SH.SqlPar("@courseName", CName);
            SH.SqlENQ();
        }
Esempio n. 4
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="User">用户信息实体</param>
        /// <returns>int类型,0表示有用户,1表示没有用户</returns>
        public int UserSelect(UserInfo User)
        {
            string str = "select RoleId from UserInfo where UserID=@userID and UserPwd=@userPwd";

            UserNCP(str, User, CommandType.Text);
            if (SH.SqlES() != null)
            {
                return((int)SH.SqlES());
            }
            else
            {
                return(0);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 添加试卷信息
        /// </summary>
        /// <param name="PaperName">试卷名称</param>
        /// <param name="courseID">科目编号</param>
        public void Add(string PaperName, string courseID)
        {
            string str = "select count(*) from Paper";

            SH.SqlCom(str, CommandType.Text);
            string PaperID = ((int)SH.SqlES() + 1).ToString();

            str = "insert Paper values(@PaperID,@courseID,@PaperName,@PaperState,@ExamTime)";
            SH.SqlCom(str, CommandType.Text);
            string[] str0 = { "@PaperID", "@courseID", "@PaperName", "@PaperState", "@ExamTime" };
            string[] str1 = { PaperID, courseID, PaperName, "0", DateTime.Now.ToString() };
            SH.SqlPar(str0, str1);
            SH.SqlENQ();
        }
Esempio n. 6
0
        /// <summary>
        /// 添加填空题信息
        /// </summary>
        /// <param name="courseID">课程编号</param>
        /// <param name="FrontTitle">前描述</param>
        /// <param name="backTitle">后描述</param>
        /// <param name="answer">正确答案</param>
        public void AddfillBlankProblem(fillBlankProblem fbp)
        {
            string str = "select count(*)from fillBlankProblem";

            SH.SqlCom(str, CommandType.Text);
            string ID = ((int)SH.SqlES() + 1).ToString();

            str = "insert fillBlankProblem values(@ID,@courseID,@FrontTitle,@backTitle,@answer)";
            SH.SqlCom(str, CommandType.Text);
            string[] str0 = { "@ID", "@courseID", "@FrontTitle", "@backTitle", "@answer" };
            string[] str1 = { ID, fbp.CourseID, fbp.FrontTitle, fbp.BackTitle, fbp.Answer };
            SH.SqlPar(str0, str1);
            SH.SqlENQ();
        }
Esempio n. 7
0
 /// <summary>
 /// 添加试卷定制信息
 /// </summary>
 /// <param name="pd">试卷详细信息实体集的泛型集合</param>
 public void Add(List <PaperDetail> pd)
 {
     foreach (PaperDetail a in pd)
     {
         string str = "select count(*) from PaperDetail";
         SH.SqlCom(str, CommandType.Text);
         string ID = ((int)SH.SqlES() + 1).ToString();
         str = "insert PaperDetail values(@ID,@PaperID,@type,@titleID,@Mark,@WriteTime)";
         string[] str0 = { "@ID", "@PaperID", "@type", "@titleID", "@Mark", "@WriteTime" };
         string[] str1 = { ID, a.PaperID.ToString(), a.Type, a.TitleID.ToString(), a.Mark.ToString(), a.WriteTime.ToString() };
         SH.SqlCom(str, CommandType.Text);
         SH.SqlPar(str0, str1);
         SH.SqlENQ();
     }
 }
Esempio n. 8
0
 /// <summary>
 /// 获取用户姓名
 /// </summary>
 /// <param name="UserID">用户编号</param>
 /// <returns>string类型,返回字符串类型用户姓名</returns>
 public string GetUserName(string UserID)
 {
     SH = new SqlHelp();
     string str = "select UserName from UserInfo where UserID=@UserID";
     SH.SqlCom(str, CommandType.Text);
     SH.SqlPar("@UserID", UserID);
     return SH.SqlES().ToString();
 }
Esempio n. 9
0
 /// <summary>
 /// 获取用户编号
 /// </summary>
 /// <param name="userName">用户姓名</param>
 /// <returns>string类型,返回字符串类型用户编号</returns>
 public string GetUserID(string userName)
 {
     SH = new SqlHelp();
     string str = "select UserID from UserInfo where UserName=@UserName";
     SH.SqlCom(str, CommandType.Text);
     SH.SqlPar("@UserName", userName);
     return SH.SqlES().ToString();
 }
Esempio n. 10
0
        /// <summary>
        /// 获取用户姓名
        /// </summary>
        /// <param name="UserID">用户编号</param>
        /// <returns>string类型,返回字符串类型用户姓名</returns>
        public string GetUserName(string UserID)
        {
            SH = new SqlHelp();
            string str = "select UserName from UserInfo where UserID=@UserID";

            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("@UserID", UserID);
            return(SH.SqlES().ToString());
        }
Esempio n. 11
0
        /// <summary>
        /// 获取用户编号
        /// </summary>
        /// <param name="userName">用户姓名</param>
        /// <returns>string类型,返回字符串类型用户编号</returns>
        public string GetUserID(string userName)
        {
            SH = new SqlHelp();
            string str = "select UserID from UserInfo where UserName=@UserName";

            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("@UserName", userName);
            return(SH.SqlES().ToString());
        }
Esempio n. 12
0
        /// <summary>
        /// 评定并获取简答题总分
        /// </summary>
        /// <returns>int类型,返回整数类型的简答题总分</returns>
        public int QuestionSum()
        {
            string str = "select count(*) from a";

            SH.SqlCom(str, CommandType.Text);
            if ((int)SH.SqlES() == 0)
            {
                return(0);
            }
            else
            {
                SH.SqlUpdate();
                str = "select SUM(score) from a";
                SH.SqlCom(str, CommandType.Text);
                if (SH.SqlES().ToString() == "")
                {
                    return(0);
                }
                else
                {
                    return((int)SH.SqlES());
                }
            }
        }