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

            strSql.Append("update MediaVideoGroup set ");
            strSql.Append("MediaVideoGroupName=@MediaVideoGroupName,");
            strSql.Append("MediaVideoGroupDes=@MediaVideoGroupDes");
            strSql.Append(" where MediaVideoGroupID=@MediaVideoGroupID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MediaVideoGroupName", SqlDbType.NVarChar,  50),
                new SqlParameter("@MediaVideoGroupDes",  SqlDbType.NVarChar, 100),
                new SqlParameter("@MediaVideoGroupID",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.MediaVideoGroupName;
            parameters[1].Value = model.MediaVideoGroupDes;
            parameters[2].Value = model.MediaVideoGroupID;

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

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

            strSql.Append("insert into MediaVideoGroup(");
            strSql.Append("MediaVideoGroupID,MediaVideoGroupName,MediaVideoGroupDes)");
            strSql.Append(" values (");
            strSql.Append("@MediaVideoGroupID,@MediaVideoGroupName,@MediaVideoGroupDes)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MediaVideoGroupID",   SqlDbType.Int,       4),
                new SqlParameter("@MediaVideoGroupName", SqlDbType.NVarChar, 50),
                new SqlParameter("@MediaVideoGroupDes",  SqlDbType.NVarChar, 100)
            };
            parameters[0].Value = model.MediaVideoGroupID;
            parameters[1].Value = model.MediaVideoGroupName;
            parameters[2].Value = model.MediaVideoGroupDes;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.MediaVideoGroup DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.MediaVideoGroup model=new KryptonAccessController.AccessDataBase.Model.MediaVideoGroup();
     if (row != null)
     {
         if(row["MediaVideoGroupID"]!=null && row["MediaVideoGroupID"].ToString()!="")
         {
             model.MediaVideoGroupID=int.Parse(row["MediaVideoGroupID"].ToString());
         }
         if(row["MediaVideoGroupName"]!=null)
         {
             model.MediaVideoGroupName=row["MediaVideoGroupName"].ToString();
         }
         if(row["MediaVideoGroupDes"]!=null)
         {
             model.MediaVideoGroupDes=row["MediaVideoGroupDes"].ToString();
         }
     }
     return model;
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.MediaVideoGroup DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.MediaVideoGroup model = new KryptonAccessController.AccessDataBase.Model.MediaVideoGroup();
     if (row != null)
     {
         if (row["MediaVideoGroupID"] != null && row["MediaVideoGroupID"].ToString() != "")
         {
             model.MediaVideoGroupID = int.Parse(row["MediaVideoGroupID"].ToString());
         }
         if (row["MediaVideoGroupName"] != null)
         {
             model.MediaVideoGroupName = row["MediaVideoGroupName"].ToString();
         }
         if (row["MediaVideoGroupDes"] != null)
         {
             model.MediaVideoGroupDes = row["MediaVideoGroupDes"].ToString();
         }
     }
     return(model);
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.MediaVideoGroup GetModel(int MediaVideoGroupID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 MediaVideoGroupID,MediaVideoGroupName,MediaVideoGroupDes from MediaVideoGroup ");
            strSql.Append(" where MediaVideoGroupID=@MediaVideoGroupID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MediaVideoGroupID", SqlDbType.Int, 4)
            };
            parameters[0].Value = MediaVideoGroupID;

            KryptonAccessController.AccessDataBase.Model.MediaVideoGroup model = new KryptonAccessController.AccessDataBase.Model.MediaVideoGroup();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.MediaVideoGroup GetModel(int MediaVideoGroupID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 MediaVideoGroupID,MediaVideoGroupName,MediaVideoGroupDes from MediaVideoGroup ");
            strSql.Append(" where MediaVideoGroupID=@MediaVideoGroupID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@MediaVideoGroupID", SqlDbType.Int,4)			};
            parameters[0].Value = MediaVideoGroupID;

            KryptonAccessController.AccessDataBase.Model.MediaVideoGroup model=new KryptonAccessController.AccessDataBase.Model.MediaVideoGroup();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }