protected bool UpdateByCondition(string condition) { //移除主键标记 ChangePropertys.Remove(_pair_id); if (ChangePropertys.Count == 0) { return(true); } StringBuilder sql = new StringBuilder(); sql.AppendLine("update tmp_currency_pair set"); while (ChangePropertys.MoveNext()) { sql.AppendFormat(" {0}{1}=?{1} ", (ChangePropertys.CurrentIndex == 0 ? string.Empty : ","), ChangePropertys.Current); AddParameter(ChangePropertys.Current, DataRow[ChangePropertys.Current]); } sql.AppendLine(" where pair_id=?pair_id"); AddParameter(_pair_id, DataRow[_pair_id]); if (!string.IsNullOrEmpty(condition)) { sql.AppendLine(" and " + condition); } bool result = base.UpdateBySql(sql.ToString()); ChangePropertys.Clear(); return(result); }
protected bool UpdateByCondition(string condition) { //移除主键标记 ChangePropertys.Remove(_CLASSIFY_ID); if (ChangePropertys.Count == 0) { return(true); } StringBuilder sql = new StringBuilder(); sql.AppendLine("UPDATE TSQL_CLASSIFY SET"); while (ChangePropertys.MoveNext()) { sql.AppendFormat(" {0}{1}=:{1} ", (ChangePropertys.CurrentIndex == 0 ? string.Empty : ","), ChangePropertys.Current); AddParameter(ChangePropertys.Current, DataRow[ChangePropertys.Current]); } sql.AppendLine(" WHERE CLASSIFY_ID=:CLASSIFY_ID"); AddParameter(_CLASSIFY_ID, DataRow[_CLASSIFY_ID]); if (!string.IsNullOrEmpty(condition)) { sql.AppendLine(" AND " + condition); } bool result = base.UpdateBySql(sql.ToString()); ChangePropertys.Clear(); return(result); }
protected bool UpdateByCondition(string condition) { ChangePropertys.Remove(_VOUCHER_ID); if (ChangePropertys.Count == 0) { return(true); } StringBuilder sql = new StringBuilder(); sql.AppendLine("UPDATE TNET_USER_VOUCHER SET"); while (ChangePropertys.MoveNext()) { sql.AppendFormat(" {0}{1}=?{1} ", (ChangePropertys.CurrentIndex == 0 ? string.Empty : ","), ChangePropertys.Current); AddParameter(ChangePropertys.Current, DataRow[ChangePropertys.Current]); } sql.Append(" WHERE voucher_id=?voucher_id"); AddParameter(_VOUCHER_ID, DataRow[_VOUCHER_ID]); if (!string.IsNullOrEmpty(condition)) { sql.AppendLine(" AND " + condition); } bool result = base.UpdateBySql(sql.ToString()); ChangePropertys.Clear(); return(result); }
public bool Update(Dictionary <Tauth_ScopeCollection.Field, object> conditionDic) { if (conditionDic.Count <= 0) { return(false); } ChangePropertys.Remove(_SCOPE_ID); if (ChangePropertys.Count == 0) { return(true); } StringBuilder sql = new StringBuilder(); sql.AppendLine("UPDATE TAUTH_SCOPE SET"); while (ChangePropertys.MoveNext()) { sql.AppendFormat(" {0}{1}=:TO_{1} ", (ChangePropertys.CurrentIndex == 0 ? string.Empty : ","), ChangePropertys.Current); AddParameter("TO_" + ChangePropertys.Current, DataRow[ChangePropertys.Current]); } sql.Append(" WHERE SCOPE_ID=:SCOPE_ID "); AddParameter(_SCOPE_ID, DataRow[_SCOPE_ID]); foreach (Tauth_ScopeCollection.Field key in conditionDic.Keys) { if (Tauth_ScopeCollection.Field.Scope_Id == key) { continue; } object value = conditionDic[key]; string name = string.Concat("condition_", key); sql.Append(" AND ").Append(key.ToString().ToUpper()).Append("=:").Append(name.ToUpper()); AddParameter(name, value); } return(UpdateBySql(sql.ToString())); }