I have a GetLocalTime() method in my Web Service which I want to call in my form.cs and set the time on web server on the device on button click? So what should I write on the button click event to call the datetime function and set the time?
Method in Web Service:
[WebMethod]
public DateTime GetLocalTime()
{
OracleBridge ob = new OracleBridge(_connStr);
string sqlQuery = "select sysdate from dual";
DateTime dt = new DateTime();
try
{
dt = Convert.ToDateTime(ob.ExecuteScalar(sqlQuery));
}
catch (OracleException ex)
{
throw ex;
}
return dt;
}
Button click event in form.cs to get and set the time:
private void btnSync_Click(object sender, EventArgs e)
{
???????????? // what should I write here to call the method
DateTime localDateTime = ?????????; //what should I write here pass datetime to setsystemdatetime
SetSystemDateTime(localDateTime);
System.Threading.Thread.Sleep(500);
SetSystemDateTime(localDateTime);
}