using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using PcInventory_v1_1.Models;

namespace PcInventory_v1_1.DAL
{
    public class pcInventoryInitializer : DropCreateDatabaseIfModelChanges<pcinvnetory>
    {

        protected override void Seed(pcinvnetory context)
        {
            

            var newSupplier = new List<Supplier>
            {
                new Supplier { SupplierKey = 1, SupplierName = "DELL", }
                
            };
            newSupplier.ForEach(s => context.Suppliers.Add(s));
            context.SaveChanges();

            var newVendor = new List<Vendor>
            {
                new Vendor { VendorKey=1, VendorName="Audcomp"}
            };
            newVendor.ForEach(s => context.Vendors.Add(s));

            var NewType = new List<DeviceType>
            {
                new DeviceType { DeviceTypeKey = 1, Type = "Laptop" },
                new DeviceType { DeviceTypeKey = 2, Type = "Desktop" },
                new DeviceType { DeviceTypeKey = 3, Type = "Enhanced Laptop" },
                new DeviceType { DeviceTypeKey = 4, Type = "Enhanced Desktop" }
            };
            NewType.ForEach(s => context.DeviceTypes.Add(s));
            context.SaveChanges();

            var newDeviceInfo = new List<DeviceInformation>
            {
                new DeviceInformation { DeviceInfoKey=1, Make="Dell", Model_Description="Latitude E6420 with Docking Station", ModelNumber="E6420", Processor="Intel® Core™ i5-2520M processor", Speed="2.50GHz, 3M cache", HDD="250GB 5400rpm Hard Drive", DeviceTypeKey=1},
                new DeviceInformation { DeviceInfoKey=2, Make="Dell", Model_Description="Optiplex 990", ModelNumber="990", Processor="Intel® Core™ i5-2400", Speed="3.1GHz, 6M", HDD="250GB 3.5 6.0Gb/s SATA with 8MB DataBurst Cache™", DeviceTypeKey=2},
                new DeviceInformation { DeviceInfoKey=3, Make="Dell", Model_Description="Precision T3500", ModelNumber="T3500", Processor="Quad Core Intel® Xeon® W3530", Speed="2.80GHz, 8M L3, 4.8GT/s", HDD="250GB SATA 3.0Gb/s with NCQ and 8MB DataBurst Cache™", DeviceTypeKey=4},
                new DeviceInformation { DeviceInfoKey=4, Make="Dell", Model_Description="Optiplex 990", ModelNumber="990", Processor="Intel® Core™ i5-2400", Speed="3.1GHz, 6M", HDD="250GB 3.5 6.0Gb/s SATA with 8MB DataBurst Cache™", DeviceTypeKey=2},
                new DeviceInformation { DeviceInfoKey=5, Make="Dell", Model_Description="Latitude E6420 with Docking Station", ModelNumber="E6420", Processor="Intel® Core™ i5-2520M processor", Speed="2.50GHz, 3M cache", HDD="250GB 5400rpm Hard Drive", DeviceTypeKey=1},
                new DeviceInformation { DeviceInfoKey=6, Make="Dell", Model_Description="Latitude E6420 with Docking Station", ModelNumber="E6420", Processor="Intel® Core™ i5-2520M processor", Speed="2.50GHz, 3M cache", HDD="250GB 5400rpm Hard Drive", DeviceTypeKey=1}
            };
            newDeviceInfo.ForEach(s => context.DeviceInformations.Add(s));

            var NewEmployee = new List<Employee>
            {
                new Employee { EmployeeKey=11234, First="Miles", Last="Ferridge", Email="mFerridge@hamilton.ca", Extension=1234},
                new Employee { EmployeeKey=12235, First="Glenn", Last="Binkosky", Email="gBinkosky@hamilton.ca", Extension=1234},
                new Employee { EmployeeKey=14568, First="Mark", Last="Mitchell", Email="mMitchell@hamilton.ca", Extension=1234},
                new Employee { EmployeeKey=17845, First="Dan", Last="Croskerry", Email="dCroskerry@hamilton.ca", Extension=1234},
                new Employee { EmployeeKey=17848, First="Norbert", Last="Mazur", Email="nMazur@hamilton.ca", Extension=1234}
            };
            NewEmployee.ForEach(s => context.Employees.Add(s));
            context.SaveChanges();
                               
            var NewDepartment = new List<Department>
            {
                new Department { DepartmentKey=1, DeparmentDescription="CorporateServices"},
                new Department { DepartmentKey=2, DeparmentDescription="Public Works"},
                new Department { DepartmentKey=3, DeparmentDescription="CommunityServices"}
            };
            NewDepartment.ForEach(s => context.Departments.Add(s));
            context.SaveChanges();

            var NewDivision = new List<Division>
            {
                new Division { DivisionKey=1, DivisionDescription="InformationServices", DepartmentKey=1},
                new Division { DivisionKey=2, DivisionDescription="Operations & Waste Management", DepartmentKey=2},
                new Division { DivisionKey=3, DivisionDescription="Facility Services", DepartmentKey=2},
                new Division { DivisionKey=4, DivisionDescription="Recreation", DepartmentKey=3}
            };
            NewDivision.ForEach(s => context.Divisions.Add(s));
            context.SaveChanges();

            var NewSection = new List<Section>
            {
                new Section { SectionKey=1, SectionDesciption="BusinessApplications", DivisionKey=1},
                new Section { SectionKey=2, SectionDesciption="Parks Maintenance", DivisionKey=2},
                new Section { SectionKey=3, SectionDesciption="Road Operations & Maintenance", DivisionKey=2},
                new Section { SectionKey=4, SectionDesciption="Facility Services", DivisionKey=3},
                new Section { SectionKey=5, SectionDesciption="DistrictOperations", DivisionKey=4}
            };
            NewSection.ForEach(s => context.Sections.Add(s));
            context.SaveChanges();

            

            var NewEmpAsset = new List<EmployeeAsset>
            {
                new EmployeeAsset {EmpAssetKey=1, AssetTag="lfo123456", EmployeeKey=1, EffectiveDate=DateTime.Parse("2005-09-01")},
                new EmployeeAsset {EmpAssetKey=2, AssetTag="dfg123456", EmployeeKey=2, EffectiveDate=DateTime.Parse("2005-09-01")},
                new EmployeeAsset {EmpAssetKey=3, AssetTag="ghy123456", EmployeeKey=4, EffectiveDate=DateTime.Parse("2005-09-01")},
                new EmployeeAsset {EmpAssetKey=4, AssetTag="qwe123456", EmployeeKey=3, EffectiveDate=DateTime.Parse("2005-09-01")}
            };
            NewEmpAsset.ForEach(s => context.EmployeeAssets.Add(s));
            context.SaveChanges();

            var newAssets = new List<Asset>
            {
                new Asset {AssetTag="lfo123456", SerialNumber="A123456", WarrantyPeriod= 4, DeviceApprover="Vandermeer, Adam", EmpAssetKey=1, AssetLocation="55 john street toronto", SectionKey= 3, PurchasePrice= 3.35 , BaseLeaseRate= 33.56, MonthlyChargeRate=45.65, LeaseTotal=8564.65, LeaseStartDate=DateTime.Parse("2005-09-01"), LeaseEndDate=DateTime.Parse("2005-09-01"), RunnungLeaseTotal=456.32, SupplierKey=1, VendorKey=1, DeviceInfoKey= 1, Confirm=true, Status="Current"}, 
                new Asset {AssetTag="qwe123456", SerialNumber="B123456", WarrantyPeriod= 4, DeviceApprover="Taylor, Eric", EmpAssetKey=2, AssetLocation="120 adelaide street west",SectionKey= 3, PurchasePrice= 3.35 , BaseLeaseRate= 33.56, MonthlyChargeRate=45.65, LeaseTotal=8564.65, LeaseStartDate=DateTime.Parse("2005-09-01"), LeaseEndDate=DateTime.Parse("2005-09-01"), RunnungLeaseTotal=456.32, SupplierKey=1, VendorKey=1, DeviceInfoKey= 1, Confirm=true, Status="Current"},
                new Asset {AssetTag="tuy123456", SerialNumber="C123456", WarrantyPeriod= 4, DeviceApprover="Taylor, Eric", EmpAssetKey=3, AssetLocation="6985 financial drive", SectionKey= 3, PurchasePrice= 3.35 , BaseLeaseRate= 33.56, MonthlyChargeRate=45.65, LeaseTotal=8564.65, LeaseStartDate=DateTime.Parse("2005-09-01"), LeaseEndDate=DateTime.Parse("2005-09-01"), RunnungLeaseTotal=456.32, SupplierKey=1, VendorKey=1, DeviceInfoKey= 1, Confirm=true, Status="Owned"},
                new Asset {AssetTag="dfg123456", SerialNumber="D123456", WarrantyPeriod= 4, DeviceApprover="Vandermeer, Adam", EmpAssetKey=2, AssetLocation="1600 steeles ave west",SectionKey= 3, PurchasePrice= 3.35 , BaseLeaseRate= 33.56, MonthlyChargeRate=45.65, LeaseTotal=8564.65, LeaseStartDate=DateTime.Parse("2005-09-01"), LeaseEndDate=DateTime.Parse("2005-09-01"), RunnungLeaseTotal=456.32, SupplierKey=1, VendorKey=1, DeviceInfoKey= 1, Confirm=true, Status="Current"},
                new Asset {AssetTag="tre123456", SerialNumber="E123456", WarrantyPeriod= 4, DeviceApprover="Taylor, Eric",EmpAssetKey=4 ,AssetLocation="55 john street toronto", SectionKey= 3, PurchasePrice= 3.35 , BaseLeaseRate= 33.56, MonthlyChargeRate=45.65, LeaseTotal=8564.65, LeaseStartDate=DateTime.Parse("2005-09-01"), LeaseEndDate=DateTime.Parse("2005-09-01"), RunnungLeaseTotal=456.32, SupplierKey=1, VendorKey=1, DeviceInfoKey= 1, Confirm=true, Status="Current"},
                new Asset {AssetTag="bcd123456", SerialNumber="F123456", WarrantyPeriod= 4, DeviceApprover="Beiber, Justin", EmpAssetKey=1, AssetLocation="1 sygun terrace",SectionKey= 3, PurchasePrice= 3.35 , BaseLeaseRate= 33.56, MonthlyChargeRate=45.65, LeaseTotal=8564.65, LeaseStartDate=DateTime.Parse("2005-09-01"), LeaseEndDate=DateTime.Parse("2005-09-01"), RunnungLeaseTotal=456.32, SupplierKey=1, VendorKey=1, DeviceInfoKey= 1, Confirm=true, Status="Owned"},
                new Asset {AssetTag="ghy123456", SerialNumber="G123456", WarrantyPeriod= 4, DeviceApprover="Darling, Mike",EmpAssetKey=4, AssetLocation="55 john street toronto", SectionKey= 3, PurchasePrice= 3.35 , BaseLeaseRate= 33.56, MonthlyChargeRate=45.65, LeaseTotal=8564.65, LeaseStartDate=DateTime.Parse("2005-09-01"), LeaseEndDate=DateTime.Parse("2005-09-01"), RunnungLeaseTotal=456.32, SupplierKey=1, VendorKey=1, DeviceInfoKey= 1, Confirm=true, Status="Owned"},
                new Asset {AssetTag="gby123456", SerialNumber="H123456", WarrantyPeriod= 4, DeviceApprover="Darling, Mike",EmpAssetKey=1, AssetLocation="6985 financial drive", SectionKey= 3, PurchasePrice= 3.35 , BaseLeaseRate= 33.56, MonthlyChargeRate=45.65, LeaseTotal=8564.65, LeaseStartDate=DateTime.Parse("2005-09-01"), LeaseEndDate=DateTime.Parse("2005-09-01"), RunnungLeaseTotal=456.32, SupplierKey=1, VendorKey=1, DeviceInfoKey= 1, Confirm=true, Status="Current"}
            };
            newAssets.ForEach(s => context.Assets.Add(s));
            context.SaveChanges();

         

        }




    }
}