예제 #1
0
        public void LogEvent()
        {
            Installer.wslogger.Ws_Logger ws = new Installer.wslogger.Ws_Logger();
            // ws.Timeout = 20000;
            IBatchNo = -1;
            try
            {
                int iBatch = int.Parse(ws.FindNextId(sUnid));
                IBatchNo = iBatch;
// 15 May 2012
// skip logging the cook stuff
                //if (sEmail.Contains(@"cookconsulting"))
                //{ }
                //else
                ws.Logger(sUnid, sXmlDoc, 99999, iBatch);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ws.Dispose();
            }
        }
예제 #2
0
        public void LogEvent(string sUnid, string sMsg, int iStatus, int iBatch)
        {
            // chg per version II 17 Feb 2021
            //if (sEmail.Contains(@"testing"))
            //{ }

            //else
            {
                Installer.wslogger.Ws_Logger ws = new Installer.wslogger.Ws_Logger();

                if (iStatus == 10000)
                {
                    ws.Logger(sUnid, sCustomerName + "&" + sUserName, iStatus, iBatch);
                }
                else
                {
                    ws.Logger(sUnid, sMsg, iStatus, iBatch);
                }

                ws.Dispose();
            }
        }
예제 #3
0
        private static void DownLoadASheet(string sAddr, string sFileName)
        {
            try
            {
                if (File.Exists(sFileName))
                {
                    FileInfo fi = new FileInfo(sFileName);

                    fi.IsReadOnly = false;

                    fi.Delete();
                }
            }
            catch { }


            RequestCachePolicy policy = new RequestCachePolicy(RequestCacheLevel.Reload);

            string address = sAddr;

            //"http://localhost/Sheets/" + sFileName + ".xls";

            System.Threading.AutoResetEvent waiter = new System.Threading.AutoResetEvent(false);
            Uri uri = new Uri(address);

            try
            {
                WebClient wc = new WebClient();
                wc.Proxy       = null;
                wc.Credentials = CredentialCache.DefaultCredentials;
                wc.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0)");
                wc.CachePolicy = policy;


                wc.DownloadFileCompleted   += new AsyncCompletedEventHandler(wcDownLoadDone);
                wc.DownloadDataCompleted   += new DownloadDataCompletedEventHandler(wcDownLoadDone1);
                wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wcCallbackDown);

                wc.DownloadFileAsync(uri, sFileName);
                Console.Write("DownLoading with {0} ", sFileName);
                while (wc.IsBusy)
                {
                    try
                    {
                        waiter.WaitOne(100);
                    }
                    catch { }
                }

                try
                {
                    Debug.Print("Done");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message + " Error in Download");
                }


                Console.WriteLine("Done with {0} ", sFileName);
                // Got the File
                // Download the Files
            }

            catch (WebException ex)
            {
                if (ex.Response is WebResponse)
                {
                    HttpWebResponse o = (HttpWebResponse)ex.Response;
                    Installer.wslogger.Ws_Logger ws = new Installer.wslogger.Ws_Logger();
                    ws.Logger(sUnid, o.StatusDescription, -1, iBatchCl);
                    Console.WriteLine(o.StatusDescription + "  Download Error -" + ex.Message);
                    if (o.StatusCode == HttpStatusCode.OK)
                    {
                    }
                    else
                    {
                        Console.WriteLine(ex.Status + "  Download Error -" + ex.Message);
                        Console.ReadLine();
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                Installer.wslogger.Ws_Logger ws = new Installer.wslogger.Ws_Logger();
                ws.Logger(sUnid, ex.Message, -1, iBatchCl);

                Console.WriteLine(ex.Message);
                throw ex;
            }
        }