您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->多功能在线考试系统源码>>App-Code/BusinessLogicLayer/FillBlankProblem.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:多功能在线考试系统源码
当前文件:文件类型 OnLineExam/App_Code/BusinessLogicLayer/FillBlankProblem.cs打开代码结构图
高亮显示
		            using System;
using System.Data;
using System.Collections;
using System.Data.SqlClient;
using MyOnLineExam.DataAccessLayer;
using MyOnLineExam.DataAccessHelper;


namespace MyOnLineExam.BusinessLogicLayer
{
    //填空题类
    public class FillBlankProblem
    {
        #region 私有成员
        private int _ID;                                               //题目编号
        private int _CourseID;                                         //所属科目        
        private string _FrontTitle;                                    //题目前部分    
        private string _BackTitle;                                     //题目后部分
        private string _Answer;                                        //答案

        #endregion 私有成员

        #region 属性

        public int ID
        {
            set
            {
                this._ID = value;
            }
            get
            {
                return this._ID;
            }
        }
        public int CourseID
        {
            set
            {
                this._CourseID = value;
            }
            get
            {
                return this._CourseID;
            }
        }
        public string FrontTitle
        {
            set
            {
                this._FrontTitle = value;
            }
            get
            {
                return this._FrontTitle;
            }
        }
        public string BackTitle
        {
            set
            {
                this._BackTitle = value;
            }
            get
            {
                return this._BackTitle;
            }
        }
        public string Answer
        {
            set
            {
                this._Answer = value;
            }
            get
            {
                return this._Answer;
            }
        }
        
        #endregion 属性

        #region 方法

        //根据题目ID 初始化题目
        //输入:
        //      TID - 题目编号;
        //输出:
        //      题目存在:返回True;
        //      题目不在:返回False;
        public bool LoadData(int TID)
        {
            SqlParameter[] Params = new SqlParameter[1];
            DataBase DB = new DataBase();

            Params[0] = DB.MakeInParam("@ID", SqlDbType.Int, 4, TID);                  //用户编号            

            DataSet ds = DB.GetDataSet("Proc_FillBlankProblemDetail", Params);
            ds.CaseSensitive = false;
            DataRow DR;
            if (ds.Tables[0].Rows.Count > 0)
            {
                DR = ds.Tables[0].Rows[0];
                this._CourseID = GetSafeData.ValidateDataRow_N(DR, "CourseID");                   //科目编号                
                this._FrontTitle = GetSafeData.ValidateDataRow_S(DR, "FrontTitle");               //题目前部分
                this._BackTitle = GetSafeData.ValidateDataRow_S(DR, "BackTitle");                 //题目后部分                
                this._Answer = GetSafeData.ValidateDataRow_S(DR, "Answer");                       //答案
                return true;
            }
            else
            {
                return false;
            }
        }


        //向FillBlankProblem表中添加题目信息(采用存储过程)
        //输出:
        //      插入成功:返回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("@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.RunProc("Proc_FillBlankProblemAdd", 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("@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.RunProc("Proc_FillBlankProblemModify", 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_FillBlankProblemDelete", Params);
            if (Count > 0)
                return true;
            else return false;
        }

        //查询单选题
        //课程编号
        public DataSet QueryFillBlankProblem(int TCourseID)
        {
            SqlParameter[] Params = new SqlParameter[1];

            DataBase DB = new DataBase();

            Params[0] = DB.MakeInParam("@CourseID", SqlDbType.Int, 4, TCourseID);               //题目编号           
            return DB.GetDataSet("Proc_FillBlankProblemList", Params);
        }

        #endregion 方法
    }
}

        
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:多功能在线考试系统源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号