/// <summary> ///Process Remotely Un-installed Apk /// </summary> /// <param name="Ar"></param> /// <returns></returns> public HttpResponseMessage ProcessRemoteUnInstall(RemoteUninstall RU) { ar = new WebApiResponse(); try { string qry = "select * from MDM_DeviceMaster where DeviceID='" + RU.uuid + "'"; dr = databaseHelper.getDataReader(qry); if (dr.Read()) { if (!dr.IsClosed) { dr.Close(); } qry = "delete from MDM_PushNotification where DeviceID='" + RU.uuid + "' and Command like '%Remote Uninstall%'"; rcnt = databaseHelper.ExecuteQuery(qry); qry = "delete from MDM_InstalledApps where DeviceID='" + RU.uuid + "' and isDownloaded=1 and ApplicationPackage='" + RU.packageName + "'"; //linfo.LogException(null,"Process Remote Uninstall Delete Qry = "+qry); rcnt = databaseHelper.ExecuteQuery(qry); ar.response = true; response = Request.CreateResponse(HttpStatusCode.Created, ar); return(response); } else { ar.errorCode = "No Device Found"; ar.response = false; response = Request.CreateResponse(HttpStatusCode.BadRequest, ar); return(response); } } catch (Exception ex) { linfo.LogFile(enLogType.EXCEPTION, "Problem in ProcessRemoteUninstall()", null); ar.errorCode = "WebService Exception in function ProcessRemoteUninstall()"; ar.response = false; response = Request.CreateResponse(HttpStatusCode.BadRequest, ar); } finally { if (dr != null && !dr.IsClosed) { dr.Close(); } } return(response); }
/// <summary> ///Process Remotely Un-installed Apk /// </summary> /// <param name="Ar"></param> /// <returns></returns> public HttpResponseMessage ProcessRemoteUnInstall(RemoteUninstall RU) { ar = new WebApiResponse(); try { string qry = "select * from MDM_DeviceMaster where DeviceID='" + RU.uuid + "'"; dr = databaseHelper.getDataReader(qry); if (dr.Read()) { if (!dr.IsClosed) dr.Close(); qry = "delete from MDM_PushNotification where DeviceID='" + RU.uuid + "' and Command like '%Remote Uninstall%'"; rcnt = databaseHelper.ExecuteQuery(qry); qry = "delete from MDM_InstalledApps where DeviceID='" + RU.uuid + "' and isDownloaded=1 and ApplicationPackage='" + RU.packageName + "'"; //linfo.LogException(null,"Process Remote Uninstall Delete Qry = "+qry); rcnt = databaseHelper.ExecuteQuery(qry); ar.response = true; response = Request.CreateResponse(HttpStatusCode.Created, ar); return response; } else { ar.errorCode = "No Device Found"; ar.response = false; response = Request.CreateResponse(HttpStatusCode.BadRequest, ar); return response; } } catch (Exception ex) { linfo.LogFile(enLogType.EXCEPTION, "Problem in ProcessRemoteUninstall()",null); ar.errorCode = "WebService Exception in function ProcessRemoteUninstall()"; ar.response = false; response = Request.CreateResponse(HttpStatusCode.BadRequest, ar); } finally { if (dr != null && !dr.IsClosed) dr.Close(); } return response; }