// // GET: /PSNP/RegionalPSNPPledge/ public ActionResult Index() { ViewBag.DonorID = new SelectList(_donorService.GetAllDonor(), "DonorID", "Name"); ViewBag.CommodityID = new SelectList(_commodityService.GetAllCommodity(), "CommodityID", "Name"); ViewBag.UnitID = new SelectList(_unitService.GetAllUnit(), "UnitID", "Name"); return(View()); }
// // GET: /ReceiveDetail/Create public virtual ActionResult Create() { ViewBag.CommodityID = new SelectList(_commodityService.GetAllCommodity(), "CommodityID", "Name"); ViewBag.CommodityGradeID = new SelectList(_commodityGradeService.GetAllCommodityGrade(), "CommodityGradeID", "Name"); ViewBag.ReceiveID = new SelectList(_receiveService.GetAllReceive(), "ReceiveID", "SINumber"); ViewBag.UnitID = new SelectList(_unitService.GetAllUnit(), "UnitID", "Name"); return(View()); }
// // GET: /Commodity/ public ActionResult Index() { if (TempData["error"] != null) { ViewData["error"] = TempData["error"].ToString(); } ViewData["Commodities"] = _commodityService.GetAllCommodity().Where(c => c.ParentID == null); ViewData["CommodityTypes"] = _commodityTypeService.GetAllCommodityType(); return(View()); }
private ReceiptAllocationViewModel BindReceiptAllocaitonViewModel() { var user = _userProfileService.GetUser(User.Identity.Name); var commodities = _commodityService.GetAllCommodity().DefaultIfEmpty().OrderBy(o => o.Name).ToList(); var donors = _donorService.GetAllDonor().DefaultIfEmpty().OrderBy(o => o.Name).ToList(); var hubs = new List <Hub>(); if (user != null) { //Hubs = new List<Hub>() { user.DefaultHub }; hubs = _hubService.GetAllWithoutId(user.DefaultHub.HubID).DefaultIfEmpty().OrderBy(o => o.Name) .ToList(); } else { hubs = _hubService.GetAllHub().DefaultIfEmpty().OrderBy(o => o.Name).ToList(); } var programs = _programService.GetAllProgram().DefaultIfEmpty().OrderBy(o => o.Name).ToList(); var commoditySources = _commoditySourceService.GetAllCommoditySource().DefaultIfEmpty().OrderBy(o => o.Name).ToList(); var commodityTypes = _commodityTypeService.GetAllCommodityType().DefaultIfEmpty().OrderBy(o => o.Name).ToList(); var viewModel = new ReceiptAllocationViewModel(commodities, donors, hubs, programs, commoditySources, commodityTypes, user); viewModel.HubID = user.DefaultHub.HubID; return(viewModel); }
// // GET: /GiftCertificate/Create public ActionResult Create() { ViewBag.Commodities = _commodityService.GetAllCommodity().OrderBy(o => o.Name); ViewBag.CommodityTypes = new SelectList(_commodityTypeService.GetAllCommodityType().OrderBy(o => o.Name), "CommodityTypeID", "Name"); ViewBag.DCurrencies = _detailService.GetAllDetail().Where(d => d.MasterID == Master.Constants.CURRENCY).OrderBy(o => o.SortOrder); ViewBag.DFundSources = _detailService.GetAllDetail().Where(d => d.MasterID == Master.Constants.FUND_SOURCE).OrderBy(o => o.SortOrder); ViewBag.DBudgetTypes = _detailService.GetAllDetail().Where(d => d.MasterID == Master.Constants.BUDGET_TYPE).OrderBy(o => o.SortOrder); ViewBag.Donors = new SelectList(_donorService.GetAllDonor().OrderBy(o => o.Name), "DonorID", "Name"); ViewBag.Programs = new SelectList(_programService.GetAllProgram(), "ProgramID", "Name"); ViewBag.DModeOfTransports = new SelectList(_detailService.GetAllDetail().Where(d => d.MasterID == Master.Constants.TRANSPORT_MODE).OrderBy(o => o.SortOrder), "DetailID", "Name"); List <GiftCertificateDetailsViewModel> GiftCertificateDetails = new List <GiftCertificateDetailsViewModel>(); ViewBag.GiftCertificateDetails = GiftCertificateDetails; return(View(new GiftCertificateViewModel())); }
public JsonResult AutoCompleteCommodity(string term) { var result = (from commodity in _commodityService.GetAllCommodity() where commodity.Name.ToLower().StartsWith(term.ToLower()) select commodity.Name); return(Json(result, JsonRequestBehavior.AllowGet)); }
public void loadListItems() { // commodityService.FindById(1).CommodityID; ViewBag.DonorId = new SelectList(donorService.GetAllDonor(), "DonorID", "Name"); ViewBag.HubId = new SelectList(hubService.GetAllHub(), "HubID", "Name"); ViewBag.CommodityId = new SelectList(commodityService.GetAllCommodity(), "CommodityID", "Name"); }
public ActionResult InkindDetails(int id) { var contribution = _contributionService.Get(m => m.ContributionID == id, null, "InkindContributionDetails").FirstOrDefault(); ViewBag.DonorID = contribution.Donor.Name; ViewBag.CommodityID = _commodityService.GetAllCommodity(); if (contribution != null) { return(View(contribution)); } return(RedirectToAction("Index")); }
public ActionResult Details(int id) { ViewBag.RationID = id; var ration = _rationService.FindById(id); var rationViewModel = BindRationViewModel(ration); var commdities = (from item in _commodityService.GetAllCommodity() select new { item.CommodityID, item.Name }); ViewData["commodities"] = commdities; ViewData["UnitMeasures"] = _commodityService.GetAllUnit(); return(View(rationViewModel)); }
// // GET: /StartingBalance/Create public ActionResult Create() { List <Commodity> Commodities; List <Program> Programs; List <Store> Stores; List <Unit> Units; List <Donor> Donors; var user = _userProfileService.GetUser(User.Identity.Name); Commodities = _commodityService.GetAllCommodity().Where(c => c.ParentID != null).ToList(); Programs = _programService.GetAllProgram().ToList(); Stores = _storeService.GetAllStore().Where(h => h.HubID == user.DefaultHub.HubID).ToList(); Units = _unitService.GetAllUnit().ToList(); Donors = _donorSerivce.GetAllDonor().ToList(); StartingBalanceViewModel startingBalanceViewModel = new StartingBalanceViewModel(Commodities, Stores, Units, Programs, Donors, user); return(PartialView(startingBalanceViewModel)); }
//public CommodityController(ICommodityRepository commodityRepository, // ICommodityTypeRepository commodityTypeRepository) //{ // this.commodityRepository = commodityRepository; // this.commodityTypeRepository = commodityTypeRepository; //} public ActionResult Index() { ViewBag.CommodityTypes = _commodityTypeService.GetAllCommodityType(); var parents = _commodityService.GetAllParents().OrderBy(o => o.Name); ViewBag.ParentID = new SelectList(parents, "CommodityID", "Name"); var firstOrDefault = _commodityService.GetAllParents() == null ? null : _commodityService.GetAllParents().FirstOrDefault(); ViewBag.SelectedCommodityID = firstOrDefault != null ? firstOrDefault.CommodityID : 1; ViewBag.Parents = parents; var commReturn = _commodityService.GetAllCommodity() == null?Enumerable.Empty <Commodity>() : _commodityService.GetAllCommodity().ToList(); return(View(commReturn)); }
// // GET: /Commodity/ public ActionResult Index() { ViewData["Commodities"] = _commodityService.GetAllCommodity(); ViewData["CommodityTypes"] = _commodityTypeService.GetAllCommodityType(); return(View()); }
// // GET: /Dispatch/Create public ActionResult Create(string ginNo, int type) { var commodities = _commodityService.GetAllCommodity(); var transporters = _transporterService.GetAllTransporter(); var units = _unitService.GetAllUnit(); var fdps = _fdpService.GetAllFDP(); var programs = _programService.GetAllProgram(); var regions = _adminUnitService.GetRegions(); var zones = _adminUnitService.GetAllAdminUnit().Where(t => t.AdminUnitTypeID == 2).ToList(); var stores = _storeService.GetAllStore(); ViewBag.Units = _unitService.GetAllUnit(); var dispatch = _dispatchService.GetDispatchByGIN(ginNo); var user = _userProfileService.GetUser(User.Identity.Name); if (dispatch != null) { if (user.DefaultHub != null && user.DefaultHub.HubID == dispatch.HubID) { PrepareEdit(dispatch, user, type); var transaction = _dispatchService.GetDispatchTransaction(dispatch.DispatchID); var dis = DispatchModel.GenerateDispatchModel(dispatch, transaction, commodities, transporters, units, fdps, programs, regions, zones, stores); return(View(dis)); } PrepareCreate(type); var comms = new List <DispatchDetailModel>(); ViewBag.SelectedCommodities = comms; var theViewModel = new DispatchModel(commodities, transporters, units, fdps, programs, regions, zones, stores) { Type = type, DispatchDetails = comms }; ViewBag.Message = "The selected GIN Number doesn't exist on your default warehouse. Try changing your default warehouse."; return(View(theViewModel)); } else { PrepareCreate(type); var comms = new List <DispatchDetailModel>(); ViewBag.SelectedCommodities = comms; var theViewModel = new DispatchModel(commodities, transporters, units, fdps, programs, regions, zones, stores) { Type = type, DispatchDetails = comms }; if (Request["type"] != null && Request["allocationId"] != null) { var allocationId = Guid.Parse(Request["allocationId"]); var allocationTypeId = Convert.ToInt32(Request["type"]); if (allocationTypeId == 1)//to FDP { DispatchAllocation toFDPDispatchAllocation = _dispatchAllocationService.FindById(allocationId); theViewModel.FDPID = toFDPDispatchAllocation.FDPID; PrepareFDPForEdit(toFDPDispatchAllocation.FDPID); theViewModel.RequisitionNo = toFDPDispatchAllocation.RequisitionNo; theViewModel.BidNumber = toFDPDispatchAllocation.BidRefNo; theViewModel.SINumber = toFDPDispatchAllocation.ShippingInstruction.Value; theViewModel.ProjectNumber = toFDPDispatchAllocation.ProjectCode.Value; theViewModel.CommodityTypeID = toFDPDispatchAllocation.Commodity.CommodityTypeID; ViewBag.CommodityTypeID = new SelectList(_commodityTypeService.GetAllCommodityType(), "CommodityTypeID", "Name", toFDPDispatchAllocation.Commodity.CommodityTypeID); if (toFDPDispatchAllocation.ProgramID.HasValue) { theViewModel.ProgramID = toFDPDispatchAllocation.ProgramID.Value; ViewBag.ProgramID = new SelectList(_programService.GetAllProgram(), "ProgramID", "Name", theViewModel.ProgramID); } if (toFDPDispatchAllocation.TransporterID.HasValue) { theViewModel.TransporterID = toFDPDispatchAllocation.TransporterID.Value; } ViewBag.TransporterID = new SelectList(_transporterService.GetAllTransporter(), "TransporterID", "Name", theViewModel.TransporterID); if (toFDPDispatchAllocation.Year.HasValue) { theViewModel.Year = toFDPDispatchAllocation.Year.Value; } var years = (from y in _periodService.GetYears() select new { Name = y, Id = y }).ToList(); ViewBag.Year = new SelectList(years, "Id", "Name"); ViewBag.Year = new SelectList(years, "Id", "Name", theViewModel.Year); if (toFDPDispatchAllocation.Month.HasValue) { theViewModel.Month = toFDPDispatchAllocation.Month.Value; } var months = (from y in _periodService.GetMonths(theViewModel.Year) select new { Name = y, Id = y }).ToList(); ViewBag.Month = new SelectList(months, "Id", "Name", theViewModel.Month); if (toFDPDispatchAllocation.Round.HasValue) { theViewModel.Round = toFDPDispatchAllocation.Round.Value; } theViewModel.DispatchAllocationID = toFDPDispatchAllocation.DispatchAllocationID; } else //allocationTypeId == 2 { var otherDispatchAllocation = _otherDispatchAllocationService.FindById(allocationId); theViewModel.ToHubID = otherDispatchAllocation.ToHubID; theViewModel.SINumber = otherDispatchAllocation.ShippingInstruction.Value; theViewModel.ProjectNumber = otherDispatchAllocation.ProjectCode.Value; theViewModel.ProgramID = otherDispatchAllocation.ProgramID; theViewModel.CommodityTypeID = otherDispatchAllocation.Commodity.CommodityTypeID; ViewBag.CommodityTypeID = new SelectList(_commodityTypeService.GetAllCommodityType(), "CommodityTypeID", "Name", otherDispatchAllocation.Commodity.CommodityTypeID); ViewBag.ProgramID = new SelectList(_programService.GetAllProgram(), "ProgramID", "Name", theViewModel.ProgramID); theViewModel.OtherDispatchAllocationID = otherDispatchAllocation.OtherDispatchAllocationID; } } return(View(theViewModel)); } }