private HttpWebResponse SendFileToTSP(int outboxID, Dictionary <string, object> sendingFilePacket, int pipeId, bool isTest, string shipperName, string transactionId) { Console.WriteLine("****************************************************************************"); Console.WriteLine("\r\nSendzFileToTSP"); string postURL = "", username = "", password = "", userAgent = ""; if (Convert.ToBoolean(_serviceSetting.GetById((int)Settings.iiTestOn).Value)) { postURL = ConfigurationManager.AppSettings["TestUrl"]; username = ConfigurationManager.AppSettings["username"]; password = ConfigurationManager.AppSettings["password"]; } else { TradingPartnerWorksheet tpw = _serviceTPW.GetByPipelineId(pipeId); if (tpw == null) { throw new Exception("TPW is null for pipeline " + pipeId); } else { postURL = isTest ? tpw.URLTest : tpw.URLLive; username = isTest ? tpw.UsernameTest : tpw.UsernameLive; password = isTest ? tpw.PasswordTest : tpw.PasswordLive; } } SaveXmlToDB(transactionId, pipeId, null, null, null, postURL); userAgent = isTest ? shipperName + " Test File Client" : shipperName + " Live File Client"; FormUpload formUpload = new FormUpload(_serviceOutboxMultipartForm); return(formUpload.MultipartFormDataPost(outboxID, postURL, userAgent, sendingFilePacket, username, password)); }
// [ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(int id) { TradingPartnerWorksheet tradingPartnerWorksheet = db.TradingPartnerWorksheet.Find(id); db.TradingPartnerWorksheet.Remove(tradingPartnerWorksheet); db.SaveChanges(); return(RedirectToAction("Index")); }
//[ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "ID,Name,PipelineID,UsernameLive,PasswordLive,URLLive,KeyLive,UsernameTest,PasswordTest,URLTest,KeyTest,ReceiveSubSeperator,ReceiveDataSeperator,ReceiveSegmentSeperator,SendSubSeperator,SendDataSeperator,SendSegmentSeperator,IsTest,IsActive,CreatedBy,CreatedDate,ModifiedBy,ModifiedDate,PipeDuns")] TradingPartnerWorksheet tradingPartnerWorksheet) { if (ModelState.IsValid) { db.Entry(tradingPartnerWorksheet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tradingPartnerWorksheet)); }
// GET: TradingPartnerWorksheets/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TradingPartnerWorksheet tradingPartnerWorksheet = db.TradingPartnerWorksheet.Find(id); if (tradingPartnerWorksheet == null) { return(HttpNotFound()); } return(View(tradingPartnerWorksheet)); }
public static List <TradingPartnerWorksheet> GetTradingPartnerWorksheet() { List <TradingPartnerWorksheet> list = new List <TradingPartnerWorksheet>(); ISheet sheet; HSSFWorkbook hssfwb = new HSSFWorkbook(File.OpenRead(HostingEnvironment.MapPath("~/SeedFiles/TPW.xls"))); sheet = hssfwb.GetSheetAt(0); for (int row = 1; row <= sheet.LastRowNum; row++) { TradingPartnerWorksheet tpw = new TradingPartnerWorksheet(); if (sheet.GetRow(row) != null) { tpw.ID = Convert.ToInt32(sheet.GetRow(row).GetCell(0).NumericCellValue); tpw.Name = sheet.GetRow(row).GetCell(1).StringCellValue; tpw.PipelineID = Convert.ToInt32(sheet.GetRow(row).GetCell(2).NumericCellValue); tpw.UsernameLive = sheet.GetRow(row).GetCell(3) != null?sheet.GetRow(row).GetCell(3).StringCellValue : ""; tpw.PasswordLive = sheet.GetRow(row).GetCell(3) != null?sheet.GetRow(row).GetCell(4).StringCellValue : ""; tpw.URLLive = sheet.GetRow(row).GetCell(5) != null?sheet.GetRow(row).GetCell(5).StringCellValue : ""; tpw.KeyLive = sheet.GetRow(row).GetCell(6) != null?sheet.GetRow(row).GetCell(6).StringCellValue : ""; tpw.UsernameTest = sheet.GetRow(row).GetCell(7) != null?sheet.GetRow(row).GetCell(7).StringCellValue : ""; tpw.PasswordTest = sheet.GetRow(row).GetCell(8) != null?sheet.GetRow(row).GetCell(8).StringCellValue : ""; tpw.URLTest = sheet.GetRow(row).GetCell(9) != null?sheet.GetRow(row).GetCell(9).StringCellValue : ""; tpw.KeyTest = sheet.GetRow(row).GetCell(10) != null?sheet.GetRow(row).GetCell(10).StringCellValue : ""; tpw.ReceiveSubSeperator = ""; tpw.ReceiveDataSeperator = ""; tpw.ReceiveSegmentSeperator = ""; tpw.SendSubSeperator = ""; tpw.SendDataSeperator = ""; tpw.SendSegmentSeperator = ""; tpw.IsTest = sheet.GetRow(row).GetCell(17).NumericCellValue == 0?false:true; tpw.IsActive = sheet.GetRow(row).GetCell(18).NumericCellValue == 0 ? false : true; tpw.CreatedBy = ""; tpw.CreatedDate = DateTime.Now; tpw.ModifiedBy = ""; tpw.ModifiedDate = DateTime.Now; list.Add(tpw); } } return(list); }
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(); }