public static string GetWhereParameterExpression(List<ColumnInfo> keys, bool IdentityisPrior, string DbType) { StringPlus stringPlus = new StringPlus(); ColumnInfo identityKey = CodeCommon.GetIdentityKey(keys); bool flag = CodeCommon.HasNoIdentityKey(keys); if (IdentityisPrior && identityKey != null || !flag && identityKey != null) { stringPlus.Append(identityKey.ColumnName + "=" + CodeCommon.preParameter(DbType) + identityKey.ColumnName); } else { foreach (ColumnInfo columnInfo in keys) { if (columnInfo.IsPrimaryKey || !columnInfo.IsIdentity) stringPlus.Append(columnInfo.ColumnName + "=" + CodeCommon.preParameter(DbType) + columnInfo.ColumnName + " and "); } stringPlus.DelLastChar("and"); } return stringPlus.Value; }
public static string GetWhereExpression(List<ColumnInfo> keys, bool IdentityisPrior) { StringPlus stringPlus = new StringPlus(); ColumnInfo identityKey = CodeCommon.GetIdentityKey(keys); if (IdentityisPrior && identityKey != null) { if (CodeCommon.IsAddMark(identityKey.TypeName)) stringPlus.Append(identityKey.ColumnName + "='\"+" + identityKey.ColumnName + "+\"'"); else stringPlus.Append(identityKey.ColumnName + "=\"+" + identityKey.ColumnName + "+\""); } else { foreach (ColumnInfo columnInfo in keys) { if (columnInfo.IsPrimaryKey || !columnInfo.IsIdentity) { if (CodeCommon.IsAddMark(columnInfo.TypeName)) stringPlus.Append(columnInfo.ColumnName + "='\"+" + columnInfo.ColumnName + "+\"' and "); else stringPlus.Append(columnInfo.ColumnName + "=\"+" + columnInfo.ColumnName + "+\" and "); } } stringPlus.DelLastChar("and"); } return stringPlus.Value; }
public static string GetInParameter(List<ColumnInfo> keys, bool IdentityisPrior) { StringPlus stringPlus = new StringPlus(); ColumnInfo identityKey = CodeCommon.GetIdentityKey(keys); if (IdentityisPrior && identityKey != null) { stringPlus.Append(CodeCommon.DbTypeToCS(identityKey.TypeName) + " " + identityKey.ColumnName); } else { foreach (ColumnInfo columnInfo in keys) { if (columnInfo.IsPrimaryKey || !columnInfo.IsIdentity) stringPlus.Append(CodeCommon.DbTypeToCS(columnInfo.TypeName) + " " + columnInfo.ColumnName + ","); } stringPlus.DelLastComma(); } return stringPlus.Value; }
public static string GetPreParameter(List<ColumnInfo> keys, bool IdentityisPrior, string DbType) { StringPlus stringPlus1 = new StringPlus(); StringPlus stringPlus2 = new StringPlus(); stringPlus1.AppendSpaceLine(3, CodeCommon.DbParaHead(DbType) + "Parameter[] parameters = {"); ColumnInfo identityKey = CodeCommon.GetIdentityKey(keys); bool flag = CodeCommon.HasNoIdentityKey(keys); if (IdentityisPrior && identityKey != null || !flag && identityKey != null) { stringPlus1.AppendSpaceLine(5, "new " + CodeCommon.DbParaHead(DbType) + "Parameter(\"" + CodeCommon.preParameter(DbType) + identityKey.ColumnName + "\", " + CodeCommon.DbParaDbType(DbType) + "." + CodeCommon.DbTypeLength(DbType, identityKey.TypeName, "") + ")"); stringPlus2.AppendSpaceLine(3, "parameters[0].Value = " + identityKey.ColumnName + ";"); } else { int num = 0; foreach (ColumnInfo columnInfo in keys) { if (columnInfo.IsPrimaryKey || !columnInfo.IsIdentity) { stringPlus1.AppendSpaceLine(5, "new " + CodeCommon.DbParaHead(DbType) + "Parameter(\"" + CodeCommon.preParameter(DbType) + columnInfo.ColumnName + "\", " + CodeCommon.DbParaDbType(DbType) + "." + CodeCommon.DbTypeLength(DbType, columnInfo.TypeName, columnInfo.Length) + "),"); stringPlus2.AppendSpaceLine(3, "parameters[" + num.ToString() + "].Value = " + columnInfo.ColumnName + ";"); ++num; } } stringPlus1.DelLastComma(); } stringPlus1.AppendSpaceLine(3, "};"); stringPlus1.Append(stringPlus2.Value); return stringPlus1.Value; }
public static string GetFieldstrlistAdd(List<ColumnInfo> keys, bool IdentityisPrior) { StringPlus stringPlus = new StringPlus(); ColumnInfo identityKey = CodeCommon.GetIdentityKey(keys); if (IdentityisPrior && identityKey != null) { stringPlus.Append(identityKey.ColumnName); } else { foreach (ColumnInfo columnInfo in keys) { if (columnInfo.IsPrimaryKey || !columnInfo.IsIdentity) stringPlus.Append(columnInfo.ColumnName + "+"); } stringPlus.DelLastChar("+"); } return stringPlus.Value; }