From 350b9ddd6fbc31bfd61be182c6409e6991f7f918 Mon Sep 17 00:00:00 2001 From: nikita Date: Tue, 7 Mar 2017 18:25:54 +0530 Subject: [PATCH] added sql.id also as mongo.oldId --- 350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/DataAccess.cs | 14 +++++++++----- 350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/User.cs | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/DataAccess.cs b/350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/DataAccess.cs index a773c1c..faf33a0 100644 --- a/350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/DataAccess.cs +++ b/350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/DataAccess.cs @@ -36,13 +36,14 @@ namespace SQLToJSON { string JSONString = string.Empty; JSONString = JsonConvert.SerializeObject(table); - string replacedString = JSONString.Replace(@"\r", ""); - string replacedString1 = replacedString.Replace(@"\n", ""); - string replacedString2 = replacedString1.Replace(@"\", ""); + // string replacedString = JSONString.Replace(@"\r", ""); + // string replacedString1 = replacedString.Replace(@"\n", ""); + // string replacedString2 = replacedString1.Replace(@"\", ""); - string finalString = Regex.Replace(replacedString2, "\\s+\"", ""); + // string finalString = Regex.Replace(replacedString2, "\\s+\"", ""); - return finalString; + //return finalString; + return JSONString; } public dynamic GetModifiedTableWithUserModules(DataTable userTable, DataTable moduleTable) @@ -78,6 +79,7 @@ namespace SQLToJSON e.Field("UserId") select new User { + oldId = d.Field("id"), loginId = d.Field("loginId"), password = d.Field("password"), firstName = d.Field("firstName"), @@ -156,6 +158,7 @@ namespace SQLToJSON var lst2 = data2.Where(w => w.loginId == userloginId).Select(r => new User { + oldId = row.oldId, loginId = row.loginId, password = row.password, firstName = row.firstName, @@ -177,6 +180,7 @@ namespace SQLToJSON var reultantRow = lst2.Take(1).Select(a=>new{ + oldId = a.oldId, loginId = a.loginId, password = a.password, firstName = a.firstName, diff --git a/350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/User.cs b/350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/User.cs index b660480..a2586eb 100644 --- a/350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/User.cs +++ b/350-UTILITIES/SQL_To_Json/SQLToJSON/SQLToJSON/User.cs @@ -8,7 +8,8 @@ namespace SQLToJSON { public class User { - + + public int oldId { get; set; } public string loginId{get;set;} public string password { get; set; } public string firstName { get; set; } -- libgit2 0.21.4