Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.AccessDataBase.Model.MediaVideo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into MediaVideo(");
            strSql.Append("MediaVideoID,MediaVideoName,MediaVideoFilePath,MediaVideoGroupID,MediaVideoType,PlayPriority)");
            strSql.Append(" values (");
            strSql.Append("@MediaVideoID,@MediaVideoName,@MediaVideoFilePath,@MediaVideoGroupID,@MediaVideoType,@PlayPriority)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MediaVideoID",       SqlDbType.Int,        4),
                new SqlParameter("@MediaVideoName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@MediaVideoFilePath", SqlDbType.NVarChar, 100),
                new SqlParameter("@MediaVideoGroupID",  SqlDbType.Int,        4),
                new SqlParameter("@MediaVideoType",     SqlDbType.Int,        4),
                new SqlParameter("@PlayPriority",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.MediaVideoID;
            parameters[1].Value = model.MediaVideoName;
            parameters[2].Value = model.MediaVideoFilePath;
            parameters[3].Value = model.MediaVideoGroupID;
            parameters[4].Value = model.MediaVideoType;
            parameters[5].Value = model.PlayPriority;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.MediaVideo DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.MediaVideo model = new KryptonAccessController.AccessDataBase.Model.MediaVideo();
     if (row != null)
     {
         if (row["MediaVideoID"] != null && row["MediaVideoID"].ToString() != "")
         {
             model.MediaVideoID = int.Parse(row["MediaVideoID"].ToString());
         }
         if (row["MediaVideoName"] != null)
         {
             model.MediaVideoName = row["MediaVideoName"].ToString();
         }
         if (row["MediaVideoFilePath"] != null)
         {
             model.MediaVideoFilePath = row["MediaVideoFilePath"].ToString();
         }
         if (row["MediaVideoGroupID"] != null && row["MediaVideoGroupID"].ToString() != "")
         {
             model.MediaVideoGroupID = int.Parse(row["MediaVideoGroupID"].ToString());
         }
         if (row["MediaVideoType"] != null && row["MediaVideoType"].ToString() != "")
         {
             model.MediaVideoType = int.Parse(row["MediaVideoType"].ToString());
         }
         if (row["PlayPriority"] != null && row["PlayPriority"].ToString() != "")
         {
             model.PlayPriority = int.Parse(row["PlayPriority"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.AccessDataBase.Model.MediaVideo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update MediaVideo set ");
            strSql.Append("MediaVideoName=@MediaVideoName,");
            strSql.Append("MediaVideoFilePath=@MediaVideoFilePath,");
            strSql.Append("MediaVideoGroupID=@MediaVideoGroupID,");
            strSql.Append("MediaVideoType=@MediaVideoType,");
            strSql.Append("PlayPriority=@PlayPriority");
            strSql.Append(" where MediaVideoID=@MediaVideoID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MediaVideoName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@MediaVideoFilePath", SqlDbType.NVarChar, 100),
                new SqlParameter("@MediaVideoGroupID",  SqlDbType.Int,        4),
                new SqlParameter("@MediaVideoType",     SqlDbType.Int,        4),
                new SqlParameter("@PlayPriority",       SqlDbType.Int,        4),
                new SqlParameter("@MediaVideoID",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.MediaVideoName;
            parameters[1].Value = model.MediaVideoFilePath;
            parameters[2].Value = model.MediaVideoGroupID;
            parameters[3].Value = model.MediaVideoType;
            parameters[4].Value = model.PlayPriority;
            parameters[5].Value = model.MediaVideoID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.MediaVideo GetModel(int MediaVideoID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 MediaVideoID,MediaVideoName,MediaVideoFilePath,MediaVideoGroupID,MediaVideoType,PlayPriority from MediaVideo ");
            strSql.Append(" where MediaVideoID=@MediaVideoID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MediaVideoID", SqlDbType.Int, 4)
            };
            parameters[0].Value = MediaVideoID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.AccessDataBase.Model.MediaVideo DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.MediaVideo model=new KryptonAccessController.AccessDataBase.Model.MediaVideo();
     if (row != null)
     {
         if(row["MediaVideoID"]!=null && row["MediaVideoID"].ToString()!="")
         {
             model.MediaVideoID=int.Parse(row["MediaVideoID"].ToString());
         }
         if(row["MediaVideoName"]!=null)
         {
             model.MediaVideoName=row["MediaVideoName"].ToString();
         }
         if(row["MediaVideoFilePath"]!=null)
         {
             model.MediaVideoFilePath=row["MediaVideoFilePath"].ToString();
         }
         if(row["MediaVideoGroupID"]!=null && row["MediaVideoGroupID"].ToString()!="")
         {
             model.MediaVideoGroupID=int.Parse(row["MediaVideoGroupID"].ToString());
         }
         if(row["MediaVideoType"]!=null && row["MediaVideoType"].ToString()!="")
         {
             model.MediaVideoType=int.Parse(row["MediaVideoType"].ToString());
         }
         if(row["PlayPriority"]!=null && row["PlayPriority"].ToString()!="")
         {
             model.PlayPriority=int.Parse(row["PlayPriority"].ToString());
         }
     }
     return model;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.AccessDataBase.Model.MediaVideo GetModel(int MediaVideoID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 MediaVideoID,MediaVideoName,MediaVideoFilePath,MediaVideoGroupID,MediaVideoType,PlayPriority from MediaVideo ");
            strSql.Append(" where MediaVideoID=@MediaVideoID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@MediaVideoID", SqlDbType.Int,4)			};
            parameters[0].Value = MediaVideoID;

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