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

            strSql.Append("insert into MediaPicture(");
            strSql.Append("MediaPictureID,MediaPictureName,MediaPicturePath,MediaPictureGroupID,MediaPicgureType,PlayPriority)");
            strSql.Append(" values (");
            strSql.Append("@MediaPictureID,@MediaPictureName,@MediaPicturePath,@MediaPictureGroupID,@MediaPicgureType,@PlayPriority)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MediaPictureID",      SqlDbType.Int,        4),
                new SqlParameter("@MediaPictureName",    SqlDbType.NVarChar,  50),
                new SqlParameter("@MediaPicturePath",    SqlDbType.VarChar,  100),
                new SqlParameter("@MediaPictureGroupID", SqlDbType.Int,        4),
                new SqlParameter("@MediaPicgureType",    SqlDbType.Int,        4),
                new SqlParameter("@PlayPriority",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.MediaPictureID;
            parameters[1].Value = model.MediaPictureName;
            parameters[2].Value = model.MediaPicturePath;
            parameters[3].Value = model.MediaPictureGroupID;
            parameters[4].Value = model.MediaPicgureType;
            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.MediaPicture DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.MediaPicture model = new KryptonAccessController.AccessDataBase.Model.MediaPicture();
     if (row != null)
     {
         if (row["MediaPictureID"] != null && row["MediaPictureID"].ToString() != "")
         {
             model.MediaPictureID = int.Parse(row["MediaPictureID"].ToString());
         }
         if (row["MediaPictureName"] != null)
         {
             model.MediaPictureName = row["MediaPictureName"].ToString();
         }
         if (row["MediaPicturePath"] != null)
         {
             model.MediaPicturePath = row["MediaPicturePath"].ToString();
         }
         if (row["MediaPictureGroupID"] != null && row["MediaPictureGroupID"].ToString() != "")
         {
             model.MediaPictureGroupID = int.Parse(row["MediaPictureGroupID"].ToString());
         }
         if (row["MediaPicgureType"] != null && row["MediaPicgureType"].ToString() != "")
         {
             model.MediaPicgureType = int.Parse(row["MediaPicgureType"].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.MediaPicture model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update MediaPicture set ");
            strSql.Append("MediaPictureName=@MediaPictureName,");
            strSql.Append("MediaPicturePath=@MediaPicturePath,");
            strSql.Append("MediaPictureGroupID=@MediaPictureGroupID,");
            strSql.Append("MediaPicgureType=@MediaPicgureType,");
            strSql.Append("PlayPriority=@PlayPriority");
            strSql.Append(" where MediaPictureID=@MediaPictureID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MediaPictureName",    SqlDbType.NVarChar,  50),
                new SqlParameter("@MediaPicturePath",    SqlDbType.VarChar,  100),
                new SqlParameter("@MediaPictureGroupID", SqlDbType.Int,        4),
                new SqlParameter("@MediaPicgureType",    SqlDbType.Int,        4),
                new SqlParameter("@PlayPriority",        SqlDbType.Int,        4),
                new SqlParameter("@MediaPictureID",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.MediaPictureName;
            parameters[1].Value = model.MediaPicturePath;
            parameters[2].Value = model.MediaPictureGroupID;
            parameters[3].Value = model.MediaPicgureType;
            parameters[4].Value = model.PlayPriority;
            parameters[5].Value = model.MediaPictureID;

            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.MediaPicture GetModel(int MediaPictureID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 MediaPictureID,MediaPictureName,MediaPicturePath,MediaPictureGroupID,MediaPicgureType,PlayPriority from MediaPicture ");
            strSql.Append(" where MediaPictureID=@MediaPictureID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MediaPictureID", SqlDbType.Int, 4)
            };
            parameters[0].Value = MediaPictureID;

            KryptonAccessController.AccessDataBase.Model.MediaPicture model = new KryptonAccessController.AccessDataBase.Model.MediaPicture();
            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.MediaPicture DataRowToModel(DataRow row)
 {
     KryptonAccessController.AccessDataBase.Model.MediaPicture model=new KryptonAccessController.AccessDataBase.Model.MediaPicture();
     if (row != null)
     {
         if(row["MediaPictureID"]!=null && row["MediaPictureID"].ToString()!="")
         {
             model.MediaPictureID=int.Parse(row["MediaPictureID"].ToString());
         }
         if(row["MediaPictureName"]!=null)
         {
             model.MediaPictureName=row["MediaPictureName"].ToString();
         }
         if(row["MediaPicturePath"]!=null)
         {
             model.MediaPicturePath=row["MediaPicturePath"].ToString();
         }
         if(row["MediaPictureGroupID"]!=null && row["MediaPictureGroupID"].ToString()!="")
         {
             model.MediaPictureGroupID=int.Parse(row["MediaPictureGroupID"].ToString());
         }
         if(row["MediaPicgureType"]!=null && row["MediaPicgureType"].ToString()!="")
         {
             model.MediaPicgureType=int.Parse(row["MediaPicgureType"].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.MediaPicture GetModel(int MediaPictureID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 MediaPictureID,MediaPictureName,MediaPicturePath,MediaPictureGroupID,MediaPicgureType,PlayPriority from MediaPicture ");
            strSql.Append(" where MediaPictureID=@MediaPictureID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@MediaPictureID", SqlDbType.Int,4)			};
            parameters[0].Value = MediaPictureID;

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