コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XHD.Model.shop_purchase_log model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update shop_purchase_log set ");
            strSql.Append("oid=@oid,");
            strSql.Append("gid=@gid,");
            strSql.Append("p_status=@p_status,");
            strSql.Append("username=@username,");
            strSql.Append("action_info=@action_info,");
            strSql.Append("action_time=@action_time");
            strSql.Append(" where aid=@aid ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@oid",         MySqlDbType.Int32,   11),
                new MySqlParameter("@gid",         MySqlDbType.Int32,   11),
                new MySqlParameter("@p_status",    MySqlDbType.Int32,    2),
                new MySqlParameter("@username",    MySqlDbType.VarChar, 10),
                new MySqlParameter("@action_info", MySqlDbType.Text),
                new MySqlParameter("@action_time", MySqlDbType.Int32,   11),
                new MySqlParameter("@aid",         MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.oid;
            parameters[1].Value = model.gid;
            parameters[2].Value = model.p_status;
            parameters[3].Value = model.username;
            parameters[4].Value = model.action_info;
            parameters[5].Value = model.action_time;
            parameters[6].Value = model.aid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(XHD.Model.shop_purchase_log model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into shop_purchase_log(");
            strSql.Append("aid,oid,gid,p_status,username,action_info,action_time)");
            strSql.Append(" values (");
            strSql.Append("@aid,@oid,@gid,@p_status,@username,@action_info,@action_time)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@aid",         MySqlDbType.Int32,   11),
                new MySqlParameter("@oid",         MySqlDbType.Int32,   11),
                new MySqlParameter("@gid",         MySqlDbType.Int32,   11),
                new MySqlParameter("@p_status",    MySqlDbType.Int32,    2),
                new MySqlParameter("@username",    MySqlDbType.VarChar, 10),
                new MySqlParameter("@action_info", MySqlDbType.Text),
                new MySqlParameter("@action_time", MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.aid;
            parameters[1].Value = model.oid;
            parameters[2].Value = model.gid;
            parameters[3].Value = model.p_status;
            parameters[4].Value = model.username;
            parameters[5].Value = model.action_info;
            parameters[6].Value = model.action_time;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XHD.Model.shop_purchase_log DataRowToModel(DataRow row)
 {
     XHD.Model.shop_purchase_log model = new XHD.Model.shop_purchase_log();
     if (row != null)
     {
         if (row["aid"] != null && row["aid"].ToString() != "")
         {
             model.aid = int.Parse(row["aid"].ToString());
         }
         if (row["oid"] != null && row["oid"].ToString() != "")
         {
             model.oid = int.Parse(row["oid"].ToString());
         }
         if (row["gid"] != null && row["gid"].ToString() != "")
         {
             model.gid = int.Parse(row["gid"].ToString());
         }
         if (row["p_status"] != null && row["p_status"].ToString() != "")
         {
             model.p_status = int.Parse(row["p_status"].ToString());
         }
         if (row["username"] != null)
         {
             model.username = row["username"].ToString();
         }
         if (row["action_info"] != null)
         {
             model.action_info = row["action_info"].ToString();
         }
         if (row["action_time"] != null && row["action_time"].ToString() != "")
         {
             model.action_time = int.Parse(row["action_time"].ToString());
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XHD.Model.shop_purchase_log GetModel(int aid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select aid,oid,gid,p_status,username,action_info,action_time from shop_purchase_log ");
            strSql.Append(" where aid=@aid ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@aid", MySqlDbType.Int32, 11)
            };
            parameters[0].Value = aid;

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

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