public ActionResult Create(AuctionFormViewModel viewModel) { // CHECK IF MODEL IS VALID if (!ModelState.IsValid) return RedirectToAction("Details", "influencer"); var userId = User.Identity.GetUserId(); var gig = unitOfWork.GigsRepository.GetGigForDetails(viewModel.GigID); if (gig == null) return HttpNotFound(); if (gig.UserID != userId) return new HttpUnauthorizedResult(); //IF THERE IS ALREADY AN AUCTION FOR THE GIG, REMOVE THE AUCTION AND POST A NEW ONE if (unitOfWork.AuctionRepository.GetAuctionForGig(viewModel.GigID) != null) unitOfWork.AuctionRepository.RemoveAuctionForGig(viewModel.GigID); //CREATE AUTION var auction = Auction.CreateAuction(viewModel, gig, unitOfWork.AuroraWalletRepository.GetAuroraWallet()); //ADD AUCTION TO DB unitOfWork.AuctionRepository.AddAuctionForGig(auction); unitOfWork.Complete(); // WHEN EVERYTHING IS DONE GO TO INDEX return RedirectToAction("Details", "influencer"); }
private Auction ExtractAuctionDataFromDatarow(DataRow row, string orderId) { var a = Auction.CreateAuction(); a.AuctionId = row["id_subasta"].ToString(); a.AuctionDate = DateTime.Parse(row["Fecha subasta"].ToString()); a.Percent = float.Parse(row["valor_porcentaje"].ToString()); a.Value = float.Parse(row["valor_propuesto"].ToString()); a.Weight = float.Parse(row["peso_comprometido"].ToString()); a.LimitDate = DateTime.Parse(row["Fecha limite"].ToString()); a.Observation = row["obs"].ToString(); a.CarrierId = row["id_transportista"].ToString(); a.CarrierName = row["Transportista"].ToString(); a.BidValue = float.Parse(row["valor_puja"].ToString()); if (!string.IsNullOrEmpty(row["Fecha puja"].ToString())) { a.BidValueDate = DateTime.Parse(row["Fecha puja"].ToString()); } a.DispachObservation = row["Observacion transportista"].ToString(); if (!string.IsNullOrEmpty(row["Fecha respuesta"].ToString())) { a.DispachDate = DateTime.Parse(row["Fecha respuesta"].ToString()); } a.CompanyName = row["empresa"].ToString(); a.Destination = row["dir"].ToString(); a.Email = row["email"].ToString(); a.PhoneNumber = row["fono"].ToString(); a.Status = int.Parse(row["estado_subasta"].ToString()); a.Products = GetAuctionProduct(orderId); return(a); }
private void LoadAuctionData(string idSelected) { try{ var usecase = AuctionUseCase.CreateUseCase(); currentAuction = usecase.GetAuctionById(idSelected); LoadAuctionProperties(); } catch (Exception) { currentAuction = Auction.CreateAuction(); } }
private Auction PutsControlsDataIntoAuctionObject() { var a = Auction.CreateAuction(); a.AuctionDate = DateTime.Now.Date; a.LimitDate = LimitDateDateTimePicker.Value; a.Status = 0; a.Percent = float.Parse(ProposeValueNumericUpDown.Value.ToString(CultureInfo.CurrentCulture)); a.Value = float.Parse(ProposeValueTextBox.Text); a.Weight = float.Parse(ProductWeightTextBox.Text); a.Observation = ObservationTextBox.Text; return(a); }
private void GetRecordId() { idSelected = string.Empty; idClientSelected = string.Empty; currentAuction = Auction.CreateAuction(); if (ListDataGridView.Rows.Count.Equals(0)) { return; } var row = ListDataGridView.CurrentRow; if (row == null) { return; } idSelected = row.Cells[0].Value.ToString(); idClientSelected = row.Cells[1].Value.ToString(); LoadBasicProperties(row); LoadOrderDetail(idSelected); LoadAuctionData(idSelected); LoadOrderDispatchData(idSelected); }