Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


foxjazz
2009-04-04T00:54:02Z
Is there a way to start a job from a programm?

I have a wcf service, and the user sends data up. I need to write a program to do stuff with the data sent up. I would like the wcf service to kick off a job from vcron. Is there a way to do this?
Sponsor
Forum information
foxjazz
2009-04-04T01:51:44Z
I am trying this code, but something isn't right.
The svr after connect doesn't show connected.


VisualCronAPI.Server svr = new Server();
VisualCronAPI.ClientConnections clients = new ClientConnections(svr);
VisualCronAPI.Client cli = new Client();

VisualCronAPI.Connection conn = new Connection();
conn.Address = "amproc@dnmsstssrc:16444";
conn.PassWord = "gamit6";
conn.Port = 16444;
conn.UserName = "amproc";

svr = cli.Connect(conn, false);


VisualCronAPI.Jobs job = new VisualCronAPI.Jobs(ref svr);
bool tell = job.Activate("Vin Decoder Process");
foxjazz
2009-04-04T02:20:04Z
I have gotten this far:
But still can't figure out how to start the job

private void button1_Click(object sender, EventArgs e)
{
bool ttt;
Client.EventOnConnected += new Client.DelegateOnConnected(Client_EventOnConnected);
Client c = new Client();
c.LogToFile = false;
Connection conn = new Connection();
conn.Address = "dnmsstssrc";
conn.UserName = "amproc";
conn.PassWord = "gamit6";
conn.Port = 16444;
conn.ConnectionType = Connection.ConnectionT.Remote;
try
{
s = c.Connect(conn, true);
}
catch (VisualCronAPI.Client.ClientLoginFailedException ex)
{
MessageBox.Show(ex.Message);
}

string tell = "";
button1.Text = tell.ToString();
}
private Server s = null;
private void Client_EventOnConnected(Client c, ref Server s)
{


//JobClass jc =
JobClass j;
j = s.Jobs.Get("Vin Decoder Process");




}

adutoit
2009-04-04T06:38:30Z
Try using the following
objServer.Jobs.Run(objJobClass)

We have written a cmd-line utility that starts VC Jobs remotely; the API works fine. Just watch-out if you upgrade your VC server you will from time to time have to re-deploy your solution because the API client has become in-compatible with the upgraded sever.

jmb
2009-04-06T10:57:32Z
adutoit wrote:

Try using the following
objServer.Jobs.Run(objJobClass)

We have written a cmd-line utility that starts VC Jobs remotely; the API works fine. Just watch-out if you upgrade your VC server you will from time to time have to re-deploy your solution because the API client has become in-compatible with the upgraded sever.




can you share it ?
Support
2009-04-06T11:28:13Z
Check out the test project in the API folder of VisualCron. You just connect the same way - then you can, for example, use the Run function on Server.Jobs object.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
foxjazz
2009-04-06T17:19:44Z




I am running the code below. And using 5.1 client and server.
The connection passes, however no jobs are listed.

When running the vc client, there are several jobs on the server.😕








private void button1_Click(object sender, EventArgs e)
{
bool ttt;
Client.EventOnConnected += new Client.DelegateOnConnected(Client_EventOnConnected);
Client c = new Client();
c.LogToFile = false;
Connection conn = new Connection();
conn.Address = "dnmsstssrc";
conn.UserName = "amproc";
conn.PassWord = "gamit6";
conn.Port = 16444;
conn.ConnectionType = Connection.ConnectionT.Remote;
try
{
s = c.Connect(conn, true);
}
catch (VisualCronAPI.Client.ClientLoginFailedException ex)
{
MessageBox.Show(ex.Message);
}

string tell = "";
button1.Text = tell.ToString();
}
private Server s = null;
private static void Client_EventOnConnected(Client c, ref Server s)
{


//JobClass jc =
if (s.Connected)
{

foreach (JobClass jj in s.Jobs.GetAll())
{
string text = jj.Name;
}
}
//s.Jobs.Run(j);



}
Support
2009-04-06T22:16:18Z
You are saying that no Jobs are listed. Just to verify, where to you list the Jobs in the code? Currently you are only setting a string property.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top