Skip to content

Commit 8a78617

Browse files
committed
documentation(EJ2-67661): UG document to save and load report using database.
1 parent ebe9f5a commit 8a78617

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

Javascript/pivot-table/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ var pivotTableObj = new ej.pivotview.PivotView({
9494
body: JSON.stringify({
9595
reportName: args.reportName,
9696
renameReport: args.rename,
97+
isReportExists: args.isReportExists
9798
}),
9899
})
99100
.then(function (response) {

MyWebService/Controllers/PivotController.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void RemoveReport([FromBody] ReportDB reportDB)
3232
[Route("Pivot/RenameReport")]
3333
public void RenameReport([FromBody] RenameReportDB reportDB)
3434
{
35-
RenameReportInDB(reportDB.ReportName, reportDB.RenameReport);
35+
RenameReportInDB(reportDB.ReportName, reportDB.RenameReport, reportDB.isReportExists);
3636
}
3737

3838
[HttpPost]
@@ -57,6 +57,7 @@ public class RenameReportDB
5757
{
5858
public String ReportName { get; set; }
5959
public String RenameReport { get; set; }
60+
public Boolean isReportExists { get; set; }
6061
}
6162

6263
public class ErrorViewModel
@@ -104,12 +105,17 @@ public void RemoveReportFromDB(string reportName)
104105
sqlConn.Close();
105106
}
106107

107-
public void RenameReportInDB(string reportName, string renameReport)
108+
public void RenameReportInDB(string reportName, string renameReport, Boolean isReportExists)
108109
{
109110
SqlConnection sqlConn = OpenConnection();
110111
SqlCommand cmd1 = null;
111112
foreach (DataRow row in GetDataTable(sqlConn).Rows)
112113
{
114+
if (isReportExists)
115+
{
116+
RemoveReportFromDB(renameReport);
117+
isReportExists = false;
118+
}
113119
if ((row["ReportName"] as string).Equals(reportName))
114120
{
115121
cmd1 = new SqlCommand("UPDATE ReportTable set ReportName=@RenameReport where ReportName like '%" + reportName + "%'", sqlConn);

Typescript/pivot-table/src/app/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ let pivotTableObj: PivotView = new PivotView({
7676
'Accept': 'application/json',
7777
'Content-Type': 'application/json',
7878
},
79-
body: JSON.stringify({ reportName: args.reportName, renameReport: args.rename })
79+
body: JSON.stringify({ reportName: args.reportName, renameReport: args.rename, isReportExists: args.isReportExists })
8080
}).then(response => {
8181
pivotTableObj.fetchReport();
8282
});

0 commit comments

Comments
 (0)