Exemplo n.º 1
0
 public bool DeleteBid(Bid bid)
 {
     if (bid == null) return false;
     _unitOfWork.BidRepository.Delete(bid);
     _unitOfWork.Save();
     return true;
 }
Exemplo n.º 2
0
 public ActionResult EditBidStatus(Bid bid)
 {
     if (ModelState.IsValid)
     {
         _bidService.EditBid(bid);
         return RedirectToAction("Index");
     }
     ViewBag.StatusID = new SelectList(_statusService.GetAllStatus(), "StatusID", "Name", bid.StatusID);
     ViewBag.TransportBidPlanID = new SelectList(_transportBidPlanService.GetAllTransportBidPlan(),
                                                 "TransportBidPlanID", "ShortName", bid.TransportBidPlanID);
        // return View("Index", _bidService.GetAllBid());
     return View(bid);
 }
Exemplo n.º 3
0
        public ActionResult Create(Bid bid)
        {
            if (ModelState.IsValid)
            {
                var regions = _adminUnitService.FindBy(t => t.AdminUnitTypeID == 2);
                bid.StatusID = (int)BidStatus.Open;
                var bidDetails = (from detail in regions
                                  select new BidDetail()
                                      {
                                          RegionID = detail.AdminUnitID,
                                          AmountForReliefProgram = (decimal)_transportBidPlanDetailService.GetRegionPlanTotal(bid.TransportBidPlanID, detail.AdminUnitID, 1),
                                          AmountForPSNPProgram = (decimal)_transportBidPlanDetailService.GetRegionPlanTotal(bid.TransportBidPlanID, detail.AdminUnitID, 2),
                                          BidDocumentPrice = 0,
                                          CPO = 0,

                                      }).ToList();
                bid.BidDetails = bidDetails;
                _bidService.AddBid(bid);

                return RedirectToAction("Index");
            }
            ViewBag.StatusID = new SelectList(_statusService.GetAllStatus(), "StatusID", "Name");
            ViewBag.BidPlanID = bid.TransportBidPlanID;
            ViewBag.TransportBidPlanID = new SelectList(_transportBidPlanService.GetAllTransportBidPlan(), "TransportBidPlanID", "ShortName", bid.TransportBidPlanID);

            return View(bid);

            //return View("Index", _bidService.GetAllBid());
        }
Exemplo n.º 4
0
        public ActionResult Create(int id = 0)
        {
            var datePref = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DatePreference;
            var bid = new Bid();
            bid.StartDate = DateTime.Now;
            bid.EndDate = DateTime.Now.AddDays(10);
            bid.OpeningDate = DateTime.Now.AddDays(11);
            var regions = _adminUnitService.FindBy(t => t.AdminUnitTypeID == 2);
            ViewBag.StatusID = new SelectList(_statusService.GetAllStatus(), "StatusID", "Name", bid.StatusID = 1);
            bid.BidNumber = _bidService.AutogenerateBidNo();
            ViewBag.BidPlanID = id;

            ViewBag.TransportBidPlanID = new SelectList(_transportBidPlanService.GetAllTransportBidPlan(), "TransportBidPlanID", "ShortName", id);
            return View(bid);
        }
Exemplo n.º 5
0
 public bool AddBid(Bid bid)
 {
     _unitOfWork.BidRepository.Add(bid);
     _unitOfWork.Save();
     return true;
 }
Exemplo n.º 6
0
 public bool EditBid(Bid bid)
 {
     _unitOfWork.BidRepository.Edit(bid);
     _unitOfWork.Save();
     return true;
 }
Exemplo n.º 7
0
 public bool CanApprove(Bid bid)
 {
     var user = (UserIdentity)System.Web.HttpContext.Current.User.Identity;
     return bid.UserProfileId == user.Profile.UserProfileID;
 }
Exemplo n.º 8
0
        private Bid GetBid(CreateBidViewModel bidViewModel)
        {
            var bid = new Bid()
                {

                    RegionID = bidViewModel.RegionID,
                    StartDate = bidViewModel.StartDate,
                    startTime = bidViewModel.StartTime,
                    EndDate = bidViewModel.EndDate,
                    endTime = bidViewModel.EndTime,
                    BidNumber = bidViewModel.BidNumber,
                    BidBondAmount = bidViewModel.BidBondAmount,
                    OpeningDate = bidViewModel.OpeningDate,
                    BidOpeningTime = bidViewModel.BidOpningTime,
                    StatusID = bidViewModel.StatusID,
                    TransportBidPlanID = bidViewModel.TransportBidPlanID

                };
            return bid;
        }