private IEnumerable <UnContractedTransportersListViewModel> GetBidWinners(IEnumerable <BidWinner> bidWinners) { var datePref = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DatePreference; return((from bidWinner in bidWinners select new UnContractedTransportersListViewModel() { TransporterId = bidWinner.TransporterID, Name = bidWinner.Transporter.Name, RegionName = _adminUnitService.FindById(bidWinner.Transporter.Region).Name, SubCity = bidWinner.Transporter.SubCity, ZoneName = _adminUnitService.FindById(bidWinner.Transporter.Zone).Name, TelephoneNo = bidWinner.Transporter.TelephoneNo, Capital = bidWinner.Transporter.Capital, MobileNo = bidWinner.Transporter.MobileNo, Destination = _adminUnitService.FindById(bidWinner.DestinationID).Name, Source = _adminUnitService.FindById(bidWinner.SourceID).Name, Fdp = bidWinner.AdminUnit.Name }).Distinct()); }
public ActionResult MergeBidWinners(WoredaBidWinnerViewModel woredaBidWinnerViewModel) { var bidWinnerObj = _bidWinnerService.Get(t => t.SourceID == woredaBidWinnerViewModel.SourceId && t.DestinationID == woredaBidWinnerViewModel.DestinationId && t.BidID == woredaBidWinnerViewModel.BidID && t.TransporterID == woredaBidWinnerViewModel.LeavingTransporterID && t.Position == 1 && t.Status == 1).FirstOrDefault(); if (bidWinnerObj != null) { bidWinnerObj.Status = (int)BIDWINNER.Left; _bidWinnerService.EditBidWinner(bidWinnerObj); } var regionObj = _adminUnitService.FindById(woredaBidWinnerViewModel.DestinationId).AdminUnit2.AdminUnit2; //var filter = new PriceQuotationFilterOfferlessViewModel() // { // BidID = woredaBidWinnerViewModel.BidID, // HubID = woredaBidWinnerViewModel.SourceId, // RegionID = regionObj.AdminUnitID // }; return(RedirectToAction("WoredasBidStatus")); }
// // GET: /Regional/Home/ public ActionResult Index() { var currentUser = UserAccountHelper.GetUser(HttpContext.User.Identity.Name); if (!currentUser.RegionalUser || currentUser.RegionID == null) { ModelState.AddModelError("Errors", @"You are not assigned to any region"); } ViewBag.RegionID = currentUser.RegionID; ViewBag.RegionName = currentUser.RegionID != null?_adminUnitService.FindById(currentUser.RegionID ?? 0).Name : "[region not set for user]"; return(View()); }
public ActionResult Index() { UserInfo currentUser = UserAccountHelper.GetUser(HttpContext.User.Identity.Name); ViewBag.RegionName = currentUser.RegionID != null?_adminUnitService.FindById(currentUser.RegionID ?? 0).Name : ""; var hrd = _hrdService.FindBy(m => m.Status == 3).FirstOrDefault(); if (hrd == null) { return(HttpNotFound()); } var summary = GetHRDSummary(hrd.HRDID); return(View(summary)); }
public ViewResult Index() { var membershipUser = Membership.GetUser(); if (membershipUser != null) { var user = _userProfileService.GetUser(membershipUser.UserName); var toFdps = _dispatchAllocationService.GetCommitedAllocationsByHubDetached( user.DefaultHub.HubID, _userProfileService.GetUser(membershipUser.UserName). PreferedWeightMeasurment.ToUpperInvariant(), null, null, null); var loans = _otherDispatchAllocationService.GetAllToOtherOwnerHubs(user); var transfer = _otherDispatchAllocationService.GetAllToCurrentOwnerHubs(user); var adminUnit = new List <AdminUnit> { _adminUnitService.FindById(1) }; var commodityTypes = _commodityTypeService.GetAllCommodityType(); var model = new DispatchHomeViewModel(toFdps, loans, transfer, commodityTypes, adminUnit, user); return(View(model)); } return(null); }
public List <PriceQuotationDetailViewModel> populateForm(PriceQuotationFilterViewModel model) { Session["PriceQuotationFilter"] = model; LoadLookups(); ViewBag.ModelFilter = model; ViewBag.SelectedRegion = _adminUnitService.FindById(model.RegionID); int bidID = model.BidID; ViewBag.SelectedTransporter = _transporterService.FindById(model.TransporterID); Bid SelectedBid = _bidService.FindById(bidID); ViewBag.SelectedBid = SelectedBid; int bidPlanID = SelectedBid.TransportBidPlanID; List <GoodsMovementDetailViewModel> quotationDestinations = GetPlannedDistribution(bidPlanID, model.RegionID); List <PriceQuotationDetailViewModel> qoutation = GetPriceQuotation(quotationDestinations, model.TransporterID, bidID); // return View(qoutation); List <TransportBidQuotation> transporterQuote = _bidQuotationService.FindBy(t => t.BidID == bidID && t.TransporterID == model.TransporterID); Dictionary <string, PriceQuotationDetailViewModel> transporterQuoteDictionary = organizeList(qoutation); foreach (TransportBidQuotation i in transporterQuote) { string hash = i.BidID + "_" + i.TransporterID + "_" + i.SourceID + "_" + i.DestinationID; if (transporterQuoteDictionary.ContainsKey(hash)) { PriceQuotationDetailViewModel pq = transporterQuoteDictionary[hash]; pq.TransportBidQuotationID = i.TransportBidQuotationID; pq.Tariff = (int)i.Tariff; pq.Remark = i.Remark; pq.IsWinner = i.IsWinner; pq.Rank = i.Position; } } return(qoutation); }
public ActionResult Details(int BidID = 0) { //ViewBag.RegionID = new SelectList(_adminUnitService.GetAllAdminUnit(), "AdminUnitID", "Name", RegionID); var datePref = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DatePreference; var bid = _bidService.FindById(BidID); if (bid == null) { return(HttpNotFound()); } var RegionID = bid.RegionID; var r = _adminUnitService.FindById(bid.RegionID); ViewBag.SelectedRegion = r.Name; ViewBag.BidID = new SelectList(_bidService.GetAllBid(), "BidID", "BidNumber", BidID); ViewBag.RegionID = new SelectList(_adminUnitService.FindBy(t => t.AdminUnitTypeID == 2), "AdminUnitID", "Name", RegionID); var bidPlanID = bid.TransportBidPlanID; ViewBag.BidReference = bid.BidNumber; ViewBag.OpeningDate = bid.OpeningDate.ToCTSPreferedDateFormat(datePref); ViewBag.bid = BidID; ViewBag.reg = RegionID; TransportBidPlan bidPlan = _transportBidPlanService.FindById(bidPlanID); List <TransportBidPlanDetail> regionalPlan = _transportBidPlanDetailService.FindBy(t => t.BidPlanID == bidPlanID && t.Destination.AdminUnit2.AdminUnit2.AdminUnitID == RegionID); var regionalPlanSorted = (from planDetail in regionalPlan orderby planDetail.Source.Name, planDetail.Destination.AdminUnit2.Name, planDetail.DestinationID, planDetail.ProgramID select planDetail ).ToList(); var regionPlanDistinct = (from rg in regionalPlanSorted select new RfqViewModel() { SourceWarehouse = rg.Source.Name, DestinationZone = rg.Destination.AdminUnit2.Name, DestinationWoreda = rg.Destination.Name, RegionName = rg.Destination.AdminUnit2.AdminUnit2.Name, Quantity = rg.Quantity / 10, } ).Where(m => m.Quantity > 0) .GroupBy(ac => new { ac.DestinationWoreda, ac.SourceWarehouse, ac.RegionName, ac.DestinationZone }) .Select(ac => new RfqViewModel { SourceWarehouse = ac.Key.SourceWarehouse, DestinationZone = ac.Key.DestinationZone, DestinationWoreda = ac.Key.DestinationWoreda, RegionName = ac.Key.RegionName, Quantity = ac.Sum(m => m.Quantity) }); ViewBag.regionalPlanSorted = regionalPlanSorted; ViewBag.regionPlanDistinct = regionPlanDistinct; ViewBag.BidPlan = bidPlan; ViewBag.region = RegionID; ViewBag.total = regionPlanDistinct.Sum(m => m.Quantity); ViewBag.bidOpeningTime = bid.startTime; return(View(bidPlan)); }