Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(JPGL.Model.tbJC model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tbJC set ");
            strSql.Append("CourseNo=@CourseNo,");
            strSql.Append("TeacherNo=@TeacherNo,");
            strSql.Append("JCRoom=@JCRoom");
            strSql.Append(" where JCNo=@JCNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CourseNo",  SqlDbType.VarChar, 50),
                new SqlParameter("@TeacherNo", SqlDbType.VarChar, 50),
                new SqlParameter("@JCRoom",    SqlDbType.VarChar, 50),
                new SqlParameter("@JCNo",      SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.CourseNo;
            parameters[1].Value = model.TeacherNo;
            parameters[2].Value = model.JCRoom;
            parameters[3].Value = model.JCNo;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(JPGL.Model.tbJC model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tbJC(");
            strSql.Append("JCNo,CourseNo,TeacherNo,JCRoom)");
            strSql.Append(" values (");
            strSql.Append("@JCNo,@CourseNo,@TeacherNo,@JCRoom)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@JCNo",      SqlDbType.VarChar, 50),
                new SqlParameter("@CourseNo",  SqlDbType.VarChar, 50),
                new SqlParameter("@TeacherNo", SqlDbType.VarChar, 50),
                new SqlParameter("@JCRoom",    SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.JCNo;
            parameters[1].Value = model.CourseNo;
            parameters[2].Value = model.TeacherNo;
            parameters[3].Value = model.JCRoom;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public JPGL.Model.tbJC DataRowToModel(DataRow row)
 {
     JPGL.Model.tbJC model = new JPGL.Model.tbJC();
     if (row != null)
     {
         if (row["JCNo"] != null)
         {
             model.JCNo = row["JCNo"].ToString();
         }
         if (row["CourseNo"] != null)
         {
             model.CourseNo = row["CourseNo"].ToString();
         }
         if (row["TeacherNo"] != null)
         {
             model.TeacherNo = row["TeacherNo"].ToString();
         }
         if (row["JCRoom"] != null)
         {
             model.JCRoom = row["JCRoom"].ToString();
         }
     }
     return(model);
 }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JPGL.Model.tbJC GetModel(string JCNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 JCNo,CourseNo,TeacherNo,JCRoom from tbJC ");
            strSql.Append(" where JCNo=@JCNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@JCNo", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = JCNo;

            JPGL.Model.tbJC model = new JPGL.Model.tbJC();
            DataSet         ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }