Пример #1
0
        public static List <Pipeline_TransactionType_Map> GetPipelineTransactionTypeMap()
        {
            List <Pipeline_TransactionType_Map> list = new List <Pipeline_TransactionType_Map>();
            ISheet       sheet;
            HSSFWorkbook hssfwb = new HSSFWorkbook(File.OpenRead(HostingEnvironment.MapPath("~/SeedFiles/PipelinesTransactionMap.xls")));

            sheet = hssfwb.GetSheetAt(0);
            for (int row = 1; row <= sheet.LastRowNum; row++)
            {
                Pipeline_TransactionType_Map map = new Pipeline_TransactionType_Map();
                if (sheet.GetRow(row) != null)
                {
                    map.PipelineID        = Convert.ToInt32(sheet.GetRow(row).GetCell(1).NumericCellValue);
                    map.TransactionTypeID = Convert.ToInt32(sheet.GetRow(row).GetCell(2).NumericCellValue);
                    map.IsActive          = sheet.GetRow(row).GetCell(3).NumericCellValue == 0 ? false : true;
                    map.CreatedBy         = "";
                    map.CreatedDate       = DateTime.Now;
                    map.LastModifiedBy    = "";
                    map.LastModifiedDate  = DateTime.Now;
                    map.PathType          = sheet.GetRow(row).GetCell(8).StringCellValue;
                    list.Add(map);
                }
            }
            return(list);
        }
Пример #2
0
        public Pipeline_TransactionType_Map Create(DTO.Pipeline_TransactionType_MapDTO dto)
        {
            Pipeline_TransactionType_Map Trans = new Pipeline_TransactionType_Map();

            Trans.ID                = dto.ID;
            Trans.IsActive          = dto.IsActive;
            Trans.CreatedBy         = dto.CreatedBy;
            Trans.CreatedDate       = dto.CreatedDate;
            Trans.IsSpecialLocs     = dto.IsSpecialLocs;
            Trans.LastModifiedBy    = dto.LastModifiedBy;
            Trans.LastModifiedDate  = dto.LastModifiedDate;
            Trans.PathType          = dto.PathType;
            Trans.PipeDuns          = dto.PipeDuns;
            Trans.PipelineID        = dto.PipelineID;
            Trans.TransactionTypeID = dto.TransactionTypeID;
            return(Trans);
        }
Пример #3
0
        public Pipeline_TransactionType_MapDTO Parse(Pipeline_TransactionType_Map Trans)
        {
            DTO.Pipeline_TransactionType_MapDTO dto = new DTO.Pipeline_TransactionType_MapDTO();

            dto.ID                = Trans.ID;
            dto.IsActive          = Trans.IsActive;
            dto.CreatedBy         = Trans.CreatedBy;
            dto.CreatedDate       = Trans.CreatedDate;
            dto.IsSpecialLocs     = Trans.IsSpecialLocs;
            dto.LastModifiedBy    = Trans.LastModifiedBy;
            dto.LastModifiedDate  = Trans.LastModifiedDate;
            dto.PathType          = Trans.PathType;
            dto.PipeDuns          = Trans.PipeDuns;
            dto.PipelineID        = Trans.PipelineID;
            dto.TransactionTypeID = Trans.TransactionTypeID;

            return(dto);
        }
Пример #4
0
        protected override void Seed(NomEntities context)
        {
            GetBidUpImdicator().ForEach(c => context.BidUpIndicators.Add(c));
            GetCapacityTypeIndicator().ForEach(c => context.metadataCapacityTypeIndicator.Add(c));
            GetCycle().ForEach(c => context.metadataCycle.Add(c));
            GetExportDeclaration().ForEach(c => context.metadataExportDeclaration.Add(c));
            // GetFileStatus().ForEach(c => context.metadataFileStatu.Add(c));
            GetQuantityTypeIndicator().ForEach(c => context.metadataQuantityTypeIndicator.Add(c));
            GetRequestType().ForEach(c => context.metadataRequestType.Add(c));
            var contractList = ContractSeed.GetContract(); //.ForEach(c => context.Contract.Add(c));

            EmailTemplateSeed.GetEmailSeed().ForEach(c => context.EmailTemplates.Add(c));
            FileStatusSeed.GetFileStatus().ForEach(c => context.metadataFileStatu.Add(c));
            MetadataDataSetSeed.GetDataSet().ForEach(c => context.metadataDataset.Add(c));
            PipelineEncKeyInfoSeed.GetPipelineEncKeyInfo().ForEach(c => context.metadataPipelineEncKeyInfo.Add(c));
            SettingSeed.GetSettingData().ForEach(c => context.Setting.Add(c));
            metadataErrorCodeSeed.GetErrorCode().ForEach(c => context.metadataErrorCode.Add(c));

            GetSendingStatus().ForEach(c => context.SendingStages.Add(c));
            GetReceivingStages().ForEach(c => context.ReceivingStages.Add(c));
            var locationList = LocationsSeed.GetLocations();

            #region Identity Seed
            // add roles
            if (!context.Roles.Any(r => r.Name == "Admin"))
            {
                var store   = new RoleStore <IdentityRole>(context);
                var manager = new RoleManager <IdentityRole>(store);
                var role    = new IdentityRole {
                    Name = "Admin"
                };
                manager.Create(role);
            }
            //add users
            if (!(context.ShipperCompany.Any(u => u.DUNS == "837565548")))
            {
                var shipperCompany = new ShipperCompany
                {
                    Name           = "Shell",
                    DUNS           = "837565548",
                    IsActive       = true,
                    CreatedBy      = "",
                    CreatedDate    = DateTime.Now,
                    ModifiedBy     = "",
                    ModifiedDate   = DateTime.Now,
                    SubscriptionID = 0,
                    ShipperAddress = ""
                };
                context.ShipperCompany.Add(shipperCompany);
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser
                    {
                        UserName             = "******",
                        PhoneNumber          = "0797697898",
                        EmailConfirmed       = true,
                        Email                = "*****@*****.**",
                        PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Monday02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper
                    {
                        UserId           = userToInsert.Id,
                        FirstName        = "Tiffany P",
                        LastName         = "On",
                        ShipperCompanyID = shipperCompany.ID,
                        IsActive         = true,
                        CreatedBy        = "",
                        CreatedDate      = DateTime.Now,
                        ModifiedBy       = "",
                        ModifiedDate     = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Tuesday02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Rebecca J", LastName = "Newson", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Wednesday02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Terry A", LastName = "Mcmillin", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Thursday02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Amanda", LastName = "Boettcher", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Friday02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Jason J", LastName = "Babin", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Saturday02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Deepthi", LastName = "Bollu", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Sunday02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Carly M", LastName = "Billington", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Jan02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Jayme C", LastName = "D'Agnolo", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Feb02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Brandon", LastName = "Johnson", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "March02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Tami L", LastName = "Covington", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "April02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Danielle", LastName = "Foster", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "May02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Christen", LastName = "Schaffer", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "June02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "John", LastName = "Powell", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "July02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Leslie", LastName = "May", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "August02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Justin", LastName = "Babb", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
            }
            if (!(context.ShipperCompany.Any(u => u.DUNS == "078711334")))
            {
                var shipperCompany = new ShipperCompany
                {
                    Name           = "Enercross",
                    DUNS           = "078711334",
                    IsActive       = true,
                    CreatedBy      = "",
                    CreatedDate    = DateTime.Now,
                    ModifiedBy     = "",
                    ModifiedDate   = DateTime.Now,
                    SubscriptionID = 0,
                    ShipperAddress = ""
                };
                context.ShipperCompany.Add(shipperCompany);
                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0797697898", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Monday02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Gagan", LastName = "Deep", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }

                if (!(context.Users.Any(u => u.UserName == "*****@*****.**")))
                {
                    var userStore    = new UserStore <ApplicationUser>(context);
                    var userManager  = new UserManager <ApplicationUser>(userStore);
                    var userToInsert = new ApplicationUser {
                        UserName = "******", PhoneNumber = "0000000000", EmailConfirmed = true, Email = "*****@*****.**", PhoneNumberConfirmed = true,
                    };
                    userManager.Create(userToInsert, "Monday02__");
                    userManager.AddToRole(userToInsert.Id, "Admin");

                    var shipper = new Shipper {
                        UserId = userToInsert.Id, FirstName = "Gagan", LastName = "Deep", ShipperCompanyID = shipperCompany.ID, IsActive = true, CreatedBy = "", CreatedDate = DateTime.Now, ModifiedBy = "", ModifiedDate = DateTime.Now
                    };
                    context.Shipper.Add(shipper);
                }
            }
            #endregion

            #region Add Pipeline
            try
            {
                var pipelineList            = PipelineSeed.GetPipelines();
                var transactionTypeList     = TransactionTypesSeed.GetTransactionTypes();
                var tspList                 = TransportationServiceProviderSeed.GetTransportationServiceProvider();
                var pipelineTranTypeMapList = PipelineTransactionTypeMapSeed.GetPipelineTransactionTypeMap();
                var tpwList                 = TradingPartnerWorksheetSeed.GetTradingPartnerWorksheet();
                var counterPartyList        = CounterPartySeed.GetCounterParty();
                var pipeEncKeyInfoList      = PipelineEncKeyInfoSeed.GetPipelineEncKeyInfo();

                foreach (var tranType in transactionTypeList)
                {
                    var tt = new metadataTransactionType
                    {
                        Identifier = tranType.Identifier,
                        IsActive   = tranType.IsActive,
                        Name       = tranType.Name,
                        SequenceNo = tranType.SequenceNo
                    };
                    context.metadataTransactionType.Add(tt);
                    context.Commit();
                    var tranTypeMapOnPipeTTId = pipelineTranTypeMapList.Where(a => a.TransactionTypeID == tranType.ID).ToList();
                    foreach (var ttm in tranTypeMapOnPipeTTId)
                    {
                        var map = new Pipeline_TransactionType_Map
                        {
                            IsActive          = ttm.IsActive,
                            LastModifiedBy    = ttm.LastModifiedBy,
                            LastModifiedDate  = ttm.LastModifiedDate,
                            PathType          = ttm.PathType,
                            PipeDuns          = "",//pipe.DUNSNo,
                            PipelineID        = ttm.PipelineID,
                            TransactionTypeID = tt.ID,
                            CreatedBy         = "",
                            CreatedDate       = DateTime.Now
                        };
                        context.Pipeline_TransactionType_Map.Add(map);
                        context.Commit();
                    }
                }
                foreach (var tsp in tspList)
                {
                    var tspObj = new TransportationServiceProvider
                    {
                        CreatedBy    = tsp.CreatedBy,
                        CreatedDate  = tsp.CreatedDate,
                        DUNSNo       = tsp.DUNSNo,
                        IsActive     = tsp.IsActive,
                        ModifiedBy   = tsp.ModifiedBy,
                        ModifiedDate = tsp.ModifiedDate,
                        Name         = tsp.Name
                    };
                    context.TransportationServiceProvider.Add(tspObj);
                    context.Commit();
                    var tspPipeList = pipelineList.Where(a => a.TSPId == tsp.ID).ToList();
                    foreach (var pipe in tspPipeList)
                    {
                        var pipeObj = new Pipeline
                        {
                            IsActive     = pipe.IsActive,
                            ModelTypeID  = pipe.ModelTypeID,
                            ModifiedBy   = pipe.ModifiedBy,
                            ModifiedDate = pipe.ModifiedDate,
                            Name         = pipe.Name,
                            ToUseTSPDUNS = pipe.ToUseTSPDUNS,
                            TSPId        = tspObj.ID,
                            CreatedBy    = "",
                            CreatedDate  = DateTime.Now,
                            DUNSNo       = pipe.DUNSNo
                        };
                        context.Pipeline.Add(pipeObj);
                        context.Commit();

                        var pipeTpwList = tpwList.Where(a => a.PipelineID == pipe.ID).ToList();
                        foreach (var tpw in pipeTpwList)
                        {
                            var tpwObj = new TradingPartnerWorksheet
                            {
                                IsActive                = tpw.IsActive,
                                IsTest                  = tpw.IsTest,
                                KeyLive                 = tpw.KeyLive,
                                KeyTest                 = tpw.KeyTest,
                                ModifiedBy              = tpw.ModifiedBy,
                                ModifiedDate            = tpw.ModifiedDate,
                                Name                    = tpw.Name,
                                PasswordLive            = tpw.PasswordLive,
                                PasswordTest            = tpw.PasswordTest,
                                PipeDuns                = pipeObj.DUNSNo,
                                PipelineID              = pipeObj.ID,
                                ReceiveDataSeperator    = tpw.ReceiveDataSeperator,
                                ReceiveSegmentSeperator = tpw.ReceiveSegmentSeperator,
                                ReceiveSubSeperator     = tpw.ReceiveSubSeperator,
                                SendDataSeperator       = tpw.SendDataSeperator,
                                SendSegmentSeperator    = tpw.SendSegmentSeperator,
                                SendSubSeperator        = tpw.SendSubSeperator,
                                URLLive                 = tpw.URLLive,
                                URLTest                 = tpw.URLTest,
                                UsernameLive            = tpw.UsernameLive,
                                UsernameTest            = tpw.UsernameTest,
                                CreatedBy               = "",
                                CreatedDate             = DateTime.Now
                            };
                            context.TradingPartnerWorksheet.Add(tpwObj);
                        }
                        var conPipeList = contractList.Where(a => a.PipelineID == pipe.ID).ToList();
                        foreach (var conPipe in conPipeList)
                        {
                            var con = new Contract
                            {
                                IsActive       = conPipe.IsActive,
                                LocationFromID = conPipe.LocationFromID,
                                LocationToID   = conPipe.LocationToID,
                                MDQ            = conPipe.MDQ,
                                ModifiedBy     = conPipe.ModifiedBy,
                                ModifiedDate   = conPipe.ModifiedDate,
                                PipeDuns       = pipeObj.DUNSNo,
                                PipelineID     = pipeObj.ID,
                                ReceiptZone    = conPipe.ReceiptZone,
                                RequestNo      = conPipe.RequestNo,
                                RequestTypeID  = conPipe.RequestTypeID,
                                ShipperID      = 0,
                                ValidUpto      = conPipe.ValidUpto,
                                CreatedBy      = "",
                                DeliveryZone   = conPipe.DeliveryZone,
                                FuelPercentage = conPipe.FuelPercentage,
                                CreatedDate    = DateTime.Now
                            };
                            context.Contract.Add(con);
                        }
                        var locPipeList = locationList.Where(a => a.PipeDuns.Trim() == pipe.DUNSNo.Trim()).ToList();
                        foreach (var locPipe in locPipeList)
                        {
                            var loc = new Location
                            {
                                Identifier   = locPipe.Identifier,
                                IsActive     = locPipe.IsActive,
                                ModifiedBy   = locPipe.ModifiedBy,
                                ModifiedDate = locPipe.ModifiedDate,
                                Name         = locPipe.Name,
                                PipeDuns     = pipeObj.DUNSNo,
                                PipelineID   = pipeObj.ID,
                                PropCode     = locPipe.PropCode,
                                RDUsageID    = locPipe.RDUsageID,
                                CreatedBy    = locPipe.CreatedBy,
                                CreatedDate  = locPipe.CreatedDate
                            };
                            context.Location.Add(loc);
                        }
                        var ttmpList = context.Pipeline_TransactionType_Map.Where(a => a.PipelineID == pipe.ID).ToList();//pipelineTranTypeMapList.Where(a => a.PipelineID == pipe.ID).ToList();
                        foreach (var map in ttmpList)
                        {
                            map.PipelineID = pipeObj.ID;
                            map.PipeDuns   = pipeObj.DUNSNo;
                            context.Pipeline_TransactionType_Map.Attach(map);
                            var entry = context.Entry(map);
                            entry.Property(e => e.PipelineID).IsModified = true;
                            entry.Property(e => e.PipeDuns).IsModified   = true;
                            context.Commit();
                        }
                        var pipeEncKeyInfoPipeList = pipeEncKeyInfoList.Where(a => a.PipelineId == pipe.ID).ToList();
                        foreach (var peki in pipeEncKeyInfoPipeList)
                        {
                            peki.PipelineId = pipeObj.ID;
                            peki.PipeDuns   = pipeObj.DUNSNo;
                            context.metadataPipelineEncKeyInfo.Add(peki);
                        }
                    }
                }
                foreach (var cp in counterPartyList)
                {
                    context.CounterParty.Add(cp);
                }
            }
            catch (Exception ex)
            {
            }

            #endregion


            context.Commit();
        }