Ejemplo n.º 1
0
        public bool syncDataForCloseShop()
        {
            bool result = false;

            Data_Access DS_SS     = new Data_Access();
            string      localDate = "";
            string      fileName  = "";

            localDate = String.Format(culture, "{0:ddMMyyyy}", DateTime.Now);
            fileName  = "EXPORT_LOCAL_DATA" + "_" + localDate + ".sql";

            // EXPORT LOCAL DATA
            exportDataCloseShop(fileName);

            if (DS_SS.SS_mySQLConnect(true))
            {
                gUtil.saveSystemDebugLog(0, "[SYNC] CONNECTION TO SERVER CREATED");

                result = syncLocalDataToServer(DS_SS, fileName, Data_Access.SS_SERVER);

                try
                {
                    File.Delete(fileName);
                }
                catch (Exception ex)
                {
                    gUtil.saveSystemDebugLog(0, "[SYNC] FAILED TO DELETE EXPORT FILE [" + ex.Message + "]");
                }
            }
            else
            {
                MessageBox.Show("KONEKSI KE PUSAT GAGAL");
                gUtil.saveSystemDebugLog(0, "[SYNC] FAILED TO CONNECT TO SERVER");

                result = false;
            }

            return(result);
        }