示例#1
0
        private void cargarGrillaCC()
        {
            try
            {
                gv_DatosCC.DataSource = BIZCuentaCorriente.Select(User.Identity.GetUserId());
                gv_DatosCC.DataBind();

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

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

                    //Adds THEAD and TBODY to GridView.
                    gv_DatosCC.HeaderRow.TableSection = TableRowSection.TableHeader;

                    pnlTabcc.Visible = true;
                }
                else
                {
                    pnlTabcc.Visible = false;
                }
            }
            catch (Exception)
            {
                Response.Redirect("ErrorDB.aspx");
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    DataSet dataset = BIZCuentaCorriente.Select(User.Identity.GetUserId());

                    if (dataset != null && dataset.Tables.Count > 0 &&
                        dataset.Tables[0].Rows.Count > 0)
                    {
                        SaldoCuentaCorriente = decimal.Parse(dataset.Tables[0].Rows[0].ItemArray[1].ToString());
                        lblCCNro.Text        = dataset.Tables[0].Rows[0].ItemArray[0].ToString();
                        lblTotalSaldo.Text   = dataset.Tables[0].Rows[0].ItemArray[1].ToString();

                        /*if (SaldoCuentaCorriente > 180)
                         * {
                         *  ddlFormaPago.Items.Add(new ListItem("Cuenta Corriente", "ddlCC"));
                         *
                         *  lblCCNro.Text = dataset.Tables[0].Rows[0].ItemArray[0].ToString();
                         *  lblTotalSaldo.Text = dataset.Tables[0].Rows[0].ItemArray[1].ToString();
                         * }*/
                    }

                    lblAvisoPago2.Text = Session["Importe_Reserva"].ToString();
                    ImporteCompra      = decimal.Parse(lblAvisoPago2.Text);
                }
                catch (Exception)
                {
                }
            }
        }
示例#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");
            }
        }
示例#4
0
 private void AltaCuentaCorriente(string id)
 {
     try
     {
         BIZCuentaCorriente.Insert(id, 100, Utils.GetDateTimeLocal());
     }
     catch (Exception)
     {
         return;
     }
 }
示例#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();
        }
示例#6
0
        private void cargarDatosCC()
        {
            try
            {
                ddlUsuarios.DataSource     = BIZCuentaCorriente.SelectUsersSinCtaCte();
                ddlUsuarios.DataTextField  = "UserName";
                ddlUsuarios.DataValueField = "id";
                ddlUsuarios.DataBind();


                if (Context.User.IsInRole("Administrador"))
                {
                    gvCC.DataSource = BIZCuentaCorriente.SelectAll();
                }
                else
                {
                    gvCC.DataSource = BIZCuentaCorriente.Select(User.Identity.GetUserId());
                }

                gvCC.DataBind();

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

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

                    //Adds THEAD and TBODY to GridView.
                    gvCC.HeaderRow.TableSection = TableRowSection.TableHeader;
                }
            }
            catch (Exception)
            {
                Response.Redirect("~/ErrorPage.aspx");
            }
        }
示例#7
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();
            }
        }
示例#8
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            lblErrorMensaje.Visible = false;
            try
            {
                bool pagoReserva = false;
                if (ddlFormaPago.SelectedValue == "0")
                {
                    string message = "Debe seleccionar una forma de pago.";
                    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true);

                    lblErrorMensaje.Text    = message;
                    lblErrorMensaje.Visible = true;
                    panelTC.Visible         = false;
                    panelCC.Visible         = false;
                }
                else
                {
                    if (ddlFormaPago.SelectedValue == "ddlTC")
                    {
                        btnConfirmar.ValidationGroup = "ValTarjetaCredito";
                        //consumir servicio
                        if (TarjetaValida())
                        {
                            BIZOperacionesTC.Insert(txtNroTarjeta.Text, Convert.ToDateTime("01/" + txtMes.Text + "/" + txtAnio.Text), Convert.ToInt32(txtCodSeg.Text), Convert.ToInt32(Session["Nro_Reserva"].ToString()), DateTime.Now, "", User.Identity.GetUserId());
                            pagoReserva = true;
                        }
                        else
                        {
                            string message = "Verifique los datos de la tarjeta ingresada";
                            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true);
                            lblErrorMensaje.Text    = message;
                            lblErrorMensaje.Visible = true;
                        }
                    }
                    else
                    {
                        btnConfirmar.ValidationGroup = "ValCuentaCorriente";
                        try
                        {
                            if (Convert.ToDecimal(Session["Importe_Reserva"].ToString()) < SaldoCuentaCorriente)
                            {
                                BIZCuentaCorriente.UpdateSaldo(Convert.ToInt32(lblCCNro.Text), Convert.ToDecimal(Session["Importe_Reserva"].ToString()));
                                BIZOperacionesCtaCte.Insert(Convert.ToInt32(lblCCNro.Text), Convert.ToDecimal(Session["Importe_Reserva"].ToString()), Utils.GetDateTimeLocal(), "Pago de la reserva Nro: " + Session["Nro_Reserva"].ToString(), "DEBITO");
                                pagoReserva = true;
                            }
                            else
                            {
                                //string message = "El saldo de su cuenta no es suficiente para pagar la reserva.";
                                //ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true);

                                lblSaldoInsuficiente.Visible = true;
                            }
                        }
                        catch (Exception ex)
                        {
                            lblPyEconfirmado.Text = ex.Message;
                        }
                    }
                }
                if (pagoReserva)
                {
                    //BIZReserva.PlazaUpdateStatePayment(Convert.ToInt32(Session["Nro_Reserva"].ToString()), true);
                    BIZReserva.ReservaUpdateStatePayment(Convert.ToInt32(Session["Nro_Reserva"].ToString()), Utils.GetDateTimeLocal(), true);
                    panelTotal.Visible       = false;
                    lblPyEconfirmado.Visible = true;
                    btnContinuar.Visible     = true;
                    btnMisReservas.Visible   = true;
                    lblErrorMensaje.Visible  = true;
                    lblErrorMensaje.Text     = "Hemos registrado su pago. Le enviaremos el comprabante por email";
                }
            }
            catch (Exception)
            {
                string message = "Se ha producido un error en la operatoria. Volvé a ingresar a Mis Reservas e intentalo nuevamente";
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + message + "');", true);
                Response.Redirect("MisReservas.aspx");
            }
        }
示例#9
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            try
            {
                lblMensaje.Text = string.Empty;

                if (!string.IsNullOrEmpty(txtCuil.Text))
                {
                    bool cuilValido = BIZUtilites.ValidaCuit(txtCuil.Text);
                    if (!cuilValido)
                    {
                        lblMensaje.Text = "Verifique el CUIL";
                        return;
                    }
                }

                if (txtUsuarioId.Text == string.Empty)
                {
                    var manager       = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
                    var signInManager = Context.GetOwinContext().Get <ApplicationSignInManager>();
                    var user          = new ApplicationUser()
                    {
                        UserName = txtMail.Text, Email = txtMail.Text
                    };
                    IdentityResult result = manager.Create(user, "Dni" + "-" + txtNroDocumento.Text);
                    if (result.Succeeded)
                    {
                        //inserto el ROL para el usuario
                        BIZAspNetUserRoles.Insert(user.Id, ddlRol.SelectedValue);

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

                        BIZDatosPersonales.Insert(user.Id, ddlTipoDocumento.SelectedValue, txtNroDocumento.Text, txtMail.Text, txtTelefono.Text, string.Empty, string.Empty, txtNombre.Text, txtApellido.Text, txtDireccion.Text, txtCuil.Text);
                        BIZVehiculo.Insert(user.Id, txtMarca.Text, txtModelo.Text, txtPatente.Text);

                        //envio mail
                        Send_Account_Activation_Link(txtMail.Text, user.Id);

                        // Para obtener más información sobre cómo habilitar la confirmación de cuentas y el restablecimiento de contraseña, visite http://go.microsoft.com/fwlink/?LinkID=320771
                        //string code = manager.GenerateEmailConfirmationToken(user.Id);
                        //string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Id, Request);
                        //manager.SendEmail(user.Id, "Confirmar cuenta", "Para confirmar la cuenta, haga clic <a href=\"" + callbackUrl + "\">aquí</a>.");

                        //signInManager.SignIn( user, isPersistent: false, rememberBrowser: false);
                    }
                }
                else
                {
                    //actualizo el ROL para el usuario
                    BIZAspNetUserRoles.Update(txtUsuarioId.Text, ddlRol.SelectedValue);

                    BIZDatosPersonales.Update(txtUsuarioId.Text, ddlTipoDocumento.SelectedValue, txtNroDocumento.Text, txtMail.Text, txtTelefono.Text, string.Empty, string.Empty, txtNombre.Text, txtApellido.Text, txtDireccion.Text, txtCuil.Text);
                    if (!string.IsNullOrEmpty(hdIdVehiculo.Value))
                    {
                        BIZVehiculo.Update(Convert.ToDecimal(hdIdVehiculo.Value), txtUsuarioId.Text, txtMarca.Text, txtModelo.Text, txtPatente.Text);
                    }
                }
                txtUsuarioId.Text    = string.Empty;
                txtApellido.Text     = string.Empty;
                txtNombre.Text       = string.Empty;
                ddlRol.SelectedValue = "2";

                txtNroDocumento.Text = string.Empty;
                txtMail.Text         = string.Empty;
                txtTelefono.Text     = string.Empty;
                txtCuil.Text         = string.Empty;
                txtMarca.Text        = string.Empty;
                txtModelo.Text       = string.Empty;
                txtPatente.Text      = string.Empty;

                txtUsuarioId.Visible = true;
                lblUsuarioId.Visible = true;

                pnlTab2.Visible = false;
                pnlTab1.Visible = true;
                //divPrecio.Visible = false;
                lblMensaje.Text = string.Empty;
                cargarZonas();
            }
            catch (Exception)
            {
                Response.Redirect("~/ErrorPage.aspx");
            }
        }
示例#10
0
        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";
                    }
                }
            }
        }