Ejemplo n.º 1
0
 private void AltaDatosPersonales(string id, string email)
 {
     try
     {
         BIZDatosPersonales.Insert(id, "DNI", "00000000", email, "9999999999", "MOVIL", "Nombre Apellido", string.Empty, string.Empty, string.Empty, string.Empty);
         BIZVehiculo.Insert(id, "MARCA", "MODELO", "XXX XXX");
     }
     catch (Exception)
     {
         return;
     }
 }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (HttpContext.Current.User.Identity.IsAuthenticated == true)
     {
         //BIZReserva.ReservaUpdateFinalizado(DateTime.Today, DateTime.Today.Hour.ToString().PadLeft(2, '0'));
         //cargarReservas();
         cargarBitacora();
     }
     else
     {
         Response.Redirect("~/Account/Login.aspx");
     }
     if (!IsPostBack)
     {
         ddlMail.DataSource = BIZDatosPersonales.SelectAll();
         ddlMail.DataBind();
         ddlMail.Items.Insert(0, new ListItem(String.Empty, String.Empty));
         ddlMail.SelectedIndex = 0;
     }
 }
Ejemplo n.º 3
0
        private void cargarZonas()
        {
            try
            {
                CultureInfo us = new CultureInfo("es-ES");
                gvUsuario.DataSource = BIZDatosPersonales.SelectAll();
                gvUsuario.DataBind();

                //Attribute to show the Plus Minus Button.
                gvUsuario.HeaderRow.Cells[0].Attributes["data-class"] = "expand";

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

                //Adds THEAD and TBODY to GridView.
                gvUsuario.HeaderRow.TableSection = TableRowSection.TableHeader;
            }
            catch (Exception)
            {
                Response.Redirect("ErrorDB.aspx");
            }
        }
Ejemplo n.º 4
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");
     }
 }
Ejemplo n.º 5
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");
            }
        }
Ejemplo n.º 6
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";
                    }
                }
            }
        }