public ActionResult Edit(string pipelineDuns, int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ContractsDTO model = _IContractService.GetContractOnId(id.Value); model.PipeDuns = pipelineDuns; var reqTypeList = _ImetadataRequestTypeService.GetRequestType(); ViewBag.RequestType = reqTypeList; if (model == null) { return(HttpNotFound()); } else { bool isContractUsed = _IContractService.IsContractUsed(model.RequestNo); if (isContractUsed) { TempData["status"] = "Can't Edit. This is a Used-Contract."; return(RedirectToAction("Index", new { pipelineDuns = model.PipeDuns })); } else { return(View(model)); } } }
// GET: Contracts/Create public ActionResult Create(string pipelineDuns) { ContractsDTO model = new ContractsDTO(); model.PipeDuns = pipelineDuns; model.ValidUpto = DateTime.Now.Date; var reqTypeList = _ImetadataRequestTypeService.GetRequestType(); ViewBag.RequestType = reqTypeList; return(View(model)); }
//[ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(int id) { ContractsDTO model = _IContractService.GetContractOnId(id); bool isDeleted = _IContractService.RemoveContract(id); if (isDeleted) { return(RedirectToAction("Index", new { pipelineDuns = model.PipeDuns })); } return(View(model)); }
public bool AddContract(ContractsDTO contract) { try { Contract contractModel = modalFactory.Create(contract); _IContractRepository.Add(contractModel); _IContractRepository.SaveChages(); return(true); } catch (Exception ex) { return(false); } }
public bool UpdateContract(ContractsDTO contract) { try { Contract cntrct = modalFactory.Create(contract); _IContractRepository.Update(cntrct); _IContractRepository.SaveChages(); return(true); } catch (Exception ex) { return(false); } }
// GET: Contracts/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ContractsDTO contract = _IContractService.GetContractOnId(id.Value); if (contract == null) { return(HttpNotFound()); } return(View(contract)); }
public List <ContractsDTO> GetContractsByRiseId(int pIntRiseId) { List <ContractsDTO> lLstContractsDTO = new List <ContractsDTO>(); Recordset lObjRecordset = null; try { lObjRecordset = (Recordset)DIApplication.Company.GetBusinessObject(BoObjectTypes.BoRecordset); string lStrQuery = this.GetSQL("GetContractsByRiseId").InjectSingleValue("RiseId", pIntRiseId); lObjRecordset.DoQuery(lStrQuery); if (lObjRecordset.RecordCount > 0) { for (int i = 0; i < lObjRecordset.RecordCount; i++) { ContractsDTO lObjContractsDTO = new ContractsDTO { Code = lObjRecordset.Fields.Item("Code").Value.ToString(), DocEntry = int.Parse(lObjRecordset.Fields.Item("U_DocEntry").Value.ToString()), DocNum = int.Parse(lObjRecordset.Fields.Item("DocNum").Value.ToString()), RiseId = int.Parse(lObjRecordset.Fields.Item("U_IdRise").Value.ToString()), DocDate = DateTime.Parse(lObjRecordset.Fields.Item("DocDate").Value.ToString()), Status = lObjRecordset.Fields.Item("Status").Value.ToString(), Type = int.Parse(lObjRecordset.Fields.Item("U_MQ_TipoCont").Value.ToString()), Import = double.Parse(lObjRecordset.Fields.Item("Total").Value.ToString()), CardName = lObjRecordset.Fields.Item("CardName").Value.ToString(), MunicipalityCode = lObjRecordset.Fields.Item("MunicipalityId").Value.ToString(), Municipality = lObjRecordset.Fields.Item("Municipality").Value.ToString(), }; lLstContractsDTO.Add(lObjContractsDTO); lObjRecordset.MoveNext(); } } } catch (Exception lObjException) { LogService.WriteError(string.Format("[ContractsDAO - GetContractsByRiseId: {0}]", lObjException.Message)); throw new DAOException(lObjException.Message, lObjException); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(lLstContractsDTO); }
public bool AddContract(ContractsDTO contract) { try { var pipeline = IpipelineRepository.GetById(contract.PipelineID); var pipelineDuns = pipeline.DUNSNo; contract.PipeDuns = pipelineDuns; Contract contractModel = modalFactory.Create(contract); _IContractRepository.Add(contractModel); _IContractRepository.SaveChages(); return(true); } catch (Exception ex) { return(false); } }
/// <summary> /// save contract on fly /// </summary> /// <param name="ContractNumber"></param> /// <param name="FuelPercentage"></param> /// <returns></returns> public bool OnflyContractSave(string ContractNumber, string FuelPercentage, string pipelineDuns) { var identity = (ClaimsPrincipal)Thread.CurrentPrincipal; string company = identity.Claims.Where(c => c.Type == "CompanyId") .Select(c => c.Value).SingleOrDefault(); int companyID = String.IsNullOrEmpty(company) ? 0:int.Parse(company); var userId = identity.Claims.Where(c => c.Type == "UserId") .Select(c => c.Value).SingleOrDefault(); ContractsDTO model = new ContractsDTO(); model.RequestNo = ContractNumber; if (string.IsNullOrEmpty(FuelPercentage)) { model.FuelPercentage = 0; } else { model.FuelPercentage = Convert.ToDecimal(FuelPercentage); } model.PipeDuns = pipelineDuns; model.CreatedBy = userId; model.ModifiedBy = model.CreatedBy; model.ModifiedDate = DateTime.Now; model.CreatedDate = DateTime.Now; model.ShipperID = companyID; model.IsActive = true; model.ValidUpto = DateTime.Now.AddYears(1); bool isCreated = _IContractService.AddContract(model); if (isCreated) { return(true); } else { 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); } }