//向Coursemr表中添加考试科目信息 //输出: // 如果插入成功:返回True; // 如果插入失败:返回False; public bool InsertByStr() { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); string strsql = "INSERT INTO Coursemr(Name) VALUES (@Name)"; Params[0] = DB.MakeInParam("@Name", SqlDbType.VarChar, 50, Name); //考试科目名称 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//ɾ����ʦϵ����Ϣ public bool DeleteByStr(string DepartmentId) { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); string strsql = "DELETE FROM Departmentmr WHERE (DepartmentId = @DepartmentId)"; Params[0] = DB.MakeInParam("@DepartmentId", SqlDbType.Int, 4, DepartmentId); //�û���� int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//删除考试科目 //输入: // CID - 科目编号; //输出: // 如果删除成功:返回True; // 如果删除失败:返回False; public bool DeleteByStr(int CID) { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); string strsql = "DELETE FROM Coursemr WHERE ID = @ID"; Params[0] = DB.MakeInParam("@ID", SqlDbType.Int,4, CID); //科目编号 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//更新考试科目的信息 public bool UpdateByStr(int CID) { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); string strsql = "UPDATE Coursemr SET Name = @Name WHERE ID = @ID"; Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, CID); //用户编号 Params[1] = DB.MakeInParam("@Name", SqlDbType.VarChar, 200, Name); //用户权限 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
public bool InsertByStr() { SqlParameter[] Params = new SqlParameter[15]; DataBase DB = new DataBase(); string strsql = "INSERT INTO Rolemr (RoleName ,HasDuty_DepartmentManage ,HasDuty_UserManage,HasDuty_RoleManage,HasDuty_Role,HasDuty_UserScore,HasDuty_CourseManage,HasDuty_PaperLists,HasDuty_PaperSetup,HasDuty_UserPaperList,HasDuty_SingleSelectManage,HasDuty_MultiSelectManage,HasDuty_FillBlankManage,HasDuty_JudgeManage,HasDuty_QuestionManage)VALUES (@RoleName,@HasDuty_DepartmentManage,@HasDuty_UserManage,@HasDuty_RoleManage,@HasDuty_Role,@HasDuty_UserScore,@HasDuty_CourseManage,@HasDutyPaperLists,@HasDuty_PaperSetup,@HasDuty_UserPaperList,@HasDuty_SingleSelectManage,@HasDuty_MultiSelectManage,@HasDuty_FillBlankManage,@HasDuty_JudgeManage,@HasDuty_QuestionManage)"; Params[0] = DB.MakeInParam("@RoleName", SqlDbType.VarChar, 20, RoleName); Params[1] = DB.MakeInParam("@HasDuty_DepartmentManage", SqlDbType.Int, 4, HasDuty_DepartmentManage); Params[2] = DB.MakeInParam("@HasDuty_UserManage", SqlDbType.Int, 4, HasDuty_UserManage); Params[3] = DB.MakeInParam("@HasDuty_RoleManage", SqlDbType.Int, 4,HasDuty_RoleManage); Params[4] = DB.MakeInParam("@HasDuty_Role", SqlDbType.Int, 4, HasDuty_Role); Params[5] = DB.MakeInParam("@HasDuty_UserScore", SqlDbType.Int, 4, HasDuty_UserScore); Params[6] = DB.MakeInParam("@HasDuty_CourseManage", SqlDbType.Int, 4, HasDuty_CourseManage); Params[7] = DB.MakeInParam("@HasDuty_PaperSetup", SqlDbType.Int, 4, HasDuty_PaperSetup); Params[8] = DB.MakeInParam("@HasDuty_PaperLists", SqlDbType.Int, 4, HasDuty_PaperLists); Params[9] = DB.MakeInParam("@HasDuty_SingleSelectManage", SqlDbType.Int, 4, HasDuty_SingleSelectManage); Params[10] = DB.MakeInParam("@HasDuty_MultiSelectManage", SqlDbType.Int, 4, HasDuty_MultiSelectManage); Params[11] = DB.MakeInParam("@HasDuty_FillBlankManage", SqlDbType.Int, 4, HasDuty_FillBlankManage); Params[12] = DB.MakeInParam("@HasDuty_JudgeManage", SqlDbType.Int, 4, HasDuty_JudgeManage); Params[13] = DB.MakeInParam("@HasDuty_QuestionManage", SqlDbType.Int, 4, HasDuty_QuestionManage); Params[14] = DB.MakeInParam("@HasDuty_UserPaperList", SqlDbType.Int, 4, HasDuty_UserPaperList); int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//更新试卷是否评阅的状态 public bool UpdateByProc(string XUserID,int XPaperID,string Xstate) { SqlParameter[] Params = new SqlParameter[3]; DataBase DB = new DataBase(); string strsql = "UPDATE UserAnswermr SET state= @state WHERE UserID = @UserID and PaperID= @PaperID"; Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); Params[1] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, XPaperID); Params[2] = DB.MakeInParam("@state", SqlDbType.VarChar, 50,Xstate); int Count = -1; Count = DB.ProcStr(strsql,Params); if (Count > 0) return true; else return false; }
//更新填空题的信息 public bool UpdateByStr(int TID) { SqlParameter[] Params = new SqlParameter[5]; DataBase DB = new DataBase(); string strsql = "UPDATE FillBlankProblemmr SET CourseID= @CourseID,FrontTitle= @FrontTitle,BackTitle= @BackTitle,Answer= @Answer WHERE (ID= @ID)"; Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, TID); //题目编号 Params[1] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号 Params[2] = DB.MakeInParam("@FrontTitle", SqlDbType.VarChar, 500, FrontTitle); //题目前部分 Params[3] = DB.MakeInParam("@BackTitle", SqlDbType.VarChar, 500, BackTitle); //题名后部分 Params[4] = DB.MakeInParam("@Answer", SqlDbType.VarChar, 200, Answer); //答案 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//ɾ����Ŀ //���룺 // TID - ��Ŀ��ţ� //����� // ɾ���ɹ�������True�� // ɾ��ʧ�ܣ�����False�� public bool DeleteByStr(int TID) { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); string strsql = "DELETE FROM QuestionProblemmr WHERE (ID= @ID)"; Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, TID); //��Ŀ��� int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//向Scoremr表中添加成绩 //输出: // 插入成功:返回True; // 插入失败:返回False; public bool InsertByProc() { SqlParameter[] Params = new SqlParameter[6]; DataBase DB = new DataBase(); string strsql = "INSERT INTO Scoremr (UserID, PaperID,Score,ExamTime,JudgeTime,PingYu) VALUES ( @UserID,@PaperID,@Score,@ExamTime,@JudgeTime,@PingYu)"; Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 20, UserID); Params[1] = DB.MakeInParam("@PaperID", SqlDbType.Int,4, PaperID); Params[2] = DB.MakeInParam("@Score", SqlDbType.Int,4, Score); Params[3] = DB.MakeInParam("@ExamTime", SqlDbType.DateTime, 8,ExamTime); Params[4] = DB.MakeInParam("@JudgeTime", SqlDbType.DateTime, 8, DateTime.Now); Params[5] = DB.MakeInParam("@PingYu", SqlDbType.VarChar, 1000, PingYu); int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//更新多选题的信息 public bool UpdateByStr(int TID) { SqlParameter[] Params = new SqlParameter[8]; DataBase DB = new DataBase(); string strsql = "UPDATE MultiProblemmr SET CourseID= @CourseID,Title= @Title,AnswerA= @AnswerA,AnswerB= @AnswerB,AnswerC= @AnswerC,AnswerD= @AnswerD,Answer= @Answer WHERE (ID = @ID)"; Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, TID); //题目编号 Params[1] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号 Params[2] = DB.MakeInParam("@Title", SqlDbType.VarChar, 1000, Title); //题目 Params[3] = DB.MakeInParam("@AnswerA", SqlDbType.VarChar, 500, AnswerA); //答案A Params[4] = DB.MakeInParam("@AnswerB", SqlDbType.VarChar, 500, AnswerB); //答案B Params[5] = DB.MakeInParam("@AnswerC", SqlDbType.VarChar, 500, AnswerC); //答案C Params[6] = DB.MakeInParam("@AnswerD", SqlDbType.VarChar, 500, AnswerD); //答案D Params[7] = DB.MakeInParam("@Answer", SqlDbType.VarChar, 50, Answer); //答案 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//向MultiProblemmr表中添加题目信息( //输出: // 如果插入成功:返回True; // 如果插入失败:返回False; public bool InsertByStr() { SqlParameter[] Params = new SqlParameter[7]; DataBase DB = new DataBase(); string strsql = "INSERT INTO MultiProblemmr (CourseID,Title,AnswerA,AnswerB,AnswerC,AnswerD,Answer) VALUES (@CourseID,@Title,@AnswerA,@AnswerB,@AnswerC,@AnswerD,@Answer)"; Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号 Params[1] = DB.MakeInParam("@Title", SqlDbType.VarChar, 1000, Title); //题目 Params[2] = DB.MakeInParam("@AnswerA", SqlDbType.VarChar, 500, AnswerA); //答案A Params[3] = DB.MakeInParam("@AnswerB", SqlDbType.VarChar, 500, AnswerB); //答案B Params[4] = DB.MakeInParam("@AnswerC", SqlDbType.VarChar, 500, AnswerC); //答案C Params[5] = DB.MakeInParam("@AnswerD", SqlDbType.VarChar, 500, AnswerD); //答案D Params[6] = DB.MakeInParam("@Answer", SqlDbType.VarChar, 50, Answer); //答案 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//�����ʦϵ����Ϣ public bool InsertByStr() { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); string strsql = " INSERT INTO Departmentmr(DepartmentId,DepartmentName) VALUES ( @DepartmentId,@DepartmentName)"; Params[0] = DB.MakeInParam("@DepartmentId", SqlDbType.Int, 4, DepartmentId); Params[1] = DB.MakeInParam("@DepartmentName", SqlDbType.VarChar, 50, DepartmentName); int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//���½�ʦϵ����Ϣ public bool UpdateByStr(string DepartmentId) { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); string strsql = " UPDATE Departmentmr SET DepartmentId = @DepartmentId,DepartmentName = @DepartmentName WHERE DepartmentId = @DepartmentId"; Params[0] = DB.MakeInParam("@DepartmentId", SqlDbType.Int, 4, DepartmentId); Params[1] = DB.MakeInParam("@DepartmentName", SqlDbType.VarChar, 50, DepartmentName); int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
public bool UpdateByStr(int XRoleId) { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); string strsql = "UPDATE Rolemr SET RoleName = @RoleName WHERE (RoleId = @RoleId"; Params[0] = DB.MakeInParam("@RoleId", SqlDbType.Int, 4, XRoleId); Params[1] = DB.MakeInParam("@RoleName", SqlDbType.VarChar, 50, RoleName); int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//��SingleProblemmr���������Ŀ��Ϣ(���ò�������) //����� // ����ɹ�������True�� // ����ʧ�ܣ�����False�� public bool InsertByStr() { SqlParameter[] Params = new SqlParameter[3]; DataBase DB = new DataBase(); string strsql = "INSERT INTO QuestionProblemmr (CourseID,Title,Answer) VALUES (@CourseID,@Title,@Answer)"; Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //��Ŀ��� Params[1] = DB.MakeInParam("@Title", SqlDbType.VarChar, 1000, Title); //��Ŀ Params[2] = DB.MakeInParam("@Answer", SqlDbType.VarChar,1000, Answer); //��A int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//删除用户 //输入: // XUserID - 用户编号; //输出: // 删除成功:返回True; // 删除失败:返回False; public bool DeleteByProc(string XUserID) { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); string strsql = "DELETE FROM Usersmr WHERE UserID = @UserID"; Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); //用户编号 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//�����ж������Ϣ public bool UpdateByStr(int TID) { SqlParameter[] Params = new SqlParameter[4]; DataBase DB = new DataBase(); string strsql = "UPDATE QuestionProblemmr SET CourseID= @CourseID,Title= @Title,Answer = @Answer WHERE (ID = @ID)"; Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, TID); //��Ŀ��� Params[1] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //��Ŀ��� Params[2] = DB.MakeInParam("@Title", SqlDbType.VarChar, 1000, Title); //��Ŀ Params[3] = DB.MakeInParam("@Answer", SqlDbType.VarChar, 1000, Answer); //�� int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//向Usersmr表中添加用户信息(采用存储过程) //输出: // 插入成功:返回True; // 插入失败:返回False; public bool InsertByStr() { SqlParameter[] Params = new SqlParameter[5]; DataBase DB = new DataBase(); string strsql = "INSERT INTO Usersmr (UserID,UserName,UserPwd,DepartmentId,RoleId) VALUES ( @UserID,@UserName,@UserPwd,@DepartmentId, @RoleId)"; Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, UserID); //用户编号 Params[1] = DB.MakeInParam("@UserName", SqlDbType.VarChar, 50, UserName); //用户姓名 Params[2] = DB.MakeInParam("@UserPwd", SqlDbType.VarChar,64, UserPwd); //用户密码 Params[3] = DB.MakeInParam("@RoleId", SqlDbType.Int, 4,RoleId); //角色 Params[4] = DB.MakeInParam("@DepartmentId", SqlDbType.Int, 4, DepartmentId); //部门 int Count = -1; //Count = DB.RunProc("Proc_UsersAdd", Params); Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//向FillBlankProblemmr表中添加题目信息 //输出: // 如果插入成功:返回True; // 如果插入失败:返回False; public bool InsertByStr() { SqlParameter[] Params = new SqlParameter[4]; DataBase DB = new DataBase(); string strsql = "INSERT INTO FillBlankProblemmr (CourseID,FrontTitle,BackTitle,Answer) VALUES (@CourseID,@FrontTitle,@BackTitle,@Answer)"; Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号 Params[1] = DB.MakeInParam("@FrontTitle", SqlDbType.VarChar, 500, FrontTitle); //题目前部分 Params[2] = DB.MakeInParam("@BackTitle", SqlDbType.VarChar, 500, BackTitle); //题名后部分 Params[3] = DB.MakeInParam("@Answer", SqlDbType.VarChar, 200, Answer); //答案 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//修改用户的密码 //输入: // XUserID - 用户编号; //输出: // 修改成功:返回True; // 修改失败:返回False; public bool ModifyPassword(string XUserID) { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); string strsql = "UPDATE Usersmr SET UserPwd = @UserPwd WHERE (UserID = @UserID)"; Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 20, XUserID); //用户编号 Params[1] = DB.MakeInParam("@UserPwd", SqlDbType.VarChar, 64, UserPwd); //用户密码 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
// 删除某位用户的试卷 public bool DeleteByProc(string userid,int paperid) { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); string strsql = "DELETE From UserAnswermr WHERE UserID= @UserID and PaperID=@PaperID"; Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, userid); //用户ID Params[1] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, paperid); //试卷ID int Count = -1; //Count = DB.RunProc("Proc_UserPaperDelete", Params); Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//更新用户的信息 public bool UpdateByProc(string XUserID) { SqlParameter[] Params = new SqlParameter[4]; DataBase DB = new DataBase(); string strsql = "UPDATE Usersmr SET UserName= @UserName,DepartmentId= @DepartmentId,RoleId = @RoleId WHERE UserID = @UserID"; Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); //用户编号 Params[1] = DB.MakeInParam("@UserName", SqlDbType.VarChar, 50, UserName); //用户姓名 Params[2] = DB.MakeInParam("@DepartmentId", SqlDbType.Int, 4, DepartmentId); //部门 Params[3] = DB.MakeInParam("@RoleId", SqlDbType.Int, 4, RoleId); //角色 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
//更新试卷信息 public bool UpdateByStr(int PID) { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); string strsql = "UPDATE Papermr SET PaperState = @PaperState WHERE PaperID= @PaperID"; Params[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, PID); //试卷编号 Params[1] = DB.MakeInParam("@PaperState", SqlDbType.Bit, 1, PaperState); //试卷状态 int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }
public bool DeleteByStr(int XRoleId) { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); string strsql = "DELETE FROM Rolemr WHERE (RoleId = @RoleId)"; Params[0] = DB.MakeInParam("@RoleId", SqlDbType.Int, 4,XRoleId); //��Ŀ��� int Count = -1; Count = DB.ProcStr(strsql, Params); if (Count > 0) return true; else return false; }