/// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TwitterSpamDetection.Model.t_ind_pullhistory DataRowToModel(DataRow row)
 {
     TwitterSpamDetection.Model.t_ind_pullhistory model = new TwitterSpamDetection.Model.t_ind_pullhistory();
     if (row != null)
     {
         if (row["ID"] != null)
         {
             model.ID = row["ID"].ToString();
         }
         if (row["NumOfPull"] != null)
         {
             model.NumOfPull = row["NumOfPull"].ToString();
         }
         if (row["NumOfTotal"] != null)
         {
             model.NumOfTotal = row["NumOfTotal"].ToString();
         }
         if (row["PullDate"] != null && row["PullDate"].ToString() != "")
         {
             model.PullDate = DateTime.Parse(row["PullDate"].ToString());
         }
         if (row["IsSuccessful"] != null && row["IsSuccessful"].ToString() != "")
         {
             model.IsSuccessful = int.Parse(row["IsSuccessful"].ToString());
         }
         if (row["UserID"] != null)
         {
             model.UserID = row["UserID"].ToString();
         }
     }
     return(model);
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public string Add(TwitterSpamDetection.Model.t_ind_pullhistory model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into t_ind_pullhistory(");
            strSql.Append("ID,NumOfPull,NumOfTotal,PullDate,IsSuccessful,UserID)");
            strSql.Append(" values (");
            strSql.Append("@ID,@NumOfPull,@NumOfTotal,@PullDate,@IsSuccessful,@UserID)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@ID",           MySqlDbType.VarChar,   36),
                new MySqlParameter("@NumOfPull",    MySqlDbType.VarChar,   45),
                new MySqlParameter("@NumOfTotal",   MySqlDbType.VarChar,   45),
                new MySqlParameter("@PullDate",     MySqlDbType.DateTime),
                new MySqlParameter("@IsSuccessful", MySqlDbType.Int32,      4),
                new MySqlParameter("@UserID",       MySqlDbType.VarChar, 36)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.NumOfPull;
            parameters[2].Value = model.NumOfTotal;
            parameters[3].Value = model.PullDate;
            parameters[4].Value = model.IsSuccessful;
            parameters[5].Value = model.UserID;

            int result = 0;

            try
            {
                result = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
            }
            catch { }
            if (result > 0)
            {
                return("");
            }
            else
            {
                return("Failed to save the pull action.");
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TwitterSpamDetection.Model.t_ind_pullhistory model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update t_ind_pullhistory set ");
            strSql.Append("NumOfPull=@NumOfPull,");
            strSql.Append("NumOfTotal=@NumOfTotal,");
            strSql.Append("PullDate=@PullDate,");
            strSql.Append("IsSuccessful=@IsSuccessful,");
            strSql.Append("UserID=@UserID");
            strSql.Append(" where ID=@ID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@NumOfPull",    MySqlDbType.VarChar,   45),
                new MySqlParameter("@NumOfTotal",   MySqlDbType.VarChar,   45),
                new MySqlParameter("@PullDate",     MySqlDbType.DateTime),
                new MySqlParameter("@IsSuccessful", MySqlDbType.Int32,      4),
                new MySqlParameter("@UserID",       MySqlDbType.VarChar,   36),
                new MySqlParameter("@ID",           MySqlDbType.VarChar, 36)
            };
            parameters[0].Value = model.NumOfPull;
            parameters[1].Value = model.NumOfTotal;
            parameters[2].Value = model.PullDate;
            parameters[3].Value = model.IsSuccessful;
            parameters[4].Value = model.UserID;
            parameters[5].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TwitterSpamDetection.Model.t_ind_pullhistory GetModel(string ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,NumOfPull,NumOfTotal,PullDate,IsSuccessful,UserID from t_ind_pullhistory ");
            strSql.Append(" where ID=@ID ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@ID", MySqlDbType.VarChar, 36)
            };
            parameters[0].Value = ID;

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

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