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

            strSql.Append("insert into ssn_art_app(");
            strSql.Append("App_name,App_order,App_url,App_handler,App_type,App_icon)");
            strSql.Append(" values (");
            strSql.Append("@App_name,@App_order,@App_url,@App_handler,@App_type,@App_icon)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@App_name",    MySqlDbType.VarChar, 100),
                new MySqlParameter("@App_order",   MySqlDbType.Int32,    11),
                new MySqlParameter("@App_url",     MySqlDbType.VarChar, 250),
                new MySqlParameter("@App_handler", MySqlDbType.VarChar, 250),
                new MySqlParameter("@App_type",    MySqlDbType.VarChar,  50),
                new MySqlParameter("@App_icon",    MySqlDbType.VarChar, 250)
            };
            parameters[0].Value = model.App_name;
            parameters[1].Value = model.App_order;
            parameters[2].Value = model.App_url;
            parameters[3].Value = model.App_handler;
            parameters[4].Value = model.App_type;
            parameters[5].Value = model.App_icon;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XHD.Model.ssn_art_app model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ssn_art_app set ");
            strSql.Append("App_name=@App_name,");
            strSql.Append("App_order=@App_order,");
            strSql.Append("App_url=@App_url,");
            strSql.Append("App_handler=@App_handler,");
            strSql.Append("App_type=@App_type,");
            strSql.Append("App_icon=@App_icon");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@App_name",    MySqlDbType.VarChar, 100),
                new MySqlParameter("@App_order",   MySqlDbType.Int32,    11),
                new MySqlParameter("@App_url",     MySqlDbType.VarChar, 250),
                new MySqlParameter("@App_handler", MySqlDbType.VarChar, 250),
                new MySqlParameter("@App_type",    MySqlDbType.VarChar,  50),
                new MySqlParameter("@App_icon",    MySqlDbType.VarChar, 250),
                new MySqlParameter("@id",          MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.App_name;
            parameters[1].Value = model.App_order;
            parameters[2].Value = model.App_url;
            parameters[3].Value = model.App_handler;
            parameters[4].Value = model.App_type;
            parameters[5].Value = model.App_icon;
            parameters[6].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XHD.Model.ssn_art_app DataRowToModel(DataRow row)
 {
     XHD.Model.ssn_art_app model = new XHD.Model.ssn_art_app();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["App_name"] != null)
         {
             model.App_name = row["App_name"].ToString();
         }
         if (row["App_order"] != null && row["App_order"].ToString() != "")
         {
             model.App_order = int.Parse(row["App_order"].ToString());
         }
         if (row["App_url"] != null)
         {
             model.App_url = row["App_url"].ToString();
         }
         if (row["App_handler"] != null)
         {
             model.App_handler = row["App_handler"].ToString();
         }
         if (row["App_type"] != null)
         {
             model.App_type = row["App_type"].ToString();
         }
         if (row["App_icon"] != null)
         {
             model.App_icon = row["App_icon"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XHD.Model.ssn_art_app GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,App_name,App_order,App_url,App_handler,App_type,App_icon from ssn_art_app ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            XHD.Model.ssn_art_app model = new XHD.Model.ssn_art_app();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }