Exemplo n.º 1
0
 public static bool IsOnline()
 {
     try
     {
         DateTime OutputResult;
         bool     OutputSpacial;
         using (Calbee.WMS.Services.CoreService.CoreService wsTest = new Calbee.WMS.Services.CoreService.CoreService())
         {
             wsTest.Url = "http://" + _IPAddress + "/coreservice.svc";
             wsTest.GetCurrentDateTime(out OutputResult, out OutputSpacial);
             if (OutputResult != null)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (System.Net.WebException)
     {
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 2
0
 private void btnTestConnection_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         if (!VeriflyData())
         {
             return;
         }
         else
         {
             using (Calbee.WMS.Services.CoreService.CoreService wsTest = new Calbee.WMS.Services.CoreService.CoreService())
             {
                 wsTest.Url = "http://" + txtURLWebService.Text.Trim() + "/coreservice.svc";
                 DateTime OutputResult; bool OutputSpacial;
                 wsTest.GetCurrentDateTime(out OutputResult, out OutputSpacial);
                 if (OutputResult != null)
                 {
                     Cursor.Current = Cursors.Default;
                     MsgBox.DialogInfomation("Connection server complete");
                     this.txtURLWebService.ReadOnly = true;
                     this.btnSave.Visible           = true;
                 }
                 else
                 {
                     this.txtURLWebService.ReadOnly = false;
                     this.btnSave.Visible           = false;
                 }
             }
         }
     }
     catch (System.Net.WebException WebEx)
     {
         MsgBox.DialogError("Error test connection of web : " + WebEx.Message);
         this.txtURLWebService.ReadOnly = false;
         this.btnSave.Visible           = false;
         this.txtURLWebService.Focus();
         this.txtURLWebService.SelectAll();
     }
     catch (Exception ex)
     {
         MsgBox.DialogError("Error test connection : " + ex.Message);
         this.txtURLWebService.ReadOnly = false;
         this.btnSave.Visible           = false;
         this.txtURLWebService.Focus();
         this.txtURLWebService.SelectAll();
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }