Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MUSE.Model.CourseTypeCode model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into 课程类型代码表(");
            strSql.Append("课程类型代码,课程类型,排序,是否启用,备注)");
            strSql.Append(" values (");
            strSql.Append("@课程类型代码,@课程类型,@排序,@是否启用,@备注)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@课程类型代码", SqlDbType.VarChar,  2),
                new SqlParameter("@课程类型",   SqlDbType.VarChar, 10),
                new SqlParameter("@排序",     SqlDbType.Int,      4),
                new SqlParameter("@是否启用",   SqlDbType.VarChar,  2),
                new SqlParameter("@备注",     SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.课程类型代码;
            parameters[1].Value = model.课程类型;
            parameters[2].Value = model.排序;
            parameters[3].Value = model.是否启用;
            parameters[4].Value = model.备注;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MUSE.Model.CourseTypeCode DataRowToModel(DataRow row)
 {
     MUSE.Model.CourseTypeCode model = new MUSE.Model.CourseTypeCode();
     if (row != null)
     {
         if (row["课程类型代码"] != null)
         {
             model.课程类型代码 = row["课程类型代码"].ToString();
         }
         if (row["课程类型"] != null)
         {
             model.课程类型 = row["课程类型"].ToString();
         }
         if (row["排序"] != null && row["排序"].ToString() != "")
         {
             model.排序 = int.Parse(row["排序"].ToString());
         }
         if (row["是否启用"] != null)
         {
             model.是否启用 = row["是否启用"].ToString();
         }
         if (row["备注"] != null)
         {
             model.备注 = row["备注"].ToString();
         }
     }
     return(model);
 }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MUSE.Model.CourseTypeCode GetModel(string 课程类型代码, string 课程类型, int 排序, string 是否启用, string 备注)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 课程类型代码,课程类型,排序,是否启用,备注 from 课程类型代码表 ");
            strSql.Append(" where 课程类型代码=@课程类型代码 and 课程类型=@课程类型 and 排序=@排序 and 是否启用=@是否启用 and 备注=@备注 ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@课程类型代码", SqlDbType.VarChar,  2),
                new SqlParameter("@课程类型",   SqlDbType.VarChar, 10),
                new SqlParameter("@排序",     SqlDbType.Int,      4),
                new SqlParameter("@是否启用",   SqlDbType.VarChar,  2),
                new SqlParameter("@备注",     SqlDbType.VarChar, 50)
            };
            parameters[0].Value = 课程类型代码;
            parameters[1].Value = 课程类型;
            parameters[2].Value = 排序;
            parameters[3].Value = 是否启用;
            parameters[4].Value = 备注;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MUSE.Model.CourseTypeCode model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update 课程类型代码表 set ");
            strSql.Append("课程类型代码=@课程类型代码,");
            strSql.Append("课程类型=@课程类型,");
            strSql.Append("排序=@排序,");
            strSql.Append("是否启用=@是否启用,");
            strSql.Append("备注=@备注");
            strSql.Append(" where 课程类型代码=@课程类型代码 and 课程类型=@课程类型 and 排序=@排序 and 是否启用=@是否启用 and 备注=@备注 ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@课程类型代码", SqlDbType.VarChar,  2),
                new SqlParameter("@课程类型",   SqlDbType.VarChar, 10),
                new SqlParameter("@排序",     SqlDbType.Int,      4),
                new SqlParameter("@是否启用",   SqlDbType.VarChar,  2),
                new SqlParameter("@备注",     SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.课程类型代码;
            parameters[1].Value = model.课程类型;
            parameters[2].Value = model.排序;
            parameters[3].Value = model.是否启用;
            parameters[4].Value = model.备注;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(MUSE.Model.CourseTypeCode model)
 {
     return(dal.Update(model));
 }
Esempio n. 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(MUSE.Model.CourseTypeCode model)
 {
     return(dal.Add(model));
 }