User659967990 posted
Hello,
I have quartz .net n my MVC application to execute job at 1 minute interval, my job sets value to my static variables present in static global class.
I am then passing static variable values to my html element at javascript setinterval() but in my case values in static varaible are not getting updated.
But when i place breakpoint to quartz job I can see static variable value is being set, Please help me where I am doing wrong
setInterval(function () {
var x = @AppName.Globals.Variable1;
var y = @AppName.Globals.Variable2;
var z = @AppName.Globals.Variable3;
$("#Knob1").val(y).trigger('change');
$("#Knob2").val(z).trigger('change');
$("#Knob3").val(x).trigger('change');
},5000);
//My Quartz Job at every 1 Minute
public void Execute(IJobExecutionContext context)
{
try
{
Random rnd = new Random();
Globals.Variable1 = rnd.Next(1, 100);;
Globals.Variable2 = rnd.Next(1, 200);;
Globals.Variable3 = rnd.Next(1, 300);;
}
catch (Exception ex) { string errormsg = ex.ToString(); }
}
//My Global Static Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace AppName
{
public static class Globals
{
public static double Variable1 { get; set; }
public static double Variable2 { get; set; }
public static double Variable3 { get; set; }
}
}