Exemple #1
0
 /// <summary>
 /// 获取Command和Parmeter
 /// </summary>
 /// <param name="str">Command语句</param>
 /// <param name="User">用户信息实体</param>
 void UserNCP(string str, UserInfo User, CommandType ct)
 {
     SH = new SqlHelp();
     SH.SqlCom(str, ct);
     SH.SqlPar("@userID", User.UserID);
     SH.SqlPar("@userPwd", User.UserPwd);
 }
Exemple #2
0
        /// <summary>
        /// 删除试卷信息
        /// </summary>
        /// <param name="PaperName">试卷名称</param>
        public void Delete(string PaperName)
        {
            string str = "delete Paper where PaperName=@PaperName";

            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("@PaperName", PaperName);
            SH.SqlENQ();
        }
Exemple #3
0
        /// <summary>
        /// 添加用户信息
        /// </summary>
        /// <param name="User">用户信息实体</param>
        public void UserInsert(UserInfo User)
        {
            string str = "insert UserInfo(UserID,UserName,UserPwd,RoleId) values(@userID,@userName,@userPwd,@roleId)";

            UserNCP(str, User, CommandType.Text);
            SH.SqlPar("@userID", User.ID);
            SH.SqlPar("@userName", User.UserName);
            SH.SqlPar("@userPwd", User.UserPwd);
            SH.SqlPar("@roleId", User.RoleId.ToString());
            SH.SqlENQ();
        }
Exemple #4
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();
        }
Exemple #5
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();
 }
Exemple #6
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();
 }
Exemple #7
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());
        }
Exemple #8
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());
        }
Exemple #9
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());
        }
Exemple #10
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();
        }
Exemple #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);
        }
Exemple #12
0
 /// <summary>
 /// 获取Command和Parmeter
 /// </summary>
 /// <param name="str">Command语句</param>
 /// <param name="User">用户信息实体</param>
 void UserNCP(string str,UserInfo User,CommandType ct)
 {
     SH = new SqlHelp();
     SH.SqlCom(str, ct);
     SH.SqlPar("@userID", User.UserID);
     SH.SqlPar("@userPwd", User.UserPwd);
 }
Exemple #13
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;
 }
        /// <summary>
        /// 删除用户答题答案信息
        /// </summary>
        /// <param name="UserName">用户名称</param>
        public void Delete(string UserName, string date)
        {
            UserDal user   = new UserDal();
            string  userID = user.GetUserID(UserName);;
            string  str    = "delete UserAnswer where userID=@userID and examTime=@date";

            SH.SqlCom(str, CommandType.Text);
            SH.SqlPar("@userID", userID);
            SH.SqlPar("@examTime", date);
            SH.SqlENQ();
        }
Exemple #15
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();
     }
 }
        /// <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();
        }