コード例 #1
0
ファイル: MainActivity.cs プロジェクト: mokth/merpV3
        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();
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
ファイル: MainActivity.cs プロジェクト: mokth/merpV3
        void UploaddDb()
        {
            try {
                WebClient          myWebClient = new WebClient();
                DownloadFileHelper upfile      = new DownloadFileHelper(this);

                upfile.OnFinishDownloadHandle += Upfile_OnFinishDownloadHandle;
                upfile.StartBackupDb();

                //				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();
            }
        }
コード例 #4
0
ファイル: LoginActivity.cs プロジェクト: mokth/merpV3
        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 ();
            }
        }
コード例 #5
0
ファイル: MainActivity.cs プロジェクト: mokth/merpV3
        void UploaddDb()
        {
            try {

                WebClient myWebClient = new WebClient ();
                DownloadFileHelper upfile = new DownloadFileHelper (this);

                upfile.OnFinishDownloadHandle += Upfile_OnFinishDownloadHandle;
                upfile.StartBackupDb();

                //				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 ();
            }
        }
コード例 #6
0
ファイル: MainActivity.cs プロジェクト: mokth/merpV3
        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 ();
            }
        }