public ActionResult Details(int id, int?locationId)
        {
            DatabaseToWebServiceProvider dbConverter = new DatabaseToWebServiceProvider();
            var dataLogics = new DataLogics();
            WebsiteServiceProvider provider = dbConverter.GetServiceProvider(id);
            var categories = dataLogics.GetWebsiteCategories();

            categories.Sort((category1, category2) => category1.Name.CompareTo(category2.Name));
            ViewBag.AllCategories = categories;

            return(this.View(provider));
        }
        public void MyTestInitialize()
        {
            this.target = new DatabaseToWebServiceProvider();

            this.contact = new Contact
            {
                Email    = "*****@*****.**",
                ID       = 1,
                Website  = "www.test.org",
                Phone    = "9373608284",
                HelpLine = "9373608888"
            };

            this.contactPerson = new ContactPerson
            {
                Contact   = this.contact,
                ContactID = 1,
                ID        = 1,
                FirstName = "Test",
                LastName  = "Person",
                JobTitle  = "Tester"
            };

            this.state = new State {
                Abbreviation = "OH", CountryID = 1, FullName = "Ohio", ID = 1
            };
            this.country = new Country {
                Abbreviation = "USA", ID = 1, FullName = "United States of America"
            };
            this.county = new County {
                ID = 1, Name = "test county", StateId = 1, State = this.state
            };

            this.location1 = new Location
            {
                Name            = "Location1",
                CountryID       = 1,
                Country         = this.country,
                City            = "testville 1",
                ContactID       = 1,
                Contact         = this.contact,
                ContactPersonID = 1,
                ID                = 1,
                Display           = true,
                Zip               = "45344",
                Street            = "Test way 1",
                State             = this.state,
                StateID           = this.state.ID,
                ProviderCoverages = new List <ProviderCoverage> {
                    new ProviderCoverage {
                        County = new County {
                            Name = "County1"
                        }
                    }
                }
            };
            this.location2 = new Location
            {
                Name            = "Location2",
                CountryID       = 1,
                Country         = this.country,
                City            = "testville 2",
                ContactID       = 2,
                Contact         = this.contact,
                ContactPersonID = 2,
                ID                = 2,
                Display           = true,
                Zip               = "45344",
                Street            = "Test way 2",
                State             = this.state,
                StateID           = this.state.ID,
                ProviderCoverages = new List <ProviderCoverage> {
                    new ProviderCoverage {
                        County = new County {
                            Name = "County2"
                        }
                    }
                }
            };

            this.locations = new List <Location> {
                this.location1, this.location2
            };

            var providerService11 = new ProviderService {
                ID = 1, ProviderID = 1, ServiceID = 1, ProviderServiceCategory = new ProviderServiceCategory {
                    Name = "Category 1"
                }
            };
            var providerService12 = new ProviderService {
                ID = 2, ProviderID = 1, ServiceID = 2, ProviderServiceCategory = new ProviderServiceCategory {
                    Name = "Category 2"
                }
            };
            var providerService13 = new ProviderService {
                ID = 3, ProviderID = 1, ServiceID = 3, ProviderServiceCategory = new ProviderServiceCategory {
                    Name = "Category 3"
                }
            };

            var providerService21 = new ProviderService {
                ID = 1, ProviderID = 2, ServiceID = 1, ProviderServiceCategory = new ProviderServiceCategory {
                    Name = "Category 1"
                }
            };
            var providerService22 = new ProviderService {
                ID = 2, ProviderID = 2, ServiceID = 2, ProviderServiceCategory = new ProviderServiceCategory {
                    Name = "Category 2"
                }
            };
            var providerService23 = new ProviderService {
                ID = 3, ProviderID = 2, ServiceID = 3, ProviderServiceCategory = new ProviderServiceCategory {
                    Name = "Category 3"
                }
            };

            this.providerServices1 = new List <ProviderService>
            {
                providerService11,
                providerService12,
                providerService13,
            };

            this.providerServices2 = new List <ProviderService>
            {
                providerService21,
                providerService22,
                providerService23
            };

            this.serviceProvider1 = new ServiceProvider
            {
                Description      = "Test description for test 1",
                ID               = 1,
                DisplayRank      = 1,
                ProviderName     = "Test 1",
                Locations        = this.locations,
                ProviderServices = this.providerServices1,
                ServiceTypes     = 1,
                Active           = true,
                ServiceType      = new ServiceType {
                    Description = "Description", ID = 1, Name = "Name"
                }
            };
            this.serviceProvider2 = new ServiceProvider
            {
                Description      = "Test description for test 2",
                ID               = 2,
                DisplayRank      = 2,
                ProviderName     = "Test 2",
                Locations        = this.locations,
                ProviderServices = this.providerServices2,
                ServiceTypes     = 1,
                Active           = false,
                ServiceType      = new ServiceType {
                    Description = "Description", ID = 1, Name = "Name"
                }
            };

            this.serviceProviderList = new List <ServiceProvider> {
                this.serviceProvider1, this.serviceProvider2
            };

            this.providerCoverage1 = new ProviderCoverage {
                AreaID = 1, County = this.county, ID = 1, LocationID = 1
            };
            this.providerCoverage2 = new ProviderCoverage {
                AreaID = 1, County = this.county, ID = 2, LocationID = 2
            };

            this.providerCoverageList = new List <ProviderCoverage> {
                this.providerCoverage1, this.providerCoverage2
            };
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLogics"/> class.
 /// </summary>
 public DataLogics()
 {
     this.dataAccess = new DataAccess();
     this.converter  = new DatabaseToWebServiceProvider();
 }