public ActionResult Donor_Update([DataSourceRequest] DataSourceRequest request, DonorModel model) { if (model != null && ModelState.IsValid) { var origin = _donorService.FindById(model.DonorID); origin.DonorCode = model.DonorCode; origin.Name = model.Name; origin.IsResponsibleDonor = model.IsResponsibleDonor; origin.IsSourceDonor = model.IsSourceDonor; origin.LongName = model.LongName; _donorService.EditDonor(origin); } return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }
private List <VWCommodityReceived> Bind(List <VWCommodityReceived> receiveds) { var receivedList = new List <VWCommodityReceived>(); foreach (var commodityReceived in receiveds) { var receive = new VWCommodityReceived(); receive.Commited = commodityReceived.Commited; receive.CommodityID = commodityReceived.CommodityID; receive.Commodity = commodityReceived.Commodity; receive.DonorAll = commodityReceived.DonorAll; receive.DonorID = commodityReceived.DonorID; receive.HubID = commodityReceived.HubID; receive.ProgramID = commodityReceived.ProgramID; receive.Received = commodityReceived.Received; receive.ShippingInstruction = commodityReceived.ShippingInstruction; receive.Hub = _hubService.FindById((int)commodityReceived.HubID).Name; receive.Program = _programService.FindById((int)commodityReceived.ProgramID).Name; receive.Donor = _donorService.FindById((int)commodityReceived.DonorID).Name; receivedList.Add(receive); } return(receivedList); }
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); }
public ActionResult GenerateProjectCode(string SINumber, int?DonorID, int?CommodityID, Decimal?QuantityInMT) { //“<Donor Code>-<Commodity Code>-<Quantity-Allocated-To-Hub>/<Quantity-On-Gift-Certificate> string projectCode = null; if (DonorID != null) { Donor repositoryDonorFindById = _donorService.FindById(DonorID.Value); if (repositoryDonorFindById != null && repositoryDonorFindById.DonorCode != null) { projectCode += repositoryDonorFindById.DonorCode.ToUpperInvariant(); } } if (CommodityID != null) { Commodity repositoryCommodityFindById = _commodityService.FindById(CommodityID.Value); if (repositoryCommodityFindById != null && repositoryCommodityFindById.CommodityCode != null) { projectCode += "-" + repositoryCommodityFindById.CommodityCode.ToUpperInvariant(); } } projectCode += "-" + ((QuantityInMT ?? 0).ToString()).ToUpperInvariant(); var shippingInstruction = _shippingInstructionService.FindBy(t => t.Value == SINumber).FirstOrDefault(); if (shippingInstruction != null && _giftCertificateService.FindBySINumber(shippingInstruction.ShippingInstructionID) != null && _giftCertificateService.FindBySINumber(shippingInstruction.ShippingInstructionID).GiftCertificateDetails.Any( p => p.CommodityID == CommodityID)) { projectCode += "/" + _giftCertificateService.FindBySINumber(shippingInstruction.ShippingInstructionID).GiftCertificateDetails.Where( p => p.CommodityID == CommodityID).Sum(q => q.WeightInMT); } return(Json(projectCode, JsonRequestBehavior.AllowGet)); }
// // GET: /Donor/Details/5 public ViewResult Details(int id) { var donor = _donorService.FindById(id); return(View(donor)); }