Пример #1
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            try
            {
                BIZPlaza.UpdateNOAvailable(Convert.ToInt32(txtIdReserva.Text), User.Identity.GetUserId());

                //envio mail
                Send_Info_Reserva(User.Identity.GetUserId());

                txtIdReserva.Text           = "";
                txtdescEstacionamiento.Text = "";
                txtdescBarrio.Text          = "";
                txtdatosAdicionales.Text    = "";
                txtCalle.Text  = "";
                txtAltura.Text = "";
                txtUser.Text   = "";

                txtIdReserva.Visible = true;
                lblIdReserva.Visible = true;

                pnlTab2.Visible = false;
                pnlTab1.Visible = true;
                //divPrecio.Visible = false;
                lblMensaje.Text = string.Empty;

                cargarReservas();
            }
            catch (Exception)
            {
                Response.Redirect("~/ErrorPage.aspx");
            }
        }
Пример #2
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            cargarMapa();

            try
            {
                lblMensaje.Text = string.Empty;

                //txtLatitud.Text = mapDLatitud.Replace('.',',');
                //txtLongitud.Text = mapLongitud.Replace('.', ',');

                if (lblErrorMapa.Visible)
                {
                    return;
                }

                if (txtIdEstac.Text == string.Empty)
                {
                    int idEstacionamiento = BIZEstacionamiento.Insert(txtDescripcion.Text, txtCalle.Text, Convert.ToInt32(txtAltura.Text), txtDatosAdicionales.Text, Convert.ToInt32(ddlBarrios.SelectedValue),
                                                                      Convert.ToDecimal(Session["latitud"].ToString()), Convert.ToDecimal(Session["longitud"].ToString()));

                    BIZPlaza.Insert(idEstacionamiento, Context.User.Identity.GetUserId(), Convert.ToInt32(ddlTipoAlquiler.SelectedValue), true);
                    //BIZEstacionamiento.Insert(txtDescripcion.Text, txtCalle.Text, Convert.ToInt32(txtAltura.Text), txtDatosAdicionales.Text, Convert.ToInt32(ddlBarrios.SelectedValue),
                    //Convert.ToDecimal(Session["latitud"].ToString().Replace('.', ',')), Convert.ToDecimal(Session["longitud"].ToString().Replace('.', ',')));

                    BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "ALTA", "Estacionamiento");
                }
                else
                {
                    BIZEstacionamiento.Update(Convert.ToInt32(txtIdEstac.Text), txtDescripcion.Text, txtCalle.Text,
                                              Convert.ToInt32(txtAltura.Text), txtDatosAdicionales.Text, Convert.ToInt32(ddlBarrios.SelectedValue), Convert.ToDecimal(txtLatitud.Text), Convert.ToDecimal(txtLongitud.Text), Convert.ToInt32(ddlTipoAlquiler.SelectedValue));

                    BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "MODIFICACIÓN", "Estacionamiento");
                }
                txtIdEstac.Text          = "";
                txtDescripcion.Text      = "";
                txtCalle.Text            = "";
                txtAltura.Text           = "";
                txtDatosAdicionales.Text = "";
                txtIdEstac.Text          = "";
                txtLatitud.Text          = "";
                txtLongitud.Text         = "";


                txtIdEstac.Visible = true;
                lblIdEstac.Visible = true;

                pnlTab2.Visible = false;
                pnlTab1.Visible = true;
                //divPrecio.Visible = false;
                lblMensaje.Text = string.Empty;
                cargarEstacionamientos();
            }
            catch (Exception ex)
            {
                string m = ex.Message;

                Response.Redirect("~/ErrorPage.aspx");
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.User.Identity.IsAuthenticated == true)
            {
                try
                {
                    if (!this.IsPostBack)
                    {
                        BIZReserva.ReservaUpdateFinalizado(DateTime.Today, DateTime.Today.Hour.ToString().PadLeft(2, '0'));

                        ddlZona.DataSource = BIZZona.SelectAll();
                        ddlZona.DataBind();
                        string    query = @"SELECT E.[descripcion], E.[calle], E.[altura], E.[datosAdicionales], B.[descripcion], E.[latitud] ,E.[longitud], TE.[idTipoEstadia]  FROM [Estacionamiento] E, [Plaza] P, [Barrio] B, [TipoEstadia] TE, [Tarifa] T where E.[idEstacionamiento] = P.[idEstacionamiento] AND B.[idBarrio] = E.[idBarrio] AND P.[disponible] = 1 AND P.[pago] = 0 and P.idTarifa = T.idTarifa and T.idTipoEstadia = TE.idTipoEstadia";
                        DataTable dt    = this.GetData(query);

                        int?     idTipoEstadia = !string.IsNullOrEmpty(ddlTipoAlquiler.SelectedValue) ? int.Parse(ddlTipoAlquiler.SelectedValue) : (int?)null;
                        int?     idZona        = int.Parse(ddlZona.SelectedValue);
                        DateTime?fechaDesde    = !string.IsNullOrEmpty(txtFechaDesde.Text) ? Convert.ToDateTime(txtFechaDesde.Text) : (DateTime?)null;
                        DateTime?fechaHasta    = !string.IsNullOrEmpty(txtFechaHasta.Text) ? Convert.ToDateTime(txtFechaHasta.Text) : (DateTime?)null;


                        dt = BIZPlaza.SelectAll(idTipoEstadia, idZona, fechaDesde, fechaHasta).Tables[0];
                        Session["PlazasFiltradas"] = dt;
                        rptMarkers.DataSource      = dt;
                        rptMarkers.DataBind();

                        if (dt.Rows.Count == 0)
                        {
                            /*lblErrorMapa.Text = "No se encuentran plazas disponibles";
                             * lblErrorMapa.Visible = true;*/
                            ((SiteMaster)this.Master).ShowMessage("<strong>No se encuentran plazas disponibles</strong>", SiteMaster.WarningType.Warning);
                        }
                    }
                }
                catch (Exception)
                {
                    rptMarkers.DataSource = null;
                    lblErrorMapa.Visible  = true;
                }
            }
            else
            {
                Response.Redirect("~/Account/Login.aspx");
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "INGRESO", "Login");


                int diario = Convert.ToInt32(BIZPlaza.SelectDisponibilidadDiario(Utils.GetDateTimeLocal()).Tables[0].Rows[0][0]);
                int hora   = Convert.ToInt32(BIZPlaza.SelectDisponibilidadHora(Utils.GetDateTimeLocal(), Utils.GetDateTimeLocal().ToString("HH:mm")).Tables[0].Rows[0][0]);

                lblPlazasDia.Text  = string.Format(lblPlazasDia.Text, diario);
                lblPlazasHora.Text = string.Format(lblPlazasHora.Text, hora);

                if (diario > 10)
                {
                    divDiario.CssClass = string.Format("alert alert-{0} alert-dismissable", UI.SiteMaster.WarningType.Success.ToString().ToLower());
                }
                else if (diario > 0)
                {
                    divDiario.CssClass = string.Format("alert alert-{0} alert-dismissable", UI.SiteMaster.WarningType.Warning.ToString().ToLower());
                }
                else
                {
                    divDiario.CssClass = string.Format("alert alert-{0} alert-dismissable", UI.SiteMaster.WarningType.Danger.ToString().ToLower());
                }

                if (hora > 10)
                {
                    divHora.CssClass = string.Format("alert alert-{0} alert-dismissable", UI.SiteMaster.WarningType.Success.ToString().ToLower());
                }
                else if (hora > 0)
                {
                    divHora.CssClass = string.Format("alert alert-{0} alert-dismissable", UI.SiteMaster.WarningType.Warning.ToString().ToLower());
                }
                else
                {
                    divHora.CssClass = string.Format("alert alert-{0} alert-dismissable", UI.SiteMaster.WarningType.Danger.ToString().ToLower());
                }
            }
        }
Пример #5
0
        private void Filtrar()
        {
            ((SiteMaster)this.Master).HiddenMessage();
            int?     idTipoEstadia = !string.IsNullOrEmpty(ddlTipoAlquiler.SelectedValue) ? int.Parse(ddlTipoAlquiler.SelectedValue) : (int?)null;
            int?     idZona        = int.Parse(ddlZona.SelectedValue);
            DateTime?fechaDesde;
            DateTime?fechaHasta;

            if (idTipoEstadia == 1)
            {
                fechaDesde = !string.IsNullOrEmpty(txtFechaDesde.Text) ? Convert.ToDateTime(txtFechaDesde.Text) : (DateTime?)null;
                fechaHasta = !string.IsNullOrEmpty(txtFechaHasta.Text) ? Convert.ToDateTime(txtFechaHasta.Text) : (DateTime?)null;
            }
            else
            {
                fechaDesde = !string.IsNullOrEmpty(txtFecha.Text) ? Convert.ToDateTime(txtFecha.Text) : (DateTime?)null;
                fechaHasta = !string.IsNullOrEmpty(txtFecha.Text) ? Convert.ToDateTime(txtFecha.Text) : (DateTime?)null;
            }
            if (FechasValidas())
            {
                DataTable dt = BIZPlaza.SelectAll(idTipoEstadia, idZona, fechaDesde, fechaHasta).Tables[0];
                Session["PlazasFiltradas"] = dt;
                rptMarkers.DataSource      = dt;
                rptMarkers.DataBind();

                if (dt.Rows.Count == 0)
                {
                    /*lblErrorMapa.Text = "No se encuentran plazas disponibles";
                     * lblErrorMapa.Visible = true;*/
                    ((SiteMaster)this.Master).ShowMessage("<strong>No se encuentran plazas disponibles</strong>", SiteMaster.WarningType.Warning);
                }
            }
            else
            {
                ((SiteMaster)this.Master).ShowMessage("<strong>Verifique las fechas ingresadas</strong>", SiteMaster.WarningType.Warning);
            }
        }
Пример #6
0
        protected void UploadXML(object sender, EventArgs e)
        {
            lblMje.ForeColor = Color.Green;
            lblMje.Text      = string.Empty;
            string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);

            if (string.IsNullOrEmpty(fileName))
            {
                lblMje.ForeColor = Color.Red;
                lblMje.Text      = "Debe elegir un archivo.";
                return;
            }
            string filePath, xml;

            try
            {
                filePath = Server.MapPath("~/Uploads/") + fileName;
                FileUpload1.SaveAs(filePath);
                xml = File.ReadAllText(filePath);
            }
            catch (Exception)
            {
                lblMje.ForeColor = Color.Red;
                lblMje.Text      = "Debe elegir un archivo existente.";
                return;
            }


            string extension = fileName.Split('.').Length > 0 ? fileName.Split('.')[fileName.Split('.').Length - 1] : "";

            if (!extension.ToUpper().Equals("CSV"))
            {
                lblMje.ForeColor = Color.Red;
                lblMje.Text      = "El archivo debe tener extension CSV.";
                return;
            }

            using (var reader = new StreamReader(@filePath))
            {
                List <string> listA    = new List <string>();
                List <string> listB    = new List <string>();
                int           registro = 0;
                while (!reader.EndOfStream)
                {
                    registro++;
                    try
                    {
                        var      line   = reader.ReadLine();
                        string[] values = line.Split(';');

                        /*
                         * Estacionamiento.value('(descripcion/text())[1]','VARCHAR(100)') AS descripcion, --TAG
                         * Estacionamiento.value('(calle/text())[1]','VARCHAR(100)') AS calle, --TAG
                         * Estacionamiento.value('(altura/text())[1]','INT') AS altura, --TAG
                         * Estacionamiento.value('(datosAdicionales/text())[1]','VARCHAR(100)') AS datosAdicionales, --TAG
                         * Estacionamiento.value('(idBarrio/text())[1]','INT') AS idBarrio, --TAG
                         * Estacionamiento.value('(latitud/text())[1]','NUMERIC(18,6)') AS latitud, --TAG
                         * Estacionamiento.value('(longitud/text())[1]','NUMERIC(18,6)') AS longitud --TAG
                         *
                         * prueba;calle falsa;1234;Springfield;1;-34.454;-58.321;1
                         */

                        if (values.Length == 8)
                        {
                            int idEstacionamiento = BIZEstacionamiento.Insert(values[0], values[1], Convert.ToInt32(values[2]), values[3], Convert.ToInt32(values[4]),
                                                                              Convert.ToDecimal(values[5].Replace(",", ".")), Convert.ToDecimal(values[6].Replace(",", ".")));

                            BIZPlaza.Insert(idEstacionamiento, Context.User.Identity.GetUserId(), int.Parse(values[7]), true);
                        }
                        else
                        {
                            lblMje.Text += "Se produjo error al procesar el registro Nº " + registro + ": La cantidad de campos no es correcta.\n";
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        lblMje.Text = "Se produjo un error al procesar el archivo. Intentalo nuevamente.";
                        return;
                    }
                }
                BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "ALTA", "Carga Masiva Estacionamiento");
                lblMje.Text += "Se importó el archivo correctamente. Se agregaron " + registro + " estacionamientos";
            }
        }
Пример #7
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet dsPlazaDisponible;

                if (!FechasValidas())
                {
                    if (ddlTipoAlquiler.SelectedValue == "1")
                    {
                        ((SiteMaster)this.Master).ShowMessage("<strong>Verifique las fechas ingresadas</strong>", SiteMaster.WarningType.Warning);
                    }
                    else
                    {
                        ((SiteMaster)this.Master).ShowMessage("<strong>Verifique la fecha y horas ingresadas</strong>", SiteMaster.WarningType.Warning);
                    }
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "mostrar();", true);
                    return;
                }

                if (ddlTipoAlquiler.SelectedValue == "1")
                {
                    dsPlazaDisponible = BIZPlaza.SelectDisponibilidadByPlaza(int.Parse(txtIdPlaza.Text), Convert.ToDateTime(txtFechaDesde.Text), Convert.ToDateTime(txtFechaHasta.Text));
                }
                else
                {
                    dsPlazaDisponible = BIZPlaza.SelectDisponibilidadByPlaza(int.Parse(txtIdPlaza.Text), Convert.ToDateTime(txtFecha.Text), Convert.ToDateTime(txtFecha.Text));
                }
                if (dsPlazaDisponible.Tables.Count > 0 && dsPlazaDisponible.Tables[0].Rows.Count > 0)
                {
                    if (ddlTipoAlquiler.SelectedValue == "1")
                    {
                        //lblMensaje.Text = "La plaza no está disponible en la fecha seleccionada";
                        //lblMensaje.Visible = true;
                        ((SiteMaster)this.Master).ShowMessage("<strong>La plaza no está disponible en la fecha seleccionada</strong>", SiteMaster.WarningType.Warning);
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "mostrar();", true);
                        return;
                    }
                    else
                    {
                        foreach (DataRow dr in dsPlazaDisponible.Tables[0].Rows)
                        {
                            int horaInicio = int.Parse(dr["horaDesde"].ToString().Substring(0, 2)) * 100;
                            int horaFin    = int.Parse(dr["horaHasta"].ToString().Substring(0, 2)) * 100;

                            int horaInicioSeleccionada = int.Parse(txtHoraDesde.Text.Substring(0, 2)) * 100 + 1;
                            int horaFinSeleccionada    = int.Parse(txtHoraHasta.Text.Substring(0, 2)) * 100 - 1;

                            if (horaInicioSeleccionada > horaInicio && horaInicioSeleccionada < horaFin)
                            {
                                //lblMensaje.Text = "La plaza no está disponible en la hora seleccionada";
                                //lblMensaje.Visible = true;
                                ((SiteMaster)this.Master).ShowMessage("<strong>La plaza no está disponible en la hora seleccionada</strong>", SiteMaster.WarningType.Warning);
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "mostrar();", true);
                                return;
                            }
                            else if (horaFinSeleccionada > horaInicio && horaFinSeleccionada < horaFin)
                            {
                                //lblMensaje.Text = "La plaza no está disponible en la hora seleccionada";
                                //lblMensaje.Visible = true;
                                ((SiteMaster)this.Master).ShowMessage("<strong>La plaza no está disponible en la hora seleccionada</strong>", SiteMaster.WarningType.Warning);
                                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "mostrar();", true);
                                return;
                            }
                        }
                    }
                }

                //BIZPlaza.UpdateAvailable(Convert.ToInt32(txtIdPlaza.Text), User.Identity.GetUserId());
                if (ddlTipoAlquiler.SelectedValue == "1")
                {
                    BIZReserva.Insert(Convert.ToDateTime(txtFechaDesde.Text), Convert.ToDateTime(txtFechaHasta.Text), null, null, int.Parse(txtIdPlaza.Text), User.Identity.GetUserId());
                }
                else
                {
                    BIZReserva.Insert(Convert.ToDateTime(txtFecha.Text), Convert.ToDateTime(txtFecha.Text), txtHoraDesde.Text, txtHoraHasta.Text, int.Parse(txtIdPlaza.Text), User.Identity.GetUserId());
                }
                //envio mail
                BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "ALTA", "Reserva");
                try
                {
                    Send_Info_Reserva(User.Identity.GetUserId());
                }
                catch (Exception)
                {
                    //Si no envia mail no arrojo error.
                }


                txtIdPlaza.Text             = "";
                txtdescEstacionamiento.Text = "";
                txtdescBarrio.Text          = "";
                txtdatosAdicionales.Text    = "";
                txtCalle.Text  = "";
                txtAltura.Text = "";

                txtIdPlaza.Visible = true;
                lblIdPlaza.Visible = true;

                pnlTab2.Visible = false;
                pnlTab1.Visible = true;
                //divPrecio.Visible = false;
                lblMensaje.Text      = string.Empty;
                lblMensajeError.Text = string.Empty;
                //cargarPlazas();
                Response.Redirect("~/MisReservas.aspx", false);
            }
            catch (Exception ex)
            {
                Response.Redirect("~/ErrorPage.aspx");
            }
        }