void DownlooadDb() { try { //backup db first before upload // UploadDbHelper.BackupDatabase(); WebClient myWebClient = new WebClient(); var sdcard = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, "erpdata"); string filename = COMPCODE + "_" + BRANCODE + "_" + USERID + "_erplite.db"; string url = WCFHelper.GetDownloadDBUrl() + filename; string localfilename = Path.Combine(sdcard, "erplite.db"); if (File.Exists(localfilename)) { File.Delete(localfilename); } DownloadFileHelper downfile = new DownloadFileHelper(this); downfile.OnFinishDownloadHandle += Downfile_OnFinishDownloadDBHandle; downfile.StartDownload(url, localfilename); // myWebClient.DownloadFile (url, localfilename); // File.Copy (localfilename, pathToDatabase, true); // // //delete the file after downloaded // string urldel = WCFHelper.GeUploadDBUrl()+"/afterdownload.aspx?ver=3&ID="+filename; // WebRequest request = HttpWebRequest.Create(urldel); // request.GetResponse(); // // Toast.MakeText (this, Resources.GetString(Resource.String.msg_successdowndb), ToastLength.Long).Show (); } catch (Exception ex) { Toast.MakeText(this, Resources.GetString(Resource.String.msg_faildowndb), ToastLength.Long).Show(); } }
void DownlooadAPK(string ver) { try { WebClient myWebClient = new WebClient(); var sdcard = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, "erpdata"); string filename = "com.wincom.merpv5_@@.zip".Replace("@@", ver); string url = WCFHelper.GeUploadApkUrl() + filename; string localfilename = Path.Combine(sdcard, "com.wincom.merpv5.zip"); if (File.Exists(localfilename)) { File.Delete(localfilename); } DownloadFileHelper downfile = new DownloadFileHelper(this); downfile.OnFinishDownloadHandle += Downfile_OnFinishDownloadDBHandle; downfile.StartDownload(url, localfilename); } catch (Exception ex) { Toast.MakeText(this, Resources.GetString(Resource.String.msg_faildowndb), ToastLength.Long).Show(); } }
void DownlooadAPK(string ver) { try { WebClient myWebClient = new WebClient (); var sdcard = Path.Combine (Android.OS.Environment.ExternalStorageDirectory.Path, "erpdata"); string filename ="com.wincom.merpv5_@@.zip".Replace("@@",ver); string url = WCFHelper.GeUploadApkUrl () + filename; string localfilename = Path.Combine (sdcard, "com.wincom.merpv5.zip"); if (File.Exists(localfilename)) File.Delete(localfilename); DownloadFileHelper downfile = new DownloadFileHelper(this); downfile.OnFinishDownloadHandle += Downfile_OnFinishDownloadDBHandle; downfile.StartDownload(url,localfilename); } catch (Exception ex) { Toast.MakeText (this, Resources.GetString(Resource.String.msg_faildowndb), ToastLength.Long).Show (); } }
void DownlooadDb() { try { //backup db first before upload // UploadDbHelper.BackupDatabase(); WebClient myWebClient = new WebClient (); var sdcard = Path.Combine (Android.OS.Environment.ExternalStorageDirectory.Path, "erpdata"); string filename = COMPCODE + "_" + BRANCODE + "_" + USERID + "_erplite.db"; string url = WCFHelper.GetDownloadDBUrl () + filename; string localfilename = Path.Combine (sdcard, "erplite.db"); if (File.Exists(localfilename)) File.Delete(localfilename); DownloadFileHelper downfile = new DownloadFileHelper(this); downfile.OnFinishDownloadHandle += Downfile_OnFinishDownloadDBHandle; downfile.StartDownload(url,localfilename); // myWebClient.DownloadFile (url, localfilename); // File.Copy (localfilename, pathToDatabase, true); // // //delete the file after downloaded // string urldel = WCFHelper.GeUploadDBUrl()+"/afterdownload.aspx?ver=3&ID="+filename; // WebRequest request = HttpWebRequest.Create(urldel); // request.GetResponse(); // // Toast.MakeText (this, Resources.GetString(Resource.String.msg_successdowndb), ToastLength.Long).Show (); } catch (Exception ex) { Toast.MakeText (this, Resources.GetString(Resource.String.msg_faildowndb), ToastLength.Long).Show (); } }