//删除用户 //输入: // XUserID - 用户编号; //输出: // 删除成功:返回True; // 删除失败:返回False; public bool DeleteByProc(string XUserID) { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); //用户编号 int Count = -1; Count = DB.RunProc("Proc_UsersDelete", Params); if (Count > 0) return true; else return false; }
//向Course表中添加试卷科目信息 //输出: // 插入成功:返回True; // 插入失败:返回False; public bool InsertByProc() { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@Name", SqlDbType.VarChar, 50, Name); //试卷科目名称 int Count = -1; Count = DB.RunProc("Proc_CourseAdd", Params); if (Count > 0) return true; else return false; }
//删除科目 //输入: // CID - 科目编号; //输出: // 删除成功:返回True; // 删除失败:返回False; public bool DeleteByProc(int CID) { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@ID", SqlDbType.Int,4, CID); //科目编号 int Count = -1; Count = DB.RunProc("Proc_CourseDelete", Params); if (Count > 0) return true; else return false; }
//更新用户的信息 public bool UpdateByProc(string XUserID) { SqlParameter[] Params = new SqlParameter[3]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 50, XUserID); //用户编号 Params[1] = DB.MakeInParam("@UserName", SqlDbType.VarChar, 50, UserName); //用户姓名 Params[2] = DB.MakeInParam("@RoleId", SqlDbType.Int, 4, RoleId); //角色 //Params[3] = DB.MakeInParam("@UserPwd", SqlDbType.NVarChar, 64, UserPwd); //角色 int Count = -1; Count = DB.RunProc("Proc_UsersModify1", 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(); Params[0] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 20, XUserID); //用户编号 Params[1] = DB.MakeInParam("@UserPwd", SqlDbType.VarChar, 64, UserPwd); //用户密码 int Count = -1; Count = DB.RunProc("Proc_UserPwdModify", Params); if (Count > 0) return true; else return false; }
//向Users表中添加用户信息(采用存储过程) //输出: // 插入成功:返回True; // 插入失败:返回False; public bool InsertByProc() { SqlParameter[] Params = new SqlParameter[4]; DataBase DB = new DataBase(); 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); //角色 int Count = -1; Count = DB.RunProc("Proc_UsersAdd", Params); if (Count > 0) return true; else return false; }
//ɾ����Ŀ //���룺 // TID - ��Ŀ��ţ� //����� // ɾ���ɹ�������True�� // ɾ��ʧ�ܣ�����False�� public bool DeleteByProc(int TID) { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, TID); //��Ŀ��� int Count = -1; Count = DB.RunProc("Proc_QuestionProblemDelete", Params); if (Count > 0) return true; else return false; }
public bool InsertByProc() { SqlParameter[] Params = new SqlParameter[14]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@RoleName", SqlDbType.VarChar, 20, RoleName); Params[1] = DB.MakeInParam("@HasDuty_UserManage", SqlDbType.Int, 4, HasDuty_UserManage); Params[2] = DB.MakeInParam("@HasDuty_RoleManage", SqlDbType.Int, 4,HasDuty_RoleManage); Params[3] = DB.MakeInParam("@HasDuty_Role", SqlDbType.Int, 4, HasDuty_Role); Params[4] = DB.MakeInParam("@HasDuty_UserScore", SqlDbType.Int, 4, HasDuty_UserScore); Params[5] = DB.MakeInParam("@HasDuty_CourseManage", SqlDbType.Int, 4, HasDuty_CourseManage); Params[6] = DB.MakeInParam("@HasDuty_PaperSetup", SqlDbType.Int, 4, HasDuty_PaperSetup); Params[7] = DB.MakeInParam("@HasDuty_PaperLists", SqlDbType.Int, 4, HasDuty_PaperLists); Params[8] = DB.MakeInParam("@HasDuty_SingleSelectManage", SqlDbType.Int, 4, HasDuty_SingleSelectManage); Params[9] = DB.MakeInParam("@HasDuty_MultiSelectManage", SqlDbType.Int, 4, HasDuty_MultiSelectManage); Params[10] = DB.MakeInParam("@HasDuty_FillBlankManage", SqlDbType.Int, 4, HasDuty_FillBlankManage); Params[11] = DB.MakeInParam("@HasDuty_JudgeManage", SqlDbType.Int, 4, HasDuty_JudgeManage); Params[12] = DB.MakeInParam("@HasDuty_QuestionManage", SqlDbType.Int, 4, HasDuty_QuestionManage); Params[13] = DB.MakeInParam("@HasDuty_UserPaperList", SqlDbType.Int, 4, HasDuty_UserPaperList); int Count = -1; Count = DB.RunProc("Proc_RoleAdd", Params); if (Count > 0) return true; else return false; }
//向SingleProblem表中添加题目信息(采用存储过程) //输出: // 插入成功:返回True; // 插入失败:返回False; public bool InsertByProc() { SqlParameter[] Params = new SqlParameter[4]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号 Params[1] = DB.MakeInParam("@Title", SqlDbType.VarChar, 1000, Title); //题目 Params[2] = DB.MakeInParam("@DiffID", SqlDbType.Int, 4, DiffID); //难度系数 Params[3] = DB.MakeInParam("@Answer", SqlDbType.Bit, 1, Answer); //答案A int Count = -1; Count = DB.RunProc("Proc_JudgeProblemAdd", Params); if (Count > 0) return true; else return false; }
//向Scoretb表中添加成绩 //输出: // 插入成功:返回True; // 插入失败:返回False; public bool InsertByProc() { SqlParameter[] Params = new SqlParameter[6]; DataBase DB = new DataBase(); //string strsql = "INSERT INTO Scoretb (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.RunProc("Proc_ScoreAdd", Params); if (Count > 0) return true; else return false; }
//更新试卷信息 public bool UpdateByProc(int PID) { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, PID); //试卷编号 Params[1] = DB.MakeInParam("@PaperState", SqlDbType.Bit, 1, PaperState); //试卷状态 int Count = -1; Count = DB.RunProc("Proc_PaperModify", Params); if (Count > 0) return true; else return false; }
//向Paper表中添加试卷信息(采用存储过程) //输出: // 插入成功:返回True; // 插入失败:返回False; public bool InsertByProc() { SqlParameter[] Params = new SqlParameter[3]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, CourseID); //科目编号 Params[1] = DB.MakeInParam("@PaperName", SqlDbType.VarChar, 200, PaperName); //试卷名称 Params[2] = DB.MakeInParam("@PaperState", SqlDbType.Bit,1, PaperState); //试卷状态 int Count = -1; Count = DB.RunProc("Proc_PaperAdd", 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(); 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); if (Count > 0) return true; else return false; }
public bool UpdateByProc(int XRoleId) { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@RoleId", SqlDbType.Int, 4, XRoleId); Params[1] = DB.MakeInParam("@RoleName", SqlDbType.VarChar, 50, RoleName); int Count = -1; Count = DB.RunProc("Proc_RoleModify", Params); if (Count > 0) return true; else return false; }
/// <summary> /// 考生第一次考某卷时要向TempExam插入一些必要的信息 /// </summary> /// <returns></returns> public bool SetExamBegin(string UserID, int PaperID) { SqlParameter[] Params = new SqlParameter[3]; DataBase DB = new DataBase(); // string strsql = "INSERT INTO TempExam (UserID, PaperID,BeginTime) VALUES ( @UserID,@PaperID,@BeginTime)"; Params[0] = DB.MakeInParam("@PaperID", SqlDbType.Int, 4, PaperID); Params[1] = DB.MakeInParam("@UserID", SqlDbType.VarChar, 20, UserID); Params[2] = DB.MakeInParam("@BeginTime", SqlDbType.DateTime, 8, DateTime.Now); int Count = -1; //Count = DB.ProcStr(strsql, Params); Count = DB.RunProc("Proc_TempExamAdd", Params); if (Count > 0) return true; else return false; }
//更新科目的信息 public bool UpdateByProc(int CID) { SqlParameter[] Params = new SqlParameter[2]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, CID); //用户编号 Params[1] = DB.MakeInParam("@Name", SqlDbType.VarChar, 200, Name); //用户权限 int Count = -1; Count = DB.RunProc("Proc_CourseModify", Params); if (Count > 0) return true; else return false; }
//更新多选题的信息 public bool UpdateByProc(int TID) { SqlParameter[] Params = new SqlParameter[9]; DataBase DB = new DataBase(); 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("@DiffID", SqlDbType.Int, 4, DiffID); //难度系数 Params[8] = DB.MakeInParam("@Answer", SqlDbType.VarChar, 50, Answer); //参考答案 int Count = -1; Count = DB.RunProc("Proc_MultiProblemModify", Params); if (Count > 0) return true; else return false; }
//�����ж������Ϣ public bool UpdateByProc(int TID) { SqlParameter[] Params = new SqlParameter[5]; DataBase DB = new DataBase(); 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("@DiffID", SqlDbType.Int, 4, DiffID); //�Ѷ�ϵ�� Params[4] = DB.MakeInParam("@Answer", SqlDbType.VarChar, 1000, Answer); //��A int Count = -1; Count = DB.RunProc("Proc_QuestionProblemModify", Params); if (Count > 0) return true; else return false; }
public bool DeleteByProc(int XRoleId) { SqlParameter[] Params = new SqlParameter[1]; DataBase DB = new DataBase(); Params[0] = DB.MakeInParam("@RoleId", SqlDbType.Int, 4,XRoleId); //��Ŀ��� int Count = -1; Count = DB.RunProc("Proc_RoleDelete", Params); if (Count > 0) return true; else return false; }