/// <summary> /// Attaches the transaction group. /// </summary> /// <param name="allocation">The allocation.</param> /// <param name="TransactionGroupID">The transaction group ID.</param> /// <returns></returns> public bool AttachTransactionGroup(DispatchAllocation allocation, int TransactionGroupID) { DispatchAllocation original = _unitOfWork.DispatchAllocationRepository.Get( p => p.DispatchAllocationID == allocation.DispatchAllocationID).SingleOrDefault(); if (original != null) { //original.TransactionGroupID = TransactionGroupID; _unitOfWork.Save(); return true; } return false; }
public bool DeleteDispatchAllocation(DispatchAllocation dispatchAllocation) { if (dispatchAllocation == null) return false; _unitOfWork.DispatchAllocationRepository.Delete(dispatchAllocation); _unitOfWork.Save(); return true; }
public bool AddDispatchAllocation(DispatchAllocation dispatchAllocation) { _unitOfWork.DispatchAllocationRepository.Add(dispatchAllocation); _unitOfWork.Save(); return true; }
/// <summary> /// Gets the allocation model. /// </summary> /// <param name="dispatch">The dispatch.</param> /// <returns></returns> private DispatchAllocation GetAllocationModel(DispatchAllocationViewModel dispatch) { DispatchAllocation model = new DispatchAllocation(); model.Amount = dispatch.Amount; model.Beneficiery = dispatch.Beneficiery; model.BidRefNo = dispatch.BidRefNo; model.CommodityID = dispatch.CommodityID; if(dispatch.DispatchAllocationID.HasValue) { model.DispatchAllocationID = dispatch.DispatchAllocationID.Value; } model.DonorID = dispatch.DonorID; model.FDPID = dispatch.FDPID; model.HubID = dispatch.HubID; model.Month = dispatch.Month; model.PartitionID = dispatch.PartitionID; model.ProgramID = dispatch.ProgramID; model.ProjectCodeID = dispatch.ProjectCodeID; model.RequisitionNo = dispatch.RequisitionNo; model.Round = dispatch.Round; model.ShippingInstructionID = dispatch.ShippingInstructionID; model.TransporterID = dispatch.TransporterID; model.Unit = dispatch.Unit; model.Year = dispatch.Year; return model; }
private DispatchAllocationViewModel GetAllocationModel(DispatchAllocation dispatch) { //TODO:Make sure if includeproperties are loaded correctly var fdp = _fdpService.FindById(dispatch.FDPID); DispatchAllocationViewModel model = new DispatchAllocationViewModel(fdp); model.Amount = dispatch.Amount; model.Beneficiery = dispatch.Beneficiery; model.BidRefNo = dispatch.BidRefNo; model.CommodityID = dispatch.CommodityID; model.DispatchAllocationID = dispatch.DispatchAllocationID; model.DonorID = dispatch.DonorID; model.FDPID = dispatch.FDPID; model.HubID = dispatch.HubID; model.Month = dispatch.Month; model.PartitionID = dispatch.PartitionID; model.ProgramID = dispatch.ProgramID; model.ProjectCodeID = dispatch.ProjectCodeID; model.RequisitionNo = dispatch.RequisitionNo; model.Round = dispatch.Round; model.ShippingInstructionID = dispatch.ShippingInstructionID; model.TransporterID = dispatch.TransporterID; model.Unit = dispatch.Unit; model.Year = dispatch.Year; model.CommodityTypeID = dispatch.Commodity.CommodityTypeID; return model; }
private DispatchAllocationViewModelDto BindDispatchAllocationViewModelDto(DispatchAllocation dispatchAllocation) { var target = new DispatchAllocationViewModelDto(); target.Amount = dispatchAllocation.Amount; target.AmountInUnit = dispatchAllocation.AmountInUnit; target.BidRefNo = dispatchAllocation.BidRefNo; target.CommodityID = dispatchAllocation.CommodityID; target.CommodityName = dispatchAllocation.Commodity.Name; target.DispatchAllocationID = dispatchAllocation.DispatchAllocationID; target.DispatchedAmount = dispatchAllocation.DispatchedAmount; target.DispatchedAmountInUnit = dispatchAllocation.DispatchedAmountInUnit; target.FDPName = dispatchAllocation.FDP.Name; target.IsClosed = dispatchAllocation.IsClosed; target.ProjectCodeID = dispatchAllocation.ProjectCodeID; //TODO:Check Region,zone,woreda Name target.Region = dispatchAllocation.FDP.AdminUnit.AdminUnit2.Name; target.RemainingQuantityInQuintals = dispatchAllocation.RemainingQuantityInQuintals; target.RemainingQuantityInUnit = dispatchAllocation.RemainingQuantityInUnit; target.RequisitionNo = dispatchAllocation.RequisitionNo; target.ShippingInstructionID = dispatchAllocation.ShippingInstructionID; target.TransporterName = dispatchAllocation.Transporter.Name; target.Woreda = dispatchAllocation.FDP.AdminUnit.Name; target.Zone = dispatchAllocation.FDP.AdminUnit.AdminUnit2.Name; return target; }
private DispatchAllocationViewModel GetAllocationModelForClose(DispatchAllocation dispatch) { //TODO:Make sure if includeproperties are loaded correctly var fdp = _fdpService.FindById(dispatch.FDPID); var donorid = (dispatch.DonorID) ?? -1; var donor = (donorid != -1) ? _donorService.FindById(donorid).Name : "-"; var monthid = (dispatch.Month) ?? -1; var month = (monthid != -1) ? Cats.Helpers.RequestHelper.MonthName(monthid) : "-"; var projectcodeId = (dispatch.ProjectCodeID) ?? -1; var projectcodevalue = (projectcodeId != -1) ? _projectCodeService.GetProjectCodeValueByProjectCodeId(projectcodeId) : "-"; DispatchAllocationViewModel model = new DispatchAllocationViewModel(fdp); model.Amount = dispatch.Amount; model.BidRefNo = dispatch.BidRefNo; model.FDPName = dispatch.FDP.Name; model.RequisitionNo = dispatch.RequisitionNo; model.Round = dispatch.Round; model.Year = dispatch.Year; model.ProgramName = dispatch.Program.Name; model.CommodityName = dispatch.Commodity.Name; model.MonthName = month; model.ShippingInstruction = dispatch.ShippingInstruction; model.ProjectCodeValue = projectcodevalue; model.RemainingQuantityInQuintals = dispatch.RemainingQuantityInQuintals; return model; }
private DispatchAllocationViewModel GetAllocationModel(DispatchAllocation dispatch) { //TODO:Make sure if includeproperties are loaded correctly var fdp = _fdpService.FindById(dispatch.FDPID); var donorid = (dispatch.DonorID) ?? -1; var donor = (donorid != -1) ? _donorService.FindById(donorid).Name : "-"; var monthid = (dispatch.Month) ?? -1; var month = (monthid != -1) ? Cats.Helpers.RequestHelper.MonthName(monthid) : "-"; DispatchAllocationViewModel model = new DispatchAllocationViewModel(fdp); model.Amount = dispatch.Amount; model.Beneficiery = dispatch.Beneficiery; model.BidRefNo = dispatch.BidRefNo; model.CommodityID = dispatch.CommodityID; model.DispatchAllocationID = dispatch.DispatchAllocationID; model.DonorID = dispatch.DonorID; model.FDPID = dispatch.FDPID; model.HubID = dispatch.HubID; model.Month = dispatch.Month; model.PartitionId = dispatch.PartitionId; model.ProgramID = dispatch.ProgramID; model.ProjectCodeID = dispatch.ProjectCodeID; model.RequisitionNo = dispatch.RequisitionNo; model.Round = dispatch.Round; model.ShippingInstructionID = dispatch.ShippingInstructionID; model.TransporterID = dispatch.TransporterID; model.Unit = dispatch.Unit; model.Year = dispatch.Year; model.CommodityTypeID = dispatch.Commodity.CommodityTypeID; model.ProgramName = dispatch.Program.Name; model.CommodityTypeName = dispatch.Commodity.CommodityType.Name; model.CommodityName = dispatch.Commodity.Name; model.DonorName = donor; model.UnitName = _unitService.FindById(dispatch.Unit) == null ? "-" : _unitService.FindById(dispatch.Unit).Name; model.MonthName = month; model.TransporterName = dispatch.Transporter.Name; return model; }