public async Task InsertEdits(ReportData reportData, string sourceName) { ConnectParameters connector = await Common.GetConnectParameters(azureConnectionString, sourceName); IndexModel index = await _indexData.GetIndexFromSP(reportData.Id, connector.ConnectionString); JObject dataObject = JObject.Parse(reportData.JsonData); if (reportData.ColumnType == "number") { dataObject[reportData.ColumnName] = reportData.NumberValue; } else if (reportData.ColumnType == "string") { dataObject[reportData.ColumnName] = reportData.TextValue; } string remark = dataObject["REMARK"] + $";{reportData.ColumnName} has been manually edited;"; dataObject["REMARK"] = remark; index.JsonDataObject = dataObject.ToString(); string failRule = reportData.RuleKey + ";"; index.QC_String = index.QC_String.Replace(failRule, ""); await _indexData.UpdateIndex(index, connector.ConnectionString); if (connector.SourceType == "DataBase") { UpdateDatabase(index.JsonDataObject, connector.ConnectionString, reportData.DataType); } }
private async Task DeleteChildren(int id, string qcStr) { IEnumerable <IndexModel> dmsIndex = await _indexData.GetDescendantsFromSP(id, databaseConnectionString); foreach (IndexModel index in dmsIndex) { index.JsonDataObject = ""; index.QC_String = qcStr; await _indexData.UpdateIndex(index, databaseConnectionString); } }