protected void btnModificar_Click(object sender, EventArgs e)
        {
            string  tel           = tTelefono.Text;
            string  contr         = tclave.Text;
            string  contra2       = tclave2.Text;
            string  cedula        = tcedula.Text;
            string  correo        = tcorreo.Text;
            Usuario usuarioSesion = Session["usuarioSesion"] as Usuario;
            Cliente clien         = new ManejadorCliente().buscarCliente(usuarioSesion.cedula);
            string  observaciones = clien.Observacion;
            string  telefono      = tTelefono.Text;

            //valida espacios vacio
            if (tel != "" || contr != "" || contra2 != "")
            {
                //valida que las contraseñas coincidan
                if (contr.Equals(contra2))
                {
                    maneja.modificarCliente(cedula, correo, observaciones, Int32.Parse(telefono), contr);
                    ClientScript.RegisterStartupScript(GetType(), "invocarfuncion", "mensaje();", true);
                    //Response.Write("<script>alert('Su perfil ha sido modificado')</script>");
                }
                else
                {
                    ValidadorClaves.Visible = true;
                    //Response.Write("<script>alert('Las contraseñas deben coincidir')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Se debe completar los espacios')</script>");
            }
        }
Beispiel #2
0
        public void informacionCliente()
        {
            Usuario usuarioSesion = Session["usuarioSesion"] as Usuario;
            Cliente clien         = new ManejadorCliente().buscarCliente(usuarioSesion.cedula);
            Medida  medida        = new ManejadorMedida().buscarMedidaCliente(usuarioSesion.cedula);

            lista = new ManejadorMedida().listaMedidas(usuarioSesion.cedula);

            try
            {
                if (clien != null)
                {
                    lbNacim.Text = clien.Fecha_Nacimiento.ToString();
                    lbTel.Text   = clien.Telefono.ToString();
                    lbObs.Text   = clien.Observacion;
                    lbMens.Text  = clien.Fecha_Mensualidad.ToString();
                }
                else
                {
                }

                tablaExped.Text = "<tr><th>Frecuencia cardiaca</th><th>Peso</th><th>Porcentaje de grasa</th><th>IMC</th><th>Cintura</th><th>Abdomen</th><th>Cadera</th><th>Muslo</th><th>Estatura</th><th>Fecha</th><th>Mensualidad</th></tr>";
                foreach (Medida med in lista)
                {
                    string tabla = tablaExped.Text;
                    tabla          += "<tr><td>" + med.Frec_Cardiaca + "</td><td>" + med.Peso + "</td><td>" + med.Porcent_Grasa + "</td><td>" + med.IMC + "</td><td>" + med.Cintura + "</td><td>" + med.Abdomen + "</td><td>" + med.Cadera + "</td><td>" + med.Muslo + "</td><td>" + med.Estatura + "</td><td>" + med.Fecha_Medida + "</td><td>" + mostrarMes(med.Fecha_Medida.Month) + "</td></tr>";
                    tablaExped.Text = tabla;
                }
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// Inserta la información de un cliente
        /// </summary>
        /// <param name="cliente"></param>
        /// <returns></returns>
        public bool InsertarCliente(ref Cliente cliente)
        {
            bool retorno = false;

            using (SqlConnection connection = new SqlConnection(CONNECTIONSTRING))
            {
                connection.Open();
                SqlCommand     command = connection.CreateCommand();
                SqlTransaction transaction;
                transaction         = connection.BeginTransaction();
                command.Connection  = connection;
                command.Transaction = transaction;
                try
                {
                    ManejadorCliente clientedb = new ManejadorCliente(connection, transaction);
                    clientedb.Cliente = cliente;
                    if (clientedb.Insertar())
                    {
                        cliente.IdCliente = int.Parse(clientedb.Identity.ToString());
                        transaction.Commit();
                        retorno = true;
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
            }
            return(retorno);
        }
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            DateTime fecha_nac;
            String   correo = txbcorreo.Text;
            String   obs    = txbobs.Text;


            if (!btnModificar.Text.Equals("Actualizar"))        // SE VA A REGISTRAR UN CLIENTE sin crearle la cuenta
            {
                if (camposVacios())
                {
                    fecha_nac = new DateTime(int.Parse(DLAnno.SelectedValue), int.Parse(DlMes.SelectedValue), int.Parse(DlDia.SelectedItem.Text));
                    crearRegistroCliente();

                    cliente_creado = new ManejadorCliente().registrarClienteBL(cliente);
                    if (cliente_creado)
                    {
                        ClientScript.RegisterStartupScript(GetType(), "invocarfuncion", "mensaje();", true);
                        //mostrarAlerta("Cliente registrado correctamente", true);
                    }
                    else
                    {
                        mostrarAlerta("Error en registro de cliente", false);
                    }
                }
                else
                {
                    mostrarAlerta("*Error: Campos incompletos", false);
                }
            }
            else // SE VA A MODIFICAR UN CLIENTE
            {
                if (!txbobs.Equals("") && !txbtelefono.Equals("")) // VALIDAR QUE NO DEJE EN BLANCO
                {
                    String observaciones = (String)Session["obs"];
                    int    tel           = int.Parse((String)Session["telefono"]);
                    String clave         = (String)Session["clave"];
                    // prevalece     prevalece        sesion        sesion sesion
                    Boolean modificado = new ManejadorCliente().modificarCliente(cliente.Cedula, cliente.Correo, observaciones, tel, clave);
                    if (modificado)
                    {
                        Response.Redirect("ListaClientesAdmin.aspx?con=true");
                    }

                    else
                    {
                        mostrarAlerta("*Error (404): Elemento no encontrado.", false);
                    }
                }
                else
                {
                    mostrarAlerta("*Error: Campos incorrectos (Telefono, Observaciones)", false);
                }
            }

            //ingresoDIV.Visible = false;
            //habilitarCampos();
            limpiarCampos();
        }
 public UserControlVenta()
 {
     InitializeComponent();
     clienteManager  = new ManejadorCliente();
     productoManager = new ManejadorProducto();
     ventaManager    = new ManejadorVentas();
     LimpiarTodo();
     ActualizarTablaProductos();
 }
        public void informacionCliente()
        {
            Usuario usuarioSesion = Session["usuarioSesion"] as Usuario;
            Cliente clien         = new ManejadorCliente().buscarCliente(usuarioSesion.cedula);

            try
            {
                if (clien != null)
                {
                    tfehcaN.Text = clien.Fecha_Nacimiento.Day + "/" + clien.Fecha_Nacimiento.Month + "/" + clien.Fecha_Nacimiento.Year;
                }
                else
                {
                }
            }
            catch (Exception)
            {
            }
        }
        private void cargarClientes()
        {
            List <Cliente> lista = new ManejadorCliente().listaClientes();

            TableRow encabezado = new TableRow();

            encabezado.CssClass = "encabezadoTablaAsistencia";
            TableCell cedula = new TableCell();

            cedula.Text     = "CEDULA";
            cedula.CssClass = "cell";
            encabezado.Cells.Add(cedula);
            TableCell nombre = new TableCell();

            nombre.Text     = "NOMBRE";
            nombre.CssClass = "cell";
            encabezado.Cells.Add(nombre);
            TableCell apellidoS = new TableCell();

            apellidoS.Text     = "APELLIDOS";
            apellidoS.CssClass = "cell";
            encabezado.Cells.Add(apellidoS);
            TableCell control = new TableCell();

            control.Text     = "ASISTENCIA";
            control.CssClass = "cell2";
            encabezado.Cells.Add(control);
            TablaClientes.Rows.Add(encabezado);


            foreach (Cliente c in lista)
            {
                TableRow fila = new TableRow();
                fila.CssClass   = "filaTablaAsistencia";
                cedula          = new TableCell();
                cedula.CssClass = "cell";
                cedula.Text     = c.Cedula;
                fila.Cells.Add(cedula);
                nombre          = new TableCell();
                nombre.CssClass = "cell";
                nombre.Text     = c.Nombre;
                fila.Cells.Add(nombre);
                apellidoS          = new TableCell();
                apellidoS.CssClass = "cell";
                apellidoS.Text     = c.Apellido1 + " " + c.Apellido2;
                fila.Cells.Add(apellidoS);
                control          = new TableCell();
                control.CssClass = "cell2";
                Button radio = new Button();
                radio.Text = "Marcar";
                radio.ID   = "rad." + c.Cedula;

                radio.Click   += delegate { marcarAsistencia(c.Cedula); };
                radio.CssClass = "btn-primary small ";
                control.Controls.Add(radio);
                fila.Cells.Add(control);

                TablaClientes.Rows.Add(fila);
            }
            TablaClientes.DataBind();
        }
Beispiel #8
0
        private void cargarListaClientes()
        {
            List <Cliente> lista = new ManejadorCliente().listaClientes();

            TableRow encabezado = new TableRow();

            encabezado.CssClass = "encabezado";

            encabezado.CssClass = "encabezadoTablaAsistencia";
            TableCell cedula = new TableCell();

            cedula.Text = "CEDULA";

            cedula.CssClass = "cell";
            encabezado.Cells.Add(cedula);
            TableCell nombre = new TableCell();

            nombre.Text     = "NOMBRE";
            nombre.CssClass = "cell";
            encabezado.Cells.Add(nombre);
            TableCell apellidoS = new TableCell();

            apellidoS.Text     = "APELLIDOS";
            apellidoS.CssClass = "cell";
            encabezado.Cells.Add(apellidoS);

            TableCell controlMOd = new TableCell();

            controlMOd.Text     = "";
            controlMOd.CssClass = "cell";
            encabezado.Cells.Add(controlMOd);
            TableCell controlEli = new TableCell();

            controlEli.Text     = "";
            controlEli.CssClass = "cell";
            encabezado.Cells.Add(controlEli);

            tablaClientes.Rows.Add(encabezado);
            tablaClientes.Rows.Add(encabezado);


            foreach (Cliente c in lista)
            {
                TableRow fila = new TableRow();
                fila.CssClass   = "filaTablaAsistencia";
                cedula          = new TableCell();
                cedula.CssClass = "cell";
                cedula.Text     = c.Cedula;
                fila.Cells.Add(cedula);
                nombre          = new TableCell();
                nombre.CssClass = "cell";
                nombre.Text     = c.Nombre;
                fila.Cells.Add(nombre);
                apellidoS          = new TableCell();
                apellidoS.CssClass = "cell";
                apellidoS.Text     = c.Apellido1 + " " + c.Apellido2;
                fila.Cells.Add(apellidoS);
                controlMOd          = new TableCell();
                controlMOd.CssClass = "cell";
                //Button btn = new Button();
                //btn.Text = "Agregar";
                //btn.CssClass = "radio small";
                //btn.ID = c.Cedula;
                //btn.Click+= delegate { agregarElemento(btn.ID); }; //linea sayayin
                //control.Controls.Add(btn);

                Button btnMod = new Button();
                btnMod.Text     = "Modificar";
                btnMod.CssClass = "small";
                btnMod.ID       = "mod." + c.Cedula;
                //btnMod.BackColor = System.Drawing.Color.LightYellow;
                //btnMod.Width;
                //btnMod.Attributes.Add("onClick", "salvarID("+ c.Cedula +")");
                btnMod.Click += delegate { modCliente(btnMod.ID); }; //linea sayayin

                fila.Cells.Add(controlMOd);

                controlEli          = new TableCell();
                controlEli.CssClass = "cell";
                Button btnEli = new Button();
                btnEli.Text      = "Eliminar";
                btnEli.CssClass  = "small";
                btnEli.ID        = c.Cedula + ";" + c.Correo;
                btnEli.BackColor = System.Drawing.Color.LightPink;

                btnEli.Click += delegate { eliminar(btnEli.ID); }; //linea sayayin
                //btnEli.Attributes.Add("onClick", "salvarID(" + c.Cedula + ")");
                controlMOd.Controls.Add(btnMod);
                controlMOd.Controls.Add(btnEli);//cambiar si falla
                fila.Cells.Add(controlEli);

                tablaClientes.Rows.Add(fila);
            }
            tablaClientes.DataBind();
        }
 public UserControlAdminClientes()
 {
     InitializeComponent();
     clienteManager = new ManejadorCliente();
     LimpiarTodo();
 }