/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.t_ind_twittercredential model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update t_ind_twittercredential set "); strSql.Append("ID=@ID,"); strSql.Append("UserID=@UserID,"); strSql.Append("CreatedDate=@CreatedDate,"); strSql.Append("ConsumerKey=@ConsumerKey,"); strSql.Append("ConsumerSecret=@ConsumerSecret,"); strSql.Append("AccessToken=@AccessToken,"); strSql.Append("AccessTokenSecret=@AccessTokenSecret"); strSql.Append(" where "); MySqlParameter[] parameters = { new MySqlParameter("@ID", MySqlDbType.VarChar, 36), new MySqlParameter("@UserID", MySqlDbType.VarChar, 36), new MySqlParameter("@CreatedDate", MySqlDbType.DateTime), new MySqlParameter("@ConsumerKey", MySqlDbType.VarChar, 100), new MySqlParameter("@ConsumerSecret", MySqlDbType.VarChar, 100), new MySqlParameter("@AccessToken", MySqlDbType.VarChar, 100), new MySqlParameter("@AccessTokenSecret", MySqlDbType.VarChar, 100) }; parameters[0].Value = model.ID; parameters[1].Value = model.UserID; parameters[2].Value = model.CreatedDate; parameters[3].Value = model.ConsumerKey; parameters[4].Value = model.ConsumerSecret; parameters[5].Value = model.AccessToken; parameters[6].Value = model.AccessTokenSecret; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.t_ind_twittercredential GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select ID,UserID,CreatedDate,ConsumerKey,ConsumerSecret,AccessToken,AccessTokenSecret from t_ind_twittercredential "); strSql.Append(" where "); MySqlParameter[] parameters = { }; Model.t_ind_twittercredential model = new Model.t_ind_twittercredential(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.t_ind_twittercredential model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into t_ind_twittercredential("); strSql.Append("ID,UserID,CreatedDate,ConsumerKey,ConsumerSecret,AccessToken,AccessTokenSecret)"); strSql.Append(" values ("); strSql.Append("@ID,@UserID,@CreatedDate,@ConsumerKey,@ConsumerSecret,@AccessToken,@AccessTokenSecret)"); MySqlParameter[] parameters = { new MySqlParameter("@ID", MySqlDbType.VarChar, 36), new MySqlParameter("@UserID", MySqlDbType.VarChar, 36), new MySqlParameter("@CreatedDate", MySqlDbType.DateTime), new MySqlParameter("@ConsumerKey", MySqlDbType.VarChar, 100), new MySqlParameter("@ConsumerSecret", MySqlDbType.VarChar, 100), new MySqlParameter("@AccessToken", MySqlDbType.VarChar, 100), new MySqlParameter("@AccessTokenSecret", MySqlDbType.VarChar, 100) }; parameters[0].Value = model.ID; parameters[1].Value = model.UserID; parameters[2].Value = model.CreatedDate; parameters[3].Value = model.ConsumerKey; parameters[4].Value = model.ConsumerSecret; parameters[5].Value = model.AccessToken; parameters[6].Value = model.AccessTokenSecret; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.t_ind_twittercredential DataRowToModel(DataRow row) { Model.t_ind_twittercredential model = new Model.t_ind_twittercredential(); if (row != null) { if (row["ID"] != null) { model.ID = row["ID"].ToString(); } if (row["UserID"] != null) { model.UserID = row["UserID"].ToString(); } if (row["CreatedDate"] != null && row["CreatedDate"].ToString() != "") { model.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString()); } if (row["ConsumerKey"] != null) { model.ConsumerKey = row["ConsumerKey"].ToString(); } if (row["ConsumerSecret"] != null) { model.ConsumerSecret = row["ConsumerSecret"].ToString(); } if (row["AccessToken"] != null) { model.AccessToken = row["AccessToken"].ToString(); } if (row["AccessTokenSecret"] != null) { model.AccessTokenSecret = row["AccessTokenSecret"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.t_ind_twittercredential model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.t_ind_twittercredential model) { return(dal.Add(model)); }