private bool ProcessNmqrData(List <NMQRPerTransaction> nmqrList) { try { NominationStatu nomStatus = null; V4_Batch batch = null; foreach (var nmqr in nmqrList) { _serviceNmqrPerTransaction.Add(nmqr); _serviceNmqrPerTransaction.Save(); } if (nmqrList.Count > 0) { string referenceNumber = nmqrList.FirstOrDefault().ReferenceNumber; string statusCode = nmqrList.FirstOrDefault().StatusCode; if (!string.IsNullOrEmpty(referenceNumber)) { nomStatus = _serviceNomStatus.GetNomStatusOnReferenceNumber(referenceNumber); } if (nomStatus != null) { nomStatus.NMQR_ID = nmqrList.FirstOrDefault().Transactionid.ToString(); nomStatus.StatusDetail = statusCode; if (nomStatus.StatusDetail == "EZ") { nomStatus.StatusID = (int)statusBatch.Failure_Gisb; } if (nomStatus.StatusDetail == "RZ") { nomStatus.StatusID = (int)statusBatch.Failure_NMQR; } if (nomStatus.StatusDetail == "WQ") { nomStatus.StatusID = (int)statusBatch.Success_NMQR; } _serviceNomStatus.Update(nomStatus); _serviceNomStatus.Save(); batch = _serviceBatch.GetByTransactionID(nomStatus.NOM_ID); if (batch != null) { batch.StatusID = nomStatus.StatusID; _serviceBatch.Update(batch); _serviceBatch.SaveChages(); } } return(true); } return(false); } catch (Exception ex) { return(false); } }
//public bool CopyNomination(Guid TransactionId) //{ // try // { // Guid? newTransactionId = new Guid(); // V4_Batch batch = BatchRepository.GetAll().Where(a => a.TransactionID == TransactionId).FirstOrDefault(); // if (batch != null) // { // Random ran = new Random(); // string TranSetContNumb = Path.GetRandomFileName(); // TranSetContNumb = TranSetContNumb.Replace(".", ""); // batch.StatusID = (int)NomStatus.Draft; // batch.ReferenceNumber = ran.Next(999999999).ToString(); // batch.TransactionSetControlNumber = TranSetContNumb; // batch.TransactionID = Guid.NewGuid(); // batch.CreatedDate = DateTime.Now; // BatchRepository.Add(batch); // V4_Nomination nom = NominationsRepository.GetAll().Where(a => a.TransactionID == TransactionId).FirstOrDefault(); // if (nom != null && newTransactionId != Guid.Empty) // { // V4_Nomination newNom = new V4_Nomination(); // newNom.TransactionID = newTransactionId.Value; // newNom.AssignIdentification = nom.AssignIdentification; // newNom.AssociatedContract = nom.AssociatedContract; // newNom.BidTransportationRate = nom.BidTransportationRate; // newNom.BidupIndicator = nom.BidupIndicator; // newNom.CapacityTypeIndicator = nom.CapacityTypeIndicator; // newNom.ContractNumber = nom.ContractNumber; // newNom.DealType = nom.DealType; // newNom.DeliveryLocationIdentifer = nom.DeliveryLocationIdentifer; // newNom.DeliveryLocationPropCode = nom.DeliveryLocationPropCode; // newNom.DeliveryRank = nom.DeliveryRank; // newNom.DelQuantity = nom.DelQuantity; // newNom.DownstreamContractIdentifier = nom.DownstreamContractIdentifier; // newNom.DownstreamIdentifier = nom.DownstreamIdentifier; // newNom.DownstreamPackageId = nom.DownstreamPackageId; // newNom.DownstreamPropCode = nom.DownstreamPropCode; // newNom.DownstreamRank = nom.DownstreamRank; // newNom.ExportDecleration = nom.ExportDecleration; // newNom.ImbalancePeriod = nom.ImbalancePeriod; // newNom.MaxRateIndicator = nom.MaxRateIndicator; // newNom.NominationSubCycleIndicator = nom.NominationSubCycleIndicator; // newNom.NominationUserData1 = nom.NominationUserData1; // newNom.NominationUserData2 = nom.NominationUserData2; // newNom.NominatorTrackingId = NomTrackingID(9); // newNom.PackageId = nom.PackageId; // newNom.PathRank = nom.PathRank; // newNom.PathType = nom.PathType; // newNom.ProcessingRightIndicator = nom.ProcessingRightIndicator; // newNom.Quantity = nom.Quantity; // newNom.QuantityTypeIndicator = nom.QuantityTypeIndicator; // newNom.ReceiptLocationIdentifier = nom.ReceiptLocationIdentifier; // newNom.receiptLocationPropCode = nom.receiptLocationPropCode; // newNom.ReceiptRank = nom.ReceiptRank; // newNom.Route = nom.Route; // newNom.ServiceProviderActivityCode = nom.ServiceProviderActivityCode; // newNom.TransactionType = nom.TransactionType; // newNom.UnitOfMeasure = nom.UnitOfMeasure; // newNom.UpstreamContractIdentifier = nom.UpstreamContractIdentifier; // newNom.UpstreamIdentifier = nom.UpstreamIdentifier; // newNom.UpstreamPackageId = nom.UpstreamPackageId; // newNom.UpstreamPropCode = nom.UpstreamPropCode; // newNom.UpstreamRank = nom.UpstreamRank; // NominationsRepository.Add(newNom); // return true; // } // else // { // return false; // } // } // else // { // return false; // } // } // catch (Exception ex) // { // return false; // } //} public bool DeleteNominationData(Guid transactionId) { try { V4_Batch batch = BatchRepository.GetByTransactionID(transactionId); batch.IsActive = false; BatchRepository.Update(batch); BatchRepository.SaveChages(); return(true); } catch (Exception ex) { return(false); } }
public Guid?SaveAllNonPathedNominations(NonPathedDTO NonpathedNom) { bool isFly = false; Guid TransactionID = Guid.Empty; #region Save Receipt Noms try { foreach (var RecNom in NonpathedNom.ReceiptNoms) { isFly = false; ContractsDTO flyCon = new ContractsDTO(); Contract con = contractService.GetContractByContractNo(RecNom.ServiceRequesterContractCode, NonpathedNom.PipelineId); if (con == null) { isFly = true; if (RecNom.ServiceRequesterContractCode != null && RecNom.ServiceRequesterContractCode != "") { flyCon = AddContractOnFly(RecNom.ServiceRequesterContractCode, NonpathedNom.PipelineId, NonpathedNom.CompanyId, NonpathedNom.UserId.ToString(), RecNom.FuelPercentage); } //RecNom.FuelPercentage = flyCon.FuelPercentage; } //else //{ // RecNom.FuelPercentage = con.FuelPercentage; //} V4_Batch batch = null; if (RecNom.TransactionId != null) { batch = _batchRepo.GetByTransactionID((RecNom.TransactionId).Value); } if (batch != null) { // Batch Update TransactionID = batch.TransactionID; batch.FlowStartDate = RecNom.StartDateTime; batch.FlowEndDate = RecNom.EndDateTime; batch.CycleId = RecNom.CycleId; batch.NomTypeID = (int)NomType.NonPathed; batch.NomSubCycle = RecNom.NomSubCycle; _batchRepo.Update(batch); _batchRepo.SaveChages(); // Exists Nominations Remove List <V4_Nomination> storedNom = _nominationRepo.GetAllNomsByTransactionId(batch.TransactionID); if (storedNom != null && storedNom.Count > 0) { _nominationRepo.deleteAll(storedNom); } } else { // New Batch Create Random ran = new Random(); string path = Path.GetRandomFileName(); path = path.Replace(".", ""); batch = new V4_Batch(); batch.CreatedBy = NonpathedNom.UserId.ToString(); batch.CreatedDate = DateTime.Now; batch.CycleId = RecNom.CycleId; batch.Description = "Non-Pathed Receipt Nomination" + DateTime.Now.ToString(); batch.FlowEndDate = RecNom.EndDateTime; batch.FlowStartDate = RecNom.StartDateTime; batch.IsActive = true; batch.NomTypeID = (int)NomType.NonPathed; batch.PakageCheck = false; batch.PipelineID = NonpathedNom.PipelineId; batch.RankingCheck = false; batch.ReferenceNumber = ran.Next(999999999).ToString(); batch.ScheduleDate = DateTime.MaxValue; batch.ServiceRequester = NonpathedNom.ShipperDuns; batch.ShowZeroCheck = false; batch.ShowZeroDn = false; batch.ShowZeroUp = false; batch.StatusID = (int)NomStatus.Draft; batch.SubmitDate = DateTime.MaxValue; batch.TransactionSetControlNumber = path; batch.UpDnContractCheck = false; batch.UpDnPkgCheck = false; batch.NomSubCycle = RecNom.NomSubCycle; _batchRepo.Add(batch); _batchRepo.SaveChages(); TransactionID = batch.TransactionID; } var ttPathed = metadataTransactionTypeRepository.GetTTUsingIdentifier(RecNom.TransactionType, "NP", NonpathedNom.PipelineId); V4_Nomination nomRec = new V4_Nomination { TransactionID = batch.TransactionID, AssignIdentification = "", AssociatedContract = "", BidTransportationRate = "", BidupIndicator = "", CapacityTypeIndicator = "", ContractNumber = isFly ? flyCon.RequestNo : RecNom.ServiceRequesterContractCode, DealType = "", DeliveryLocationIdentifer = "", DeliveryLocationName = "", DeliveryLocationPropCode = "", DeliveryRank = "", DelQuantity = 0, DownstreamContractIdentifier = "", DownstreamIdentifier = "", DownstreamPackageId = "", DownstreamPropCode = "", DownstreamName = "", DownstreamRank = "", ExportDecleration = "", FuelPercentage = RecNom.FuelPercentage, ImbalancePeriod = "", MaxDeliveredQty = 0, MaxRateIndicator = "", NominationSubCycleIndicator = RecNom.NomSubCycle, NominationUserData1 = "", NominationUserData2 = "", NominatorTrackingId = NomTrackingID(9), PackageId = RecNom.PackageId, PackageId2 = "", PathRank = "", PathType = "NPR", ProcessingRightIndicator = "", receiptLocationPropCode = RecNom.ReceiptLocProp, ReceiptLocationName = RecNom.ReceiptLocName, ReceiptLocationIdentifier = RecNom.ReceiptLocId, ReceiptRank = RecNom.ReceiptRank, Route = "", ServiceProviderActivityCode = "", TransactionType = RecNom.TransactionType, TransactionTypeDesc = ttPathed != null ? ttPathed.Name : string.Empty, UnitOfMeasure = "BZ", UpstreamContractIdentifier = RecNom.UpstreamK, UpstreamIdentifier = RecNom.UpstreamId, UpstreamName = RecNom.UpstreamName, UpstreamPackageId = "", UpstreamPropCode = RecNom.UpstreamProp, UpstreamRank = "", Quantity = Convert.ToInt32(RecNom.ReceiptQty), QuantityTypeIndicator = "R" // For receipt }; _nominationRepo.Add(nomRec); _nominationRepo.SaveChages(); } } catch (Exception ex) { throw new Exception("Non-Pathed receive noms " + ex.Message + " innerEx:- " + ex.InnerException); } #endregion #region Save Delivery Noms try { foreach (var DeliveryNom in NonpathedNom.DeliveryNoms) { isFly = false; ContractsDTO flyCon = new ContractsDTO(); Contract con = contractService.GetContractByContractNo(DeliveryNom.ServiceRequesterContractCode, NonpathedNom.PipelineId); //contractService.GetAll().Where(a => a.RequestNo == nom.Contract && a.PipelineID == pathedNom.PipelineID).FirstOrDefault(); if (con == null) { isFly = true; if (DeliveryNom.ServiceRequesterContractCode != null && DeliveryNom.ServiceRequesterContractCode != "") { flyCon = AddContractOnFly(DeliveryNom.ServiceRequesterContractCode, NonpathedNom.PipelineId, NonpathedNom.CompanyId, NonpathedNom.UserId.ToString(), DeliveryNom.FuelPercentage); } //DeliveryNom.FuelPercentage = flyCon.FuelPercentage; } //else //{ // DeliveryNom.FuelPercentage = con.FuelPercentage; //} V4_Batch batch = null; if (DeliveryNom.TransactionId != null) { batch = _batchRepo.GetByTransactionID((DeliveryNom.TransactionId).Value); } if (batch != null) { // batch TransactionID = batch.TransactionID; batch.FlowStartDate = DeliveryNom.StartDateTime; batch.FlowEndDate = DeliveryNom.EndDateTime; batch.CycleId = DeliveryNom.CycleId; batch.NomTypeID = (int)NomType.NonPathed; batch.NomSubCycle = DeliveryNom.NomSubCycle; _batchRepo.Update(batch); _batchRepo.SaveChages(); // Exists Nomination Remove List <V4_Nomination> storedNom = _nominationRepo.GetAllNomsByTransactionId(batch.TransactionID); if (storedNom != null && storedNom.Count > 0) { _nominationRepo.deleteAll(storedNom); } } else { // New Batch Create Random ran = new Random(); string path = Path.GetRandomFileName(); path = path.Replace(".", ""); batch = new V4_Batch(); batch.CreatedBy = NonpathedNom.UserId.ToString(); batch.CreatedDate = DateTime.Now; batch.CycleId = DeliveryNom.CycleId; batch.Description = "Non-Pathed Receipt Nomination" + DateTime.Now.ToString(); batch.FlowEndDate = DeliveryNom.EndDateTime; batch.FlowStartDate = DeliveryNom.StartDateTime; batch.IsActive = true; batch.NomTypeID = (int)NomType.NonPathed; batch.PakageCheck = false; batch.PipelineID = NonpathedNom.PipelineId; batch.RankingCheck = false; batch.ReferenceNumber = ran.Next(999999999).ToString(); batch.ScheduleDate = DateTime.MaxValue; batch.ServiceRequester = NonpathedNom.ShipperDuns; batch.ShowZeroCheck = false; batch.ShowZeroDn = false; batch.ShowZeroUp = false; batch.StatusID = (int)NomStatus.Draft; batch.SubmitDate = DateTime.MaxValue; batch.TransactionSetControlNumber = path; batch.UpDnContractCheck = false; batch.UpDnPkgCheck = false; batch.NomSubCycle = DeliveryNom.NomSubCycle; _batchRepo.Add(batch); _batchRepo.SaveChages(); TransactionID = batch.TransactionID; } // Add Nomination var ttPathed = metadataTransactionTypeRepository.GetTTUsingIdentifier(DeliveryNom.TransactionType, "NP", NonpathedNom.PipelineId); V4_Nomination nomDel = new V4_Nomination { TransactionID = batch.TransactionID, AssignIdentification = "", AssociatedContract = "", BidTransportationRate = "", BidupIndicator = "", CapacityTypeIndicator = "", ContractNumber = isFly ? flyCon.RequestNo : DeliveryNom.ServiceRequesterContractCode, DealType = "", DeliveryLocationIdentifer = DeliveryNom.DeliveryLocId, DeliveryLocationName = DeliveryNom.DeliveryLocName, DeliveryLocationPropCode = DeliveryNom.DeliveryLocProp, DeliveryRank = DeliveryNom.DeliveryRank, DelQuantity = Convert.ToInt32(DeliveryNom.DeliveryQty), DownstreamContractIdentifier = DeliveryNom.DnstreamK, DownstreamIdentifier = DeliveryNom.DnstreamId, DownstreamName = DeliveryNom.DeliveryLocName, DownstreamPackageId = "", DownstreamPropCode = DeliveryNom.DnstreamProp, DownstreamRank = "", ExportDecleration = "", FuelPercentage = DeliveryNom.FuelPercentage, ImbalancePeriod = "", MaxDeliveredQty = 0, MaxRateIndicator = "", NominationSubCycleIndicator = DeliveryNom.NomSubCycle, NominationUserData1 = "", NominationUserData2 = "", NominatorTrackingId = NomTrackingID(9), PackageId = DeliveryNom.PackageId, PackageId2 = "", PathRank = "", PathType = "NPD", ProcessingRightIndicator = "", receiptLocationPropCode = "", ReceiptLocationName = "", ReceiptLocationIdentifier = "", ReceiptRank = "", Route = "", ServiceProviderActivityCode = "", TransactionType = DeliveryNom.TransactionType, TransactionTypeDesc = ttPathed != null ? ttPathed.Name : string.Empty, UnitOfMeasure = "BZ", UpstreamContractIdentifier = "", UpstreamIdentifier = "", UpstreamName = "", UpstreamPackageId = "", UpstreamPropCode = "", UpstreamRank = "", Quantity = 0, QuantityTypeIndicator = "D" }; _nominationRepo.Add(nomDel); _nominationRepo.SaveChages(); } } catch (Exception ex) { throw new Exception("Non-Pathed delivery noms " + ex.Message + " innerEx:- " + ex.InnerException);; } #endregion return(TransactionID); }
private Guid?UpdatePathedNomination(PathedDTO pathedNom) { try { bool isFly = false; Guid TransactionID = Guid.Empty; foreach (var nom in pathedNom.PathedNomsList) { isFly = false; V4_Batch batch = BatchRepository.GetByTransactionID(nom.TransactionId); if (batch != null) { ContractsDTO flyCon = new ContractsDTO(); // Contract con = contractService.GetContractByContractNo(nom.Contract, pathedNom.PipelineID); //if (con == null) //{ // isFly = true; // flyCon = AddContractOnFly(nom.Contract, pathedNom.PipelineID, pathedNom.companyId, pathedNom.ShipperID.ToString(),nom.FuelPercentage); // // nom.FuelPercentage = flyCon.FuelPercentage; //} //else //{ // // nom.FuelPercentage = con.FuelPercentage; //} TransactionID = batch.TransactionID; batch.FlowStartDate = nom.StartDate; batch.FlowEndDate = nom.EndDate; batch.CycleId = nom.CycleID; batch.NomTypeID = (int)NomType.Pathed; batch.NomSubCycle = nom.NomSubCycle; batch.CreatedBy = pathedNom.ShipperID.ToString(); BatchRepository.Update(batch); BatchRepository.SaveChages(); List <V4_Nomination> storedNom = NominationsRepository.GetAllNomsByTransactionId(batch.TransactionID); if (storedNom != null && storedNom.Count > 0) { NominationsRepository.deleteAll(storedNom); } V4_Nomination nomination = new V4_Nomination(); nomination.AssignIdentification = nom.AssocContract; nomination.AssociatedContract = nom.ActCode; nomination.BidTransportationRate = nom.BidTransportRate; nomination.BidupIndicator = nom.BidUp; nomination.CapacityTypeIndicator = nom.CapacityType; // nomination.ContractNumber = !string.IsNullOrEmpty(flyCon.RequestNo) ? flyCon.RequestNo : nom.Contract; nomination.ContractNumber = nom.Contract; nomination.DealType = nom.DealType; nomination.DeliveryLocationIdentifer = nom.DelLocID; nomination.DeliveryLocationName = nom.DelLoc; nomination.DeliveryLocationPropCode = nom.DelLocProp; nomination.DeliveryRank = nom.DelRank; nomination.DelQuantity = string.IsNullOrEmpty(nom.DelQuantity.ToString()) ? 0 : Convert.ToInt32(nom.DelQuantity); nomination.DownstreamContractIdentifier = nom.DownContract; nomination.DownstreamIdentifier = nom.DownID; nomination.DownstreamName = nom.DownName; nomination.DownstreamPackageId = nom.DownPkgID; nomination.DownstreamPropCode = nom.DownIDProp; nomination.DownstreamRank = nom.DownRank; nomination.ExportDecleration = nom.Export; nomination.FuelPercentage = nom.FuelPercentage; //nomination.ImbalancePeriod= not in pathedDTO nomination.MaxRateIndicator = nom.MaxRate; nomination.NominationSubCycleIndicator = nom.NomSubCycle; nomination.NominationUserData1 = nom.NomUserData1; nomination.NominationUserData2 = nom.NomUserData2; nomination.NominatorTrackingId = NomTrackingID(9); nomination.PackageId = nom.PkgID; nomination.PathType = "P"; nomination.ProcessingRightIndicator = nom.ProcessingRights; nomination.Quantity = string.IsNullOrEmpty(nom.RecQty) ? 0 : Convert.ToInt32(nom.RecQty); nomination.QuantityTypeIndicator = "R"; // by default value "Receipt" nomination.ReceiptLocationIdentifier = nom.RecLocID; nomination.ReceiptLocationName = nom.RecLocation; nomination.receiptLocationPropCode = nom.RecLocProp; nomination.ReceiptRank = nom.RecRank; nomination.ServiceProviderActivityCode = nom.ActCode; //duplicate nomination.AssignIdentification nomination.TransactionID = batch.TransactionID; nomination.TransactionType = nom.TransType; var ttPathed = metadataTransactionTypeRepository.GetTTUsingIdentifier(nom.TransType, "P", pathedNom.PipelineID); nomination.TransactionTypeDesc = ttPathed != null ? ttPathed.Name : string.Empty; nomination.UpstreamContractIdentifier = nom.UpKContract; nomination.UpstreamIdentifier = nom.UpID; nomination.UpstreamName = nom.UpName; nomination.UpstreamPackageId = nom.UpPkgID; nomination.UpstreamPropCode = nom.UpIDProp; nomination.UpstreamRank = nom.UpRank; nomination.UnitOfMeasure = "BZ"; NominationsRepository.Add(nomination); NominationsRepository.SaveChages(); } else { SavePathedNomination(pathedNom, nom); } } return(TransactionID); } catch (Exception ex) { return(null); } }
private Guid?SavePathedNomination(PathedDTO pathedNom, PathedNomDetailsDTO pathed) { Guid transactionId = new Guid(); try { ContractsDTO flyCon = new ContractsDTO(); Contract con = contractService.GetContractByContractNo(pathed.Contract, pathedNom.PipelineID); if (con == null) { flyCon = AddContractOnFly(pathed.Contract, pathedNom.PipelineID, pathedNom.companyId, pathedNom.ShipperID.ToString(), pathed.FuelPercentage); //pathed.FuelPercentage = flyCon.FuelPercentage; } //else { // pathed.FuelPercentage = con.FuelPercentage; //} Random ran = new Random(); string path = Path.GetRandomFileName(); path = path.Replace(".", ""); V4_Batch batch = new V4_Batch(); batch.CreatedBy = pathedNom.ShipperID.ToString(); batch.CreatedDate = DateTime.Now; batch.CycleId = pathed.CycleID; batch.Description = "Pathed Nomination" + DateTime.Now.ToString(); batch.FlowEndDate = pathed.EndDate; batch.FlowStartDate = pathed.StartDate; batch.NomSubCycle = pathed.NomSubCycle; batch.IsActive = true; //var nomType = PipelineTransactionTypeMapRepository.GetById(pathed.TransTypeMapId); //if (nomType==null || nomType.PathType=="P") // batch.NomTypeID = (int)NomType.Pathed; //else if (nomType.PathType == "NP") // batch.NomTypeID = (int)NomType.NonPathed; batch.NomTypeID = (int)NomType.Pathed; batch.PakageCheck = false; batch.PipelineID = pathedNom.PipelineID; batch.RankingCheck = false; batch.ReferenceNumber = ran.Next(999999999).ToString(); batch.ScheduleDate = DateTime.MaxValue; batch.ServiceRequester = pathedNom.DunsNo; batch.ShowZeroCheck = false; batch.ShowZeroDn = false; batch.ShowZeroUp = false; batch.StatusID = (int)NomStatus.Draft; batch.SubmitDate = DateTime.MaxValue; batch.TransactionSetControlNumber = path; batch.UpDnContractCheck = false; batch.UpDnPkgCheck = false; BatchRepository.Add(batch); BatchRepository.SaveChages(); //if (nomType == null || nomType.PathType == "P") //{ V4_Nomination nomination = new V4_Nomination(); nomination.AssignIdentification = pathed.AssocContract; nomination.AssociatedContract = pathed.ActCode; nomination.BidTransportationRate = pathed.BidTransportRate; nomination.BidupIndicator = pathed.BidUp; nomination.CapacityTypeIndicator = pathed.CapacityType; nomination.ContractNumber = !string.IsNullOrEmpty(flyCon.RequestNo) ? flyCon.RequestNo : pathed.Contract; nomination.DealType = pathed.DealType; nomination.DeliveryLocationIdentifer = pathed.DelLocID; nomination.DeliveryLocationName = pathed.DelLoc; nomination.DeliveryLocationPropCode = pathed.DelLocProp; nomination.DeliveryRank = pathed.DelRank; nomination.DelQuantity = string.IsNullOrEmpty(pathed.DelQuantity.ToString()) ? 0 : Convert.ToInt32(pathed.DelQuantity); nomination.DownstreamContractIdentifier = pathed.DownContract; nomination.DownstreamIdentifier = pathed.DownID; nomination.DownstreamName = pathed.DownName; nomination.DownstreamPackageId = pathed.DownPkgID; nomination.DownstreamPropCode = pathed.DownIDProp; nomination.DownstreamRank = pathed.DownRank; nomination.ExportDecleration = pathed.Export; nomination.FuelPercentage = pathed.FuelPercentage; //nomination.ImbalancePeriod= not in pathedDTO nomination.MaxRateIndicator = pathed.MaxRate; nomination.NominationSubCycleIndicator = pathed.NomSubCycle; nomination.NominationUserData1 = pathed.NomUserData1; nomination.NominationUserData2 = pathed.NomUserData2; nomination.NominatorTrackingId = NomTrackingID(9); nomination.PackageId = pathed.PkgID; //nomination.PathRank=pathed.p nomination.PathType = "P"; nomination.ProcessingRightIndicator = pathed.ProcessingRights; nomination.Quantity = string.IsNullOrEmpty(pathed.RecQty) ? 0 : Convert.ToInt32(pathed.RecQty); nomination.QuantityTypeIndicator = "R"; // By default value "Receipt" nomination.ReceiptLocationIdentifier = pathed.RecLocID; nomination.ReceiptLocationName = pathed.RecLocation; nomination.receiptLocationPropCode = pathed.RecLocProp; nomination.ReceiptRank = pathed.RecRank; //nomination.Route=pathed. nomination.ServiceProviderActivityCode = pathed.ActCode; //duplicate nomination.AssignIdentification nomination.TransactionID = batch.TransactionID; nomination.TransactionType = pathed.TransType; var ttPathed = metadataTransactionTypeRepository.GetTTUsingIdentifier(pathed.TransType, "P", pathedNom.PipelineID); if (ttPathed != null) { nomination.TransactionTypeDesc = ttPathed.Name; } else { nomination.TransactionTypeDesc = string.Empty; } nomination.UpstreamContractIdentifier = pathed.UpKContract; nomination.UpstreamIdentifier = pathed.UpID; nomination.UpstreamName = pathed.UpName; nomination.UpstreamPackageId = pathed.UpPkgID; nomination.UpstreamPropCode = pathed.UpIDProp; nomination.UpstreamRank = pathed.UpRank; nomination.UnitOfMeasure = "BZ"; NominationsRepository.Add(nomination); NominationsRepository.SaveChages(); transactionId = batch.TransactionID; //} //else if (nomType.PathType == "NP") //{ // var ttPathed = metadataTransactionTypeRepository.GetTTUsingIdentifier(pathed.TransType, "NP", pathedNom.PipelineID); // V4_Nomination nomRec= new V4_Nomination // { // TransactionID = batch.TransactionID, // AssignIdentification = "", // AssociatedContract = pathed.AssocContract, // BidTransportationRate = pathed.BidTransportRate, // BidupIndicator = pathed.BidUp, // CapacityTypeIndicator = pathed.CapacityType, // ContractNumber = pathed.Contract, // DealType = pathed.DealType, // DeliveryLocationIdentifer = "", // DeliveryLocationPropCode = "", // DeliveryRank = "", // DelQuantity = 0, // DownstreamContractIdentifier = "", // DownstreamIdentifier = "", // DownstreamPackageId = "", // DownstreamPropCode = "", // DownstreamRank = "", // ExportDecleration = pathed.Export, // FuelPercentage = pathed.FuelPercentage, // ImbalancePeriod = "", // MaxDeliveredQty = 0, // MaxRateIndicator = pathed.MaxRate, // NominationSubCycleIndicator = pathed.NomSubCycle, // NominationUserData1 = "", // NominationUserData2 = "", // NominatorTrackingId = NomTrackingID(9), // PackageId = pathed.PkgIDRec, // PackageId2 = "", // PathRank = "", // PathType = "NPR", // ProcessingRightIndicator = pathed.ProcessingRights, // receiptLocationPropCode = pathed.RecLocProp, // ReceiptLocationIdentifier = pathed.RecLocID, // ReceiptRank = pathed.RecRank, // Route = "", // ServiceProviderActivityCode = "", // TransactionType = pathed.TransType, // TransactionTypeDesc = (ttPathed!=null)?ttPathed.Name:string.Empty, // UnitOfMeasure = "BZ", // UpstreamContractIdentifier = pathed.UpKContract, // UpstreamIdentifier = pathed.UpID, // UpstreamPackageId = pathed.UpPkgID, // UpstreamPropCode = pathed.UpIDProp, // UpstreamRank = pathed.UpRank, // Quantity = string.IsNullOrEmpty(pathed.RecQty) ? 0 : Convert.ToInt32(pathed.RecQty), // QuantityTypeIndicator = "R" // }; // V4_Nomination nomDel = new V4_Nomination // { // TransactionID = batch.TransactionID, // AssignIdentification = "", // AssociatedContract = pathed.AssocContract, // BidTransportationRate = pathed.BidTransportRate, // BidupIndicator = pathed.BidUp, // CapacityTypeIndicator = pathed.CapacityType, // ContractNumber = pathed.Contract, // DealType = pathed.DealType, // DeliveryLocationIdentifer = pathed.DelLocID, // DeliveryLocationPropCode = pathed.DelLocProp, // DeliveryRank = pathed.DelRank, // DelQuantity = Convert.ToInt32(pathed.DelQuantity), // DownstreamContractIdentifier = pathed.DownContract, // DownstreamIdentifier = pathed.DownID, // DownstreamPackageId = pathed.DownPkgID, // DownstreamPropCode = pathed.DownIDProp, // DownstreamRank = pathed.DownRank, // ExportDecleration = pathed.Export, // FuelPercentage = pathed.FuelPercentage, // ImbalancePeriod = "", // MaxDeliveredQty = 0, // MaxRateIndicator = pathed.MaxRate, // NominationSubCycleIndicator = pathed.NomSubCycle, // NominationUserData1 = "", // NominationUserData2 = "", // NominatorTrackingId = NomTrackingID(9), // PackageId2 = "", // PackageId = pathed.PkgID, // PathRank = "", // PathType = "NPD", // ProcessingRightIndicator = pathed.ProcessingRights, // receiptLocationPropCode = "", // ReceiptLocationIdentifier = pathed.ProcessingRights, // ReceiptRank = "", // Route = "", // ServiceProviderActivityCode = pathed.ActCode, // TransactionType = pathed.TransType, // TransactionTypeDesc = ttPathed!=null ? ttPathed.Name : string.Empty, // UnitOfMeasure = "BZ", // UpstreamContractIdentifier = "", // UpstreamIdentifier = "", // UpstreamPackageId = "", // UpstreamPropCode = "", // UpstreamRank = "", // Quantity = 0, // QuantityTypeIndicator = "D" // }; // if (pathed.PathedHybridNonpathedType == 5 || pathed.PathedHybridNonpathedType == 7 || pathed.PathedHybridNonpathedType == 10) // { // NominationsRepository.Add(nomDel); // } // 5 7 10 delivery only // receipt only- 3,9, // both- 1,2,4,6,8 // else if (pathed.PathedHybridNonpathedType == 3 || pathed.PathedHybridNonpathedType == 9) // { // NominationsRepository.Add(nomRec); // } // else // { // NominationsRepository.Add(nomRec); // NominationsRepository.Add(nomDel); // } // NominationsRepository.SaveChages(); //} return(transactionId); } catch (Exception ex) { return(null); } }