コード例 #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo model=new KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo();
     if (row != null)
     {
         if(row["EventPictureID"]!=null && row["EventPictureID"].ToString()!="")
         {
             model.EventPictureID=int.Parse(row["EventPictureID"].ToString());
         }
         if(row["EventPictureName"]!=null)
         {
             model.EventPictureName=row["EventPictureName"].ToString();
         }
         if(row["EventPictureComercial"]!=null && row["EventPictureComercial"].ToString()!="")
         {
             model.EventPictureComercial=int.Parse(row["EventPictureComercial"].ToString());
         }
         if(row["EventPictureType"]!=null && row["EventPictureType"].ToString()!="")
         {
             model.EventPictureType=int.Parse(row["EventPictureType"].ToString());
         }
         if(row["EventPictureImage"]!=null && row["EventPictureImage"].ToString()!="")
         {
             model.EventPictureImage=(byte[])row["EventPictureImage"];
         }
     }
     return model;
 }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into EventPictureInfo(");
            strSql.Append("EventPictureID,EventPictureName,EventPictureComercial,EventPictureType,EventPictureImage)");
            strSql.Append(" values (");
            strSql.Append("@EventPictureID,@EventPictureName,@EventPictureComercial,@EventPictureType,@EventPictureImage)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@EventPictureID",        DbType.Int32,   4),
                new SQLiteParameter("@EventPictureName",      DbType.String),
                new SQLiteParameter("@EventPictureComercial", DbType.Int32,   4),
                new SQLiteParameter("@EventPictureType",      DbType.Int32,   4),
                new SQLiteParameter("@EventPictureImage",     DbType.Binary)
            };
            parameters[0].Value = model.EventPictureID;
            parameters[1].Value = model.EventPictureName;
            parameters[2].Value = model.EventPictureComercial;
            parameters[3].Value = model.EventPictureType;
            parameters[4].Value = model.EventPictureImage;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo model = new KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo();
     if (row != null)
     {
         if (row["EventPictureID"] != null && row["EventPictureID"].ToString() != "")
         {
             model.EventPictureID = int.Parse(row["EventPictureID"].ToString());
         }
         if (row["EventPictureName"] != null)
         {
             model.EventPictureName = row["EventPictureName"].ToString();
         }
         if (row["EventPictureComercial"] != null && row["EventPictureComercial"].ToString() != "")
         {
             model.EventPictureComercial = int.Parse(row["EventPictureComercial"].ToString());
         }
         if (row["EventPictureType"] != null && row["EventPictureType"].ToString() != "")
         {
             model.EventPictureType = int.Parse(row["EventPictureType"].ToString());
         }
         if (row["EventPictureImage"] != null && row["EventPictureImage"].ToString() != "")
         {
             model.EventPictureImage = (byte[])row["EventPictureImage"];
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update EventPictureInfo set ");
            strSql.Append("EventPictureName=@EventPictureName,");
            strSql.Append("EventPictureComercial=@EventPictureComercial,");
            strSql.Append("EventPictureType=@EventPictureType,");
            strSql.Append("EventPictureImage=@EventPictureImage");
            strSql.Append(" where EventPictureID=@EventPictureID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@EventPictureName",      DbType.String),
                new SQLiteParameter("@EventPictureComercial", DbType.Int32,   4),
                new SQLiteParameter("@EventPictureType",      DbType.Int32,   4),
                new SQLiteParameter("@EventPictureImage",     DbType.Binary),
                new SQLiteParameter("@EventPictureID",        DbType.Int32, 4)
            };
            parameters[0].Value = model.EventPictureName;
            parameters[1].Value = model.EventPictureComercial;
            parameters[2].Value = model.EventPictureType;
            parameters[3].Value = model.EventPictureImage;
            parameters[4].Value = model.EventPictureID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo GetModel(int EventPictureID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select EventPictureID,EventPictureName,EventPictureComercial,EventPictureType,EventPictureImage from EventPictureInfo ");
            strSql.Append(" where EventPictureID=@EventPictureID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@EventPictureID", DbType.Int32, 4)
            };
            parameters[0].Value = EventPictureID;

            KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo model = new KryptonAccessController.SQLite.Model.InteractRelation.EventPictureInfo();
            DataSet ds = DbHelperSQLite.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.SQLite.Model.InteractRelation.EventPictureInfo GetModel(int EventPictureID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select EventPictureID,EventPictureName,EventPictureComercial,EventPictureType,EventPictureImage from EventPictureInfo ");
            strSql.Append(" where EventPictureID=@EventPictureID ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@EventPictureID", DbType.Int32,4)			};
            parameters[0].Value = EventPictureID;

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