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