Click here to Skip to main content
15,886,110 members
Articles / Database Development / SQL Server

GPS Tracer Extension: Storing the Path on SQL2005 via Web Services

Rate me:
Please Sign up or sign in to vote.
4.72/5 (7 votes)
21 Aug 20075 min read 28.9K   282   34  
This article extends Leonardo Salvatore's project using the Web Service Software Factory
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.832
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.832.
// 
#pragma warning disable 1591

namespace GpsTracerServer.Client.localhost {
    using System.Diagnostics;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Xml.Serialization;
    
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="GpsTracerServiceContract", Namespace="http://GpsTracerServer.ServiceContracts/2007/08")]
    public partial class GpsTracerServiceContract : System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        private System.Threading.SendOrPostCallback SendDeviceAndLocationInfosOperationCompleted;
        
        private bool useDefaultCredentialsSetExplicitly;
        
        /// <remarks/>
        public GpsTracerServiceContract() {
            this.Url = global::GpsTracerServer.Client.Properties.Settings.Default.GpsTracerServer_Client_localhost_GpsTracerServiceContract;
            if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
                this.UseDefaultCredentials = true;
                this.useDefaultCredentialsSetExplicitly = false;
            }
            else {
                this.useDefaultCredentialsSetExplicitly = true;
            }
        }
        
        public new string Url {
            get {
                return base.Url;
            }
            set {
                if ((((this.IsLocalFileSystemWebService(base.Url) == true) 
                            && (this.useDefaultCredentialsSetExplicitly == false)) 
                            && (this.IsLocalFileSystemWebService(value) == false))) {
                    base.UseDefaultCredentials = false;
                }
                base.Url = value;
            }
        }
        
        public new bool UseDefaultCredentials {
            get {
                return base.UseDefaultCredentials;
            }
            set {
                base.UseDefaultCredentials = value;
                this.useDefaultCredentialsSetExplicitly = true;
            }
        }
        
        /// <remarks/>
        public event SendDeviceAndLocationInfosCompletedEventHandler SendDeviceAndLocationInfosCompleted;
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://GpsTracerServer.ServiceContracts/2007/08/SendDeviceAndLocationInfos", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
        [return: System.Xml.Serialization.XmlElementAttribute(Namespace="http://GpsTracerServer.ServiceContracts/2007/08")]
        public bool SendDeviceAndLocationInfos([System.Xml.Serialization.XmlElementAttribute(Namespace="http://GpsTracerServer.DataTypes/2007/08")] DevicePlusLocationType SendDeviceAndLocationInfosRequest) {
            object[] results = this.Invoke("SendDeviceAndLocationInfos", new object[] {
                        SendDeviceAndLocationInfosRequest});
            return ((bool)(results[0]));
        }
        
        /// <remarks/>
        public void SendDeviceAndLocationInfosAsync(DevicePlusLocationType SendDeviceAndLocationInfosRequest) {
            this.SendDeviceAndLocationInfosAsync(SendDeviceAndLocationInfosRequest, null);
        }
        
        /// <remarks/>
        public void SendDeviceAndLocationInfosAsync(DevicePlusLocationType SendDeviceAndLocationInfosRequest, object userState) {
            if ((this.SendDeviceAndLocationInfosOperationCompleted == null)) {
                this.SendDeviceAndLocationInfosOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSendDeviceAndLocationInfosOperationCompleted);
            }
            this.InvokeAsync("SendDeviceAndLocationInfos", new object[] {
                        SendDeviceAndLocationInfosRequest}, this.SendDeviceAndLocationInfosOperationCompleted, userState);
        }
        
        private void OnSendDeviceAndLocationInfosOperationCompleted(object arg) {
            if ((this.SendDeviceAndLocationInfosCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.SendDeviceAndLocationInfosCompleted(this, new SendDeviceAndLocationInfosCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        public new void CancelAsync(object userState) {
            base.CancelAsync(userState);
        }
        
        private bool IsLocalFileSystemWebService(string url) {
            if (((url == null) 
                        || (url == string.Empty))) {
                return false;
            }
            System.Uri wsUri = new System.Uri(url);
            if (((wsUri.Port >= 1024) 
                        && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
                return true;
            }
            return false;
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.832")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://GpsTracerServer.DataTypes/2007/08")]
    public partial class DevicePlusLocationType {
        
        private string deviceIDField;
        
        private System.DateTime deviceCreationDateField;
        
        private System.DateTime deviceLastLoginDateField;
        
        private double locationLatitudeField;
        
        private double locationLongitudeField;
        
        private System.DateTime locationWhenInsertedField;
        
        private double locationSpeedField;
        
        private double locationQuoteField;
        
        private double locationHeadingField;
        
        /// <remarks/>
        public string DeviceID {
            get {
                return this.deviceIDField;
            }
            set {
                this.deviceIDField = value;
            }
        }
        
        /// <remarks/>
        public System.DateTime DeviceCreationDate {
            get {
                return this.deviceCreationDateField;
            }
            set {
                this.deviceCreationDateField = value;
            }
        }
        
        /// <remarks/>
        public System.DateTime DeviceLastLoginDate {
            get {
                return this.deviceLastLoginDateField;
            }
            set {
                this.deviceLastLoginDateField = value;
            }
        }
        
        /// <remarks/>
        public double LocationLatitude {
            get {
                return this.locationLatitudeField;
            }
            set {
                this.locationLatitudeField = value;
            }
        }
        
        /// <remarks/>
        public double LocationLongitude {
            get {
                return this.locationLongitudeField;
            }
            set {
                this.locationLongitudeField = value;
            }
        }
        
        /// <remarks/>
        public System.DateTime LocationWhenInserted {
            get {
                return this.locationWhenInsertedField;
            }
            set {
                this.locationWhenInsertedField = value;
            }
        }
        
        /// <remarks/>
        public double LocationSpeed {
            get {
                return this.locationSpeedField;
            }
            set {
                this.locationSpeedField = value;
            }
        }
        
        /// <remarks/>
        public double LocationQuote {
            get {
                return this.locationQuoteField;
            }
            set {
                this.locationQuoteField = value;
            }
        }
        
        /// <remarks/>
        public double LocationHeading {
            get {
                return this.locationHeadingField;
            }
            set {
                this.locationHeadingField = value;
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
    public delegate void SendDeviceAndLocationInfosCompletedEventHandler(object sender, SendDeviceAndLocationInfosCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class SendDeviceAndLocationInfosCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal SendDeviceAndLocationInfosCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public bool Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((bool)(this.results[0]));
            }
        }
    }
}

#pragma warning restore 1591

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Italy Italy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions