Example #1
0
        private void clickEnCelda(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            if (e.Column.Caption == "Cancelar Reserva")
            {
                DialogResult dialogResult = MessageBox.Show("¿Desea cancelar la reserva seleccionada?", "Cancelar Reserva", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    ReservaFutura tuplaElegida = gridView1.GetFocusedRow() as ReservaFutura;
                    switch (tuplaElegida.tipoReserva)
                    {
                    //toDo: Ver lógica de cuando se puede eliminar y cuando no
                    case "Reserva Directa":
                        ReservaDirecta.getOneById(tuplaElegida.idReserva).cancelarGanador(this);
                        break;

                    case "Hot Sale":
                        HotSale.getOneById(tuplaElegida.idReserva).cancelarGanador(this);
                        break;

                    case "Subasta Ganada":
                        ganadorDeSubasta.getOneById(tuplaElegida.idReserva).cancelarGanador(this);
                        break;
                    }
                }
            }
        }
 internal void renderizarDetalleHotsale(HotSale hot)
 {
     this.ocultarFormsDerivados();
     this.xUCDetalleHotsale1.inicializar(hot);
     this.xUCDetalleHotsale1.Visible = true;
     this.xUCDetalleHotsale1.BringToFront();
 }
Example #3
0
        public void inicializar(HotSale hots)
        {
            if (Sesion.user != null)
            {
                simpleButton1.Visible = true;
            }
            else
            {
                simpleButton1.Visible = false;
            }
            hot = hots;
            Propiedad prop;

            using (ContextoEntity conexion = new ContextoEntity())
            {
                prop = conexion.Propiedads.Where(p => p.id == hot.idPropiedad).First();
            }
            nombreLabel.Text    = prop.nombre;
            ciudadLabel.Text    = prop.ciudad;
            ubicacionLabel.Text = prop.ubicaciòn;
            provinciaLabel.Text = prop.provincia;
            paisLabel.Text      = prop.pais;
            fechaLabel.Text     = Semanizador.LunesDeSemana(hot.añoReservado, hot.semanaReservada).Date.ToString();
            montoLabel.Text     = hot.monto.ToString();
        }
Example #4
0
        private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            HotSale h = (HotSale)gridView1.GetFocusedRow();

            if (h != null)
            {
                this.xUCDetalleHotsale1.inicializar(h, h.Propiedad);
            }
        }
Example #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            Propiedad    st = encontrarCual(comboBox1.AccessibilityObject.Value);
            DialogResult m  = MessageBox.Show("Desea crear el Hotsale?", "Crear Hotsale", MessageBoxButtons.YesNo);

            if (m == DialogResult.Yes)
            {
                if (st != null)
                {
                    DateTime d;
                    if (DateTime.TryParse(maskedTextBox2.Text, out d))
                    {
                        if (d.CompareTo(DateTime.Now) >= 0)
                        {
                            int numeroSemana = Int32.Parse(comboBox3.SelectedItem.ToString().GetCharsBefore(" - "));
                            if (st.EstaLibre(numeroSemana, (int)comboBox2.SelectedItem, true))
                            {
                                if (Semanizador.LunesDeSemana((int)comboBox2.SelectedItem, numeroSemana).CompareTo(DateTime.Parse(maskedTextBox2.Text).AddDays(7)) > 0)
                                {
                                    HotSale nuevoHotSale = new HotSale(d, d.AddDays(7), maskedTextBox1.AccessibilityObject.Value, numeroSemana, (int)comboBox2.SelectedItem, st);

                                    st.HotSales.Add(nuevoHotSale);

                                    nuevoHotSale.guardarEnBD();

                                    this.inicializar();
                                    MessageBox.Show("Se creó el hotsale con éxito");
                                }
                                else
                                {
                                    MessageBox.Show("Debe existir al menos 7 días de diferencia entre la fecha de inicio y la semana elegida");
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("La fecha de inicio es incorrecta");
                        }
                    }
                    else
                    {
                        MessageBox.Show("No es una fecha valida");
                    }
                }
                else
                {
                    MessageBox.Show("La propiedad elegida es errónea");
                }
            }
        }
Example #6
0
 public void inicializar(HotSale hots, Propiedad prop)
 {
     if (Sesion.user != null)
     {
         simpleButton1.Visible = true;
     }
     else
     {
         simpleButton1.Visible = false;
     }
     hot = hots;
     nombreLabel.Text    = prop.nombre;
     ciudadLabel.Text    = prop.ciudad;
     ubicacionLabel.Text = prop.ubicaciòn;
     provinciaLabel.Text = prop.provincia;
     paisLabel.Text      = prop.pais;
     fechaLabel.Text     = Semanizador.LunesDeSemana(hot.añoReservado, hot.semanaReservada).Date.ToShortDateString();
     montoLabel.Text     = hot.monto.ToString();
 }
Example #7
0
        public void inicializar()
        {
            List <HotSale> hot = HotSale.traerDeDB();
            List <HotSale> ok  = new List <HotSale>();

            foreach (HotSale r in hot)
            {
                if (r.fechaInicio <= DateTime.Now && r.fechaFin >= DateTime.Now && r.idUsuario == null)
                {
                    ok.Add(r);
                }
            }
            gridControl1.DataSource = ok;
            if (gridView1.RowCount > 0)
            {
                xUCDetalleHotsale1.Visible = true;
                HotSale h = (HotSale)gridView1.GetFocusedRow();
                xUCDetalleHotsale1.inicializar(h, h.Propiedad);
            }
            else
            {
                xUCDetalleHotsale1.Visible = false;
            }
        }
Example #8
0
        public void inicializar(Propiedad pro)
        {
            this.propi = pro;
            if (Sesion.user.premium)
            {
                reservaDirectaButton.Visible      = true;
                reservaDirectaComboBox.Visible    = true;
                reservaDirectaLabel.Visible       = true;
                reservaDirectaButton.Enabled      = true;
                reservaDirectaComboBox.DataSource = pro.semanasDisponibles();
                precioReservaDirectaLabel.Enabled = true;
                montoReservaDirectaLabel.Enabled  = true;
                montoReservaDirectaLabel.Text     = pro.montoReserva.ToString();
            }
            else
            {
                reservaDirectaButton.Visible      = false;
                reservaDirectaComboBox.Visible    = false;
                reservaDirectaLabel.Visible       = false;
                reservaDirectaButton.Enabled      = false;
                precioReservaDirectaLabel.Visible = false;
                montoReservaDirectaLabel.Visible  = false;
            }
            var sub = subasta.llenarConSubasta(pro.id);

            if (sub != null)
            {
                List <string> subastasActivas = new List <string>();
                foreach (subasta s in sub)
                {
                    if (s.estaActiva())
                    {
                        subastasActivas.Add(string.Format(Semanizador.LunesDeSemana(Semanizador.semanaSegunFechaInicio(s.fecha_inicio, s.semana_de_subasta).Year, s.semana_de_subasta).ToString("dd/MM/yyyy")));
                        subActivas.Add(s);
                    }
                }
                subastasActivasListBox.DataSource = subastasActivas;
                if (subastasActivasListBox.ItemCount < 1)
                {
                    subastasActivasListBox.Text = "No hay subastas activas";
                }
            }
            else
            {
                subastasActivasListBox.Text = "No hay subastas activas";
            }

            var hot = HotSale.traerDeDB(pro.id);

            if (hot != null)
            {
                List <string> hotsaleActivos = new List <string>();
                foreach (HotSale h in hot)
                {
                    if (h.fechaInicio <= DateTime.Now && h.fechaFin >= DateTime.Now)
                    {
                        hotsaleActivos.Add(string.Format(Semanizador.LunesDeSemana(h.añoReservado, h.semanaReservada).ToString("dd/MM/yyyy")));
                        hotActivos.Add(h);
                    }
                }
                hotsaleBox.DataSource = hotsaleActivos;
                if (hotsaleBox.ItemCount < 1)
                {
                    hotsaleBox.Text = "No hay hotsales activos";
                }
            }
            else
            {
                hotsaleBox.Text = "No hay hotsales activos";
            }
        }