Beispiel #1
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            try
            {
                lblMensaje.Text = string.Empty;
                int reserva;
                if (!int.TryParse(ddlReserva.SelectedValue, out reserva) || reserva <= 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "mostrar();", true);
                    lblMensaje.Text    = "Ingrese una reserva.";
                    lblMensaje.Visible = true;
                    return;
                }
                if (string.IsNullOrEmpty(Path.GetFileName(FileUpload1.PostedFile.FileName)))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "pepe", "mostrar();", true);
                    lblMensaje.Text    = "Ingrese una imagen.";
                    lblMensaje.Visible = true;
                    return;
                }
                if (txtIdReclamo.Text == string.Empty)
                {
                    int idReclamo = BIZReclamo.Insert(int.Parse(ddlReserva.SelectedValue), txtPatenteInfractor.Text, Context.User.Identity.GetUserId(), Convert.ToInt32(ddlTipoReclamo.SelectedValue), txtDetalle.Text.Trim());

                    BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "ALTA", "Reclamo");

                    /*string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
                     * string filePath = Server.MapPath("~/Uploads/") + fileName;
                     * FileUpload1.SaveAs(filePath);
                     */
                    string fileName   = Path.GetFileName(FileUpload1.PostedFile.FileName);
                    string pathImagen = Server.MapPath("~/Uploads/") + "Reclamo" + idReclamo + "_" + fileName;
                    FileUpload1.SaveAs(pathImagen);

                    BIZReclamo.Update(idReclamo, pathImagen);

                    //BIZPlaza.Insert(idEstacionamiento, Context.User.Identity.GetUserId(), Convert.ToInt32(ddlTipoAlquiler.SelectedValue), true);
                }


                txtIdReclamo.Text        = "";
                txtPatenteInfractor.Text = "";


                txtIdReclamo.Visible = true;
                lblIdReclamo.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");
            }
        }
Beispiel #2
0
        private void cargarBitacora()
        {
            try
            {
                if (Context.User.IsInRole("Administrador"))
                {
                    gvReservasPendientes.DataSource = BIZBitacora.Select(DateTime.Now, DateTime.Now, null, 0);
                    gvReservasPendientes.DataBind();
                }


                CultureInfo us = new CultureInfo("es-ES");
                if (gvReservasPendientes.Rows.Count > 0)
                {
                    //Attribute to show the Plus Minus Button.
                    gvReservasPendientes.HeaderRow.Cells[0].Attributes["data-class"] = "expand";

                    //Attribute to hide column in Phone.
                    gvReservasPendientes.HeaderRow.Cells[1].Attributes["data-hide"] = "phone";

                    //Adds THEAD and TBODY to GridView.
                    gvReservasPendientes.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
            }
            catch (Exception ex)
            {
                string err = ex.Message;

                Response.Redirect("ErrorPage.aspx");
            }
        }
Beispiel #3
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            try
            {
                decimal saldoTotal = Convert.ToDecimal(txtSaldoHoy.Text) - Convert.ToDecimal(txtSaldoNuevo.Text);
                if (ddlUsuarios.Visible)
                {
                    BIZCuentaCorriente.Insert(ddlUsuarios.SelectedValue, Convert.ToInt32(txtSaldoHoy.Text), Utils.GetDateTimeLocal());
                    BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "ALTA", "Cuenta Corriente");
                }
                else
                {
                    BIZCuentaCorriente.UpdateSaldo(Convert.ToInt32(txtNroCuenta.Text), saldoTotal);
                    BIZOperacionesCtaCte.Insert(Convert.ToInt32(txtNroCuenta.Text), saldoTotal, Utils.GetDateTimeLocal(), "Actualización Saldo", "ACTUALIZACIÓN");
                    BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "MODIFICACIÓN", "Cuenta Corriente");
                }
                txtNroCuenta.Text  = "";
                txtSaldoHoy.Text   = "";
                txtSaldoNuevo.Text = "";
                txtTitular.Text    = "";
                pnlTab2.Visible    = false;
                pnlTab1.Visible    = true;

                cargarDatosCC();
            }
            catch (Exception)
            {
                Response.Redirect("~/ErrorPage.aspx");
            }
        }
        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");
            }
        }
Beispiel #5
0
        protected void btnVerMovCC_Click(object sender, EventArgs e)
        {
            BIZReserva.ReservaUpdateCerrado(Context.User.Identity.GetUserId());
            DataSet dsCuentaCorriente = BIZCuentaCorriente.Select(Context.User.Identity.GetUserId());

            int nroCuenta = Convert.ToInt32(dsCuentaCorriente.Tables[0].Rows[0]["nroCuenta"]);

            BIZCuentaCorriente.UpdateSaldo(nroCuenta, SaldoTotal * (-1));

            BIZOperacionesCtaCte.Insert(nroCuenta, SaldoTotal, Utils.GetDateTimeLocal(), "Acreditación en Cuenta Corriente", "CRÉDITO");

            BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "MODIFICACIÓN", "Acreditación en Cuenta Corriente");
            cargarGrillaCC();
        }
Beispiel #6
0
        protected void btnFiltrar_Click(object sender, EventArgs e)
        {
            lblErrorFiltro.Text = string.Empty;
            DateTime fechaDesde;
            DateTime fechaHasta;

            if (ValidacionFechas(out fechaDesde, out fechaHasta))
            {
                DateTime?fechaDesdeFiltro = fechaDesde != DateTime.MinValue ? fechaDesde : (DateTime?)null;
                DateTime?fechaHastaFiltro = fechaHasta != DateTime.MinValue ? fechaHasta : (DateTime?)null;

                string usuario = string.IsNullOrEmpty(ddlMail.SelectedValue) ? null : ddlMail.SelectedValue;
                int    perfil  = int.Parse(ddlPerfil.SelectedValue);
                gvReservasPendientes.DataSource = BIZBitacora.Select(fechaDesdeFiltro.Value, fechaHastaFiltro.Value, usuario, perfil);
                gvReservasPendientes.DataBind();
            }
        }
Beispiel #7
0
 protected void btnConfirmarVehiculo_Click(object sender, EventArgs e)
 {
     try
     {
         BIZVehiculo.Update(int.Parse(txtIdVehiculo.Text), User.Identity.GetUserId(), txtMarca.Text, txtModelo.Text, txtPatente.Text);
         BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "MODIFICACIÓN", "Vehículo");
         txtNumeroDocumento.Text = "";
         txtEmail.Text           = "";
         txtNroTelefono.Text     = "";
         txtAliasEmp.Text        = "";
         pnlTab2.Visible         = false;
         pnlTab3.Visible         = true;
         pnlTab1.Visible         = true;
         pnlVehiculo.Visible     = false;
         cargarDatos();
     }
     catch (Exception ex)
     {
         Response.Redirect("ErrorDB.aspx");
     }
 }
Beispiel #8
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());
                }
            }
        }
Beispiel #9
0
 protected void btnConfirmar_Click(object sender, EventArgs e)
 {
     try
     {
         BIZDatosPersonales.Update(User.Identity.GetUserId(), ddlTipoDocumento.SelectedValue, txtNumeroDocumento.Text, txtEmail.Text, txtNroTelefono.Text, ddltipotelefono.SelectedValue, string.Empty, txtNombre.Text, txtApellido.Text, string.Empty, string.Empty);
         BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "MODIFICACIÓN", "Datos Personales");
         txtNumeroDocumento.Text = "";
         txtEmail.Text           = "";
         txtNroTelefono.Text     = "";
         txtAliasEmp.Text        = "";
         txtApellido.Text        = string.Empty;
         txtNombre.Text          = string.Empty;
         pnlTab2.Visible         = false;
         pnlTab3.Visible         = true;
         pnlTab1.Visible         = true;
         pnlVehiculo.Visible     = false;
         cargarDatos();
     }
     catch (Exception ex)
     {
         Response.Redirect("ErrorDB.aspx");
     }
 }
Beispiel #10
0
        protected void gvReclamo_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Rechazar")
            {
                int idReclamo = int.Parse(e.CommandArgument.ToString().Split(',')[0]);
                int idReserva = int.Parse(e.CommandArgument.ToString().Split(',')[1]);
                BIZReclamo.UpdateStatus(idReclamo, 3);
                BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "RECHAZO", "Reclamo");
                if (Context.User.IsInRole("Administrador"))
                {
                    gvReclamo.DataSource = BIZReclamo.SelectAll();
                }
                else
                {
                    gvReclamo.DataSource = BIZReclamo.SelectByIdUser(Context.User.Identity.GetUserId());
                    gvReclamo.Columns[gvReclamo.Columns.Count - 1].Visible = false;
                    gvReclamo.Columns[gvReclamo.Columns.Count - 2].Visible = false;
                    gvReclamo.Columns[2].Visible = false;
                }

                gvReclamo.DataBind();
            }
            else if (e.CommandName == "Pagar")
            {
                int     idReclamo = int.Parse(e.CommandArgument.ToString().Split(',')[0]);
                int     idReserva = int.Parse(e.CommandArgument.ToString().Split(',')[1]);
                DataSet dsReserva = BIZReserva.MisReservasSelectByIdReserva(idReserva);

                DataSet dsCC      = BIZCuentaCorriente.Select(User.Identity.GetUserId());
                String  nroCuenta = dsCC.Tables[0].Rows[0]["nroCuenta"].ToString();
                String  importe   = dsReserva.Tables[0].Rows[0]["tarifa"].ToString();
                BIZCuentaCorriente.UpdateSaldo(Convert.ToInt32(nroCuenta), Convert.ToDecimal(importe) * (-1));
                BIZReclamo.UpdateStatus(idReclamo, 2);
                BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "CONFIRMACION", "Reclamo");
                if (Context.User.IsInRole("Administrador"))
                {
                    gvReclamo.DataSource = BIZReclamo.SelectAll();
                }
                else
                {
                    gvReclamo.DataSource = BIZReclamo.SelectByIdUser(Context.User.Identity.GetUserId());
                    gvReclamo.Columns[gvReclamo.Columns.Count - 1].Visible = false;
                    gvReclamo.Columns[gvReclamo.Columns.Count - 2].Visible = false;
                }
                gvReclamo.DataBind();
            }
            else if (e.CommandName == "Descargar")
            {
                string filePath = e.CommandArgument.ToString();

                /*Response.ContentType = ContentType;
                 * Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath));
                 * Response.TransmitFile(filePath);
                 * Response.End();*/

                /*byte[] Content = File.ReadAllBytes(filePath); //missing ;
                 * Response.Clear();
                 *
                 * Response.AddHeader("content-disposition", "attachment; filename=" + Path.GetFileName(filePath));
                 * Response.ContentType = "application/octet-stream";
                 * Response.WriteFile(filePath);
                 * Response.End();*/


                FileInfo ObjArchivo = new System.IO.FileInfo(filePath);
                Response.Clear();
                Response.AddHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath));
                Response.AddHeader("Content-Length", ObjArchivo.Length.ToString());
                Response.ContentType = "application/octet-stream";
                Response.WriteFile(ObjArchivo.FullName);
                Response.End();
            }
        }
Beispiel #11
0
 protected void Unnamed_LoggingOut(object sender, LoginCancelEventArgs e)
 {
     BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "FIN SESIÓN", "Logout");
     Context.GetOwinContext().Authentication.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
 }
Beispiel #12
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";
            }
        }
Beispiel #13
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");
            }
        }
        protected void UploadArchivo(object sender, EventArgs e)
        {
            string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
            string filePath = Server.MapPath("~/Uploads/") + fileName;

            FileUpload1.SaveAs(filePath);
            string xml = File.ReadAllText(filePath);

            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(';');

                        if (values.Length == 11 || values.Length == 8)
                        {
                            if ((values[7] == "2" || values[7] == "4") && values.Length != 11)
                            {
                                txtResultado.Text += "Se produjo error al procesar el registro Nº " + registro + ": Si el usuario es Conductor debe indicar datos del vehículo.\n";
                            }
                            else
                            {
                                var manager       = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
                                var signInManager = Context.GetOwinContext().Get <ApplicationSignInManager>();
                                var user          = new ApplicationUser()
                                {
                                    UserName = values[0], Email = values[0]
                                };
                                IdentityResult result = manager.Create(user, "Dni" + "-" + values[2]);
                                if (result.Succeeded)
                                {
                                    //inserto el ROL para el usuario
                                    BIZAspNetUserRoles.Insert(user.Id, values[7]);

                                    //agregado para crear cuenta corriente cuando se registra
                                    BIZCuentaCorriente.Insert(user.Id, 100, Utils.GetDateTimeLocal());

                                    BIZDatosPersonales.Insert(user.Id, values[1], values[2], values[0], values[5], string.Empty, string.Empty, values[4], values[3], values[6], string.Empty);
                                    if (values[7] == "2" || values[7] == "4")
                                    {
                                        BIZVehiculo.Insert(user.Id, values[8], values[9], values[10]);
                                    }

                                    BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "ALTA", "Carga Masiva Usuarios");

                                    //envio mail
                                    Send_Account_Activation_Link(values[0], user.Id, values[2]);

                                    txtResultado.Text += "Registro Nº " + registro + " OK\n";
                                }
                                else
                                {
                                    txtResultado.Text += "Se produjo error al procesar el registro Nº " + registro + " " + result.Errors.First() + "\n";
                                }
                            }
                        }
                        else
                        {
                            txtResultado.Text += "Se produjo error al procesar el registro Nº " + registro + ": La cantidad de campos no es correcta.\n";
                        }
                    }
                    catch (Exception ex)
                    {
                        txtResultado.Text += "Se produjo error al procesar el registro Nº " + registro + " " + ex.Message + ".\n";
                    }
                }
            }
        }
Beispiel #15
0
 protected void btnAjustarHora_Click(object sender, EventArgs e)
 {
     BIZReserva.ReservaUpdateFinalizado(Convert.ToDateTime(txtFecha.Text), txtHoraDesde.Text);
     BIZBitacora.Insert(Utils.GetDateTimeLocal(), Context.User.Identity.GetUserId(), "MODIFICACIÓN", "Liberación Plazas");
     ((SiteMaster)this.Master).ShowMessage("<strong>Se ajustó la fecha correctamente</strong>", SiteMaster.WarningType.Success);
 }