/// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(university.Model.CCOM.Teach_week model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Teach_week set ");
            strSql.Append("Start_time=@Start_time,");
            strSql.Append("End_time=@End_time,");
            strSql.Append("State=@State");
            strSql.Append(" where TeachWeek_id=@TeachWeek_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Start_time",   SqlDbType.Date, 3),
                new SqlParameter("@End_time",     SqlDbType.Date, 3),
                new SqlParameter("@State",        SqlDbType.Bit,  1),
                new SqlParameter("@TeachWeek_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Start_time;
            parameters[1].Value = model.End_time;
            parameters[2].Value = model.State;
            parameters[3].Value = model.TeachWeek_id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public university.Model.CCOM.Teach_week DataRowToModel(DataRow row)
 {
     university.Model.CCOM.Teach_week model = new university.Model.CCOM.Teach_week();
     if (row != null)
     {
         if (row["TeachWeek_id"] != null && row["TeachWeek_id"].ToString() != "")
         {
             model.TeachWeek_id = int.Parse(row["TeachWeek_id"].ToString());
         }
         if (row["Start_time"] != null && row["Start_time"].ToString() != "")
         {
             model.Start_time = DateTime.Parse(row["Start_time"].ToString());
         }
         if (row["End_time"] != null && row["End_time"].ToString() != "")
         {
             model.End_time = DateTime.Parse(row["End_time"].ToString());
         }
         if (row["State"] != null && row["State"].ToString() != "")
         {
             if ((row["State"].ToString() == "1") || (row["State"].ToString().ToLower() == "true"))
             {
                 model.State = true;
             }
             else
             {
                 model.State = false;
             }
         }
     }
     return(model);
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(university.Model.CCOM.Teach_week model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Teach_week(");
            strSql.Append("Start_time,End_time,State)");
            strSql.Append(" values (");
            strSql.Append("@Start_time,@End_time,@State)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Start_time", SqlDbType.Date, 3),
                new SqlParameter("@End_time",   SqlDbType.Date, 3),
                new SqlParameter("@State",      SqlDbType.Bit, 1)
            };
            parameters[0].Value = model.Start_time;
            parameters[1].Value = model.End_time;
            parameters[2].Value = model.State;

            object obj = DBSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.Teach_week GetModel(int TeachWeek_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 TeachWeek_id,Start_time,End_time,State from Teach_week ");
            strSql.Append(" where TeachWeek_id=@TeachWeek_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TeachWeek_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = TeachWeek_id;

            university.Model.CCOM.Teach_week model = new university.Model.CCOM.Teach_week();
            DataSet ds = DBSQL.Query(strSql.ToString(), parameters);

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