public bool IsIdentical(Claim claim)
        {
            if (this.ClaimId != claim.ClaimId) return false;
            if (this.Accidents.FName != claim.Accidents.FName) return false;
            if (this.Accidents.LName != claim.Accidents.LName) return false;
            if (this.Accidents.Address != claim.Accidents.Address) return false;
            if (this.Accidents.City != claim.Accidents.City) return false;
            if (this.Accidents.State != claim.Accidents.State) return false;
            if (this.Accidents.Zip != claim.Accidents.Zip) return false;
            if (this.Accidents.ContactPhone != claim.Accidents.ContactPhone) return false;
            if (this.Accidents.Latitude != claim.Accidents.Latitude) return false;
            if (this.Accidents.Longitude != claim.Accidents.Longitude) return false;

            if (this.Description != claim.Description) return false;
            if (this.Status != claim.Status) return false;
            if (this.RentalCar != claim.RentalCar) return false;

            return true;
        }
 //Constructor
 public ClaimFormViewModel(Claim claim)
 {
     Claim = claim;
     States = new SelectList(USStates, claim.Accidents.State);
 }
 public void Delete(Claim claim)
 {
     db.Claims.DeleteOnSubmit(claim);
 }
 public void Add(Claim claim)
 {
     db.Claims.InsertOnSubmit(claim);
 }
 partial void DeleteClaim(Claim instance);
 partial void UpdateClaim(Claim instance);
 partial void InsertClaim(Claim instance);
        //public string Process(int id)
        //{
        //    //Create DiscoveryClient
        //    DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint());

        //    //Create the search criteria for the specified scope
        //    FindCriteria findCriteria = new FindCriteria(typeof(IBilling));

        //    //Add discovery scopes
        //    //findCriteria.Scopes.Add(new Uri("http://www.contoso.com/insurance"));
        //    //findCriteria.Scopes.Add(new Uri("ldap:///ou=insurance,o=contoso,c=us"));
        //    //findCriteria.ScopeMatchBy = FindCriteria.ScopeMatchByExact;

        //    //Find BillingService endpoint
        //    FindResponse findResponse = discoveryClient.Find(findCriteria);

        //    if (findResponse.Endpoints.Count == 0)
        //        return "";

        //    //Pick the first discovered endpoint
        //    EndpointAddress address = findResponse.Endpoints[0].Address;

        //    //Create the target service client
        //    ChannelFactory<IBilling> factory = new ChannelFactory<IBilling>(new BasicHttpBinding(), address);
        //    IBilling client = factory.CreateChannel();

        //    //Call the Billing Service
        //    string status = client.ProcessClaim(id, findResponse.Endpoints.Count, address.Uri.AbsoluteUri);

        //    factory.Close();

        //    //return  a new status of the processed claim
        //    return status;

        //}



        //public string RentCar(int id)
        //{
        //    //Check if the destination endpoint has been announced (discovered) yet
        //    if (String.IsNullOrEmpty(MvcApplication.CarRentalEndpoint))
        //        return "No rental car";

        //    //Create the target service client
        //    ChannelFactory<ICarRental> factory = new ChannelFactory<ICarRental>(new BasicHttpBinding(), MvcApplication.CarRentalEndpoint);
        //    ICarRental client = factory.CreateChannel();

        //    //Call the Car Rental Service
        //    string status = client.FindRentalCar(id);

        //    factory.Close();

        //    //return  a new status of the processed claim
        //    return status;

        //}



        //public string Billing(int id)
        //{
        //    // Create a Discovery Endpoint that points to the proxy service.
        //    Uri probeEndpointAddress = new Uri("net.tcp://localhost:9001/Probe");
        //    DiscoveryEndpoint discoveryEndpoint = new DiscoveryEndpoint(
        //        new NetTcpBinding(), new EndpointAddress(probeEndpointAddress));
            
        //    // Create DiscoveryClient using the previously created discoveryEndpoint
        //    DiscoveryClient managedDiscoveryClient = new DiscoveryClient(discoveryEndpoint);

        //    // Find IChapter6Discovery endpoints
        //    FindResponse findResponse = managedDiscoveryClient.Find(new FindCriteria(typeof(IBilling)));

        //    if (findResponse.Endpoints.Count == 0) return "";

        //    // Pick the first discovered endpoint
        //    EndpointAddress address = findResponse.Endpoints[0].Address;

        //    //Create the target service client
        //    ChannelFactory<IBilling> factory = new ChannelFactory<IBilling>(new BasicHttpBinding(), address);
        //    IBilling client = factory.CreateChannel();

        //    //Call the Billing Service
        //    string status = client.ProcessClaim(id, findResponse.Endpoints.Count, address.Uri.AbsoluteUri);

        //    factory.Close();

        //    //return  a new status of the processed claim
        //    return status;

        //}



        /// <summary>
        /// 
        /// </summary>
        /// <param name="claim"></param>
        /// <returns></returns>
        public bool ProcessClaim(Claim claim)
        {
            bool isSuccess = false;

            using (Claims.Web.ProcessClaim.WF.ProcessClaimServiceClient client =
                new Claims.Web.ProcessClaim.WF.ProcessClaimServiceClient("BasicHttpBinding_IProcessClaimService"))
            {
                //Invoke ProcessClaim Operation
                isSuccess = (bool) client.ProcessClaim(claim);
            }

            return isSuccess;

        }
        public Claim Copy()
        {
            Claim newClaim = new Claim();
            newClaim.ClaimId = this.ClaimId;
            newClaim.Accidents = new Accident();
            newClaim.Accidents.FName = this.Accidents.FName;
            newClaim.Accidents.LName = this.Accidents.LName;
            newClaim.Accidents.Address = this.Accidents.Address;
            newClaim.Accidents.City = this.Accidents.City;
            newClaim.Accidents.State = this.Accidents.State;
            newClaim.Accidents.Zip = this.Accidents.Zip;
            newClaim.Accidents.ContactPhone = this.Accidents.ContactPhone;
            newClaim.Accidents.Latitude = this.Accidents.Latitude;
            newClaim.Accidents.Longitude = this.Accidents.Longitude;

            newClaim.Description = this.Description;
            newClaim.Status = this.Status;
            newClaim.DateCreated = this.DateCreated;
            newClaim.RentalCar = this.RentalCar;

            return newClaim;
        }