示例#1
0
        public void AgregarAuctionRecord(AuctionRecord record)
        {

            SubastaDAL dal = new SubastaDAL();

            dal.AgregarAuctionRecord(record);
        }
示例#2
0
        public void AgregarAuctionRecord(AuctionRecord record)
        {
            IHCEntities context = new IHCEntities();

            context.AuctionRecord.Add(record);
            context.SaveChanges();
        }
示例#3
0
        public void AgregarAuctionRecord(AuctionRecord record) {

            IHCEntities context = new IHCEntities();

            context.AuctionRecord.Add(record);
            context.SaveChanges();
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            decimal ofertaAcutual = Convert.ToDecimal(txtOfertaActual.Text);
            decimal oferta = Convert.ToDecimal(txtOfertar.Text);
            DateTime fechaInicio;
            DateTime fechaFinal;
            DateTime FechaActual;
            FechaActual= DateTime.Now;
            fechaInicio = Convert.ToDateTime(txtInicio.Text);
            fechaFinal = Convert.ToDateTime(txtFin.Text);
            if (fechaInicio <= FechaActual && fechaFinal >= FechaActual)
            {
                if (ofertaAcutual < oferta)
                {
                    SubastaBLL bl = new SubastaBLL();
                    Auction subasta = new Auction();
                    AuctionRecord record = new AuctionRecord();
                    subasta.AuctionId = Convert.ToInt32(txtNumSubasta.Text);
                    subasta.ProductName = txtNombre.Text;
                    subasta.Description = txtDescripcion.Text;
                    subasta.StartDate = Convert.ToDateTime(txtInicio.Text);
                    subasta.EndDate = Convert.ToDateTime(txtFin.Text);
                    subasta.HighestBid = Convert.ToDecimal(txtOfertar.Text);
                    User user = new User();
                    user = (User)Session["User"];
                    subasta.Winner = user.UserId;
                    bl.UpdateSubasta(subasta);
                    record.AuctionId = Convert.ToInt32(txtNumSubasta.Text);
                    record.UserId = user.UserId;
                    record.Amount = Convert.ToDecimal(txtOfertar.Text);
                    record.BidDate = Convert.ToDateTime(FechaActual);
                    bl.AgregarAuctionRecord(record);
                    ClientScript.RegisterStartupScript(this.GetType(), "alerta", "alert('La oferta se realizo corretamente')", true);
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alerta", "alert('La oferta debe ser mayor a la actual')", true);
                }
            }
            else {
                ClientScript.RegisterStartupScript(this.GetType(), "alerta", "alert('Error, La subasta Estara disponible en las fechas marcadas')", true);
            }


        }
 public void suma()
 {
     ScriptManager.RegisterStartupScript(this, typeof(Page), "calculateTotal", "calculateTotal()", true);
     AuctionRecord record = new AuctionRecord();
     List<AuctionRecord> lstRecord = new List<AuctionRecord>();
     lstRecord = (List<AuctionRecord>)ViewState["lstRecord"];
     decimal suma = 0;
     foreach (AuctionRecord rec in lstRecord)
     {
         suma = suma + rec.Amount;
     }
     txtSuma.Text = suma.ToString();
 }