/// <summary> /// 更新用户密码 /// </summary> /// <param name="User">用户信息实体</param> public void UserPwdUpdate(UserInfo User) { string str = "update UserInfo set UserPwd=@userPwd where UserID=@userID"; UserNCP(str, User, CommandType.Text); SH.SqlENQ(); }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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(); } }