Beispiel #1
0
        void DownlooadLogo()
        {
            try {
                //backup db first before upload
                AdPara    apara       = DataHelper.GetAdPara(pathToDatabase);
                WebClient myWebClient = new WebClient();
                string    document    = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                string    logopath    = "";
                string    filename    = "";
                if (apara.PaperSize == "58mm")
                {
                    logopath = Path.Combine(document, "logo58.png");
                    filename = COMPCODE + "_" + BRANCODE + "_58_logo.png";
                }
                else
                {
                    logopath = Path.Combine(document, "logo80.png");
                    filename = COMPCODE + "_" + BRANCODE + "_80_logo.png";
                }
                string url = WCFHelper.GetDownloadLogoUrl() + filename;
//				string localfilename = Path.Combine (sdcard, "logo.png");
                if (File.Exists(logopath))
                {
                    File.Delete(logopath);
                }

                myWebClient.DownloadFile(url, logopath);
                //File.Copy (localfilename, logopath, true);

//				Toast.MakeText (this, Resources.GetString (Resource.String.msg_successdownlogo), ToastLength.Long).Show ();
            } catch (Exception ex) {
                Toast.MakeText(this, Resources.GetString(Resource.String.msg_faildowndb), ToastLength.Long).Show();
            }
        }
Beispiel #2
0
        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();
            }
        }
Beispiel #3
0
        private void CheckSystemUpdate()
        {
            WCFHelper wcf = new WCFHelper();

            try{
                Service1Client client = wcf.GetServiceClient();
                client.GetVersionCompleted += Client_GetVersionCompleted;
                client.GetVersionAsync();
            }catch {
            }
        }
Beispiel #4
0
        void Downfile_OnFinishDownloadDBHandle(string filename)
        {
            string dbfilename = COMPCODE + "_" + BRANCODE + "_" + USERID + "_erplite.db";

            if (string.IsNullOrEmpty(filename))
            {
                Toast.MakeText(this, Resources.GetString(Resource.String.msg_faildowndb), ToastLength.Long).Show();
            }
            else
            {
                File.Copy(filename, pathToDatabase, true);
                string     urldel  = WCFHelper.GeUploadDBUrl() + "/afterdownload.aspx?ver=5&ID=" + dbfilename;
                WebRequest request = HttpWebRequest.Create(urldel);
                request.GetResponse();
                Toast.MakeText(this, Resources.GetString(Resource.String.msg_successdowndb), ToastLength.Long).Show();
            }
        }
Beispiel #5
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();
            }
        }
Beispiel #6
0
        void DownlooadTemplate()
        {
            try {
                WebClient myWebClient   = new WebClient();
                var       sdcard        = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, "erpdata");
                string    filename      = COMPCODE + "_template.zip";
                string    url           = WCFHelper.GetDownloadTemplateUrl() + filename;
                string    localfilename = Path.Combine(sdcard, filename);
                if (File.Exists(localfilename))
                {
                    File.Delete(localfilename);
                }

                myWebClient.DownloadFile(url, localfilename);
                string pathname = Path.GetDirectoryName(pathToDatabase);
                ZipHelper.DecompressFiles(localfilename, pathname);

                Toast.MakeText(this, Resources.GetString(Resource.String.msg_successdowntmp), ToastLength.Long).Show();
            } catch (Exception ex)
            {
                Toast.MakeText(this, Resources.GetString(Resource.String.msg_faildowntmp), ToastLength.Long).Show();
            }
        }
Beispiel #7
0
 private void CheckSystemUpdate()
 {
     WCFHelper wcf = new WCFHelper ();
     try{
         Service1Client client = wcf.GetServiceClient ();
         client.GetVersionCompleted+= Client_GetVersionCompleted;
         client.GetVersionAsync ();
     }catch {
     }
 }