Hi team
I dont know how to calculate total hours for user worked on a incident report, currently need some help around this logic. There are no errors and worked below does work and using ado.net to pull data back from table records. Should i need to have a unique record for total hours has datatype like datetime?
I am using visjs framework for timeline and here is the link below for documentation.
timeline - vis.js - A dynamic, browser based visualization library.[
^]
What I have tried:
// Model
public class SelectOption
{
[Key]
public int Incident { get; set; }
public string Description { get; set; }
public string Resources { get; set; }
public DateTime Start_Date { get; set; }
public DateTime Timestamp { get; set; }
}
// Should i need to have a data type here for total hours?
// controller
public TimeLineApplicationDBEntities2 _context = new TimeLineApplicationDBEntities2();
public ActionResult Index()
{
return View();
}
public JsonResult GetAll()
{
var data = _context.Application_CheckList.ToList();
return Json(data, JsonRequestBehavior.AllowGet);
}
<pre>@section scripts{
<!-- CSS -->
<script src="/vis/vis.js"></script>
<link href="/Content/vis.min.css" rel="stylesheet" />
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: "GET",
url: "GetAll",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: ChartVis,
error: OnError
});
function ChartVis(response) {
const data = response.map((item) => {
const parsed = item.Start_Date.match(/\/Date\((\d+)\)\
return { id: item.Incident, start: Number(parsed[1]), content: item.Description };
});
console.log(data);
var container = document.getElementById('visualization');
var items = new vis.DataSet(data);
var options = {};
var timeline = new vis.Timeline(container, items, options);
}
function OnError(response) {
alert("Error !");
}
})
</script>
}
<div id="visualization"></div>
}