예제 #1
0
        public BE.Cliente BuscarClienteId(int id)
        {
            string sql = $@"SELECT * FROM cliente where id = {id}";

            var reader = _acceso.GetReader(sql);

            if (reader.HasRows)
            {
                BE.Cliente _cliente = new BE.Cliente();
                while (reader.Read())
                {
                    _cliente.Id        = int.Parse(reader["id"].ToString());
                    _cliente.Nombre    = reader["nombre"].ToString();
                    _cliente.Apellido  = reader["apellido"].ToString();
                    _cliente.TipoDoc   = int.Parse(reader["tipo_documento"].ToString());
                    _cliente.NroDoc    = int.Parse(reader["nro_documento"].ToString());
                    _cliente.Domicilio = reader["domicilio"].ToString();
                    _cliente.Email     = reader["email"].ToString();
                    _cliente.Telefono  = reader["telefono"] != DBNull.Value ? int.Parse(reader["telefono"].ToString()) : 0;
                    _cliente.Estado    = bool.Parse(reader["estado"].ToString());
                }
                _acceso.CloseReader(reader);
                return(_cliente);
            }
            else
            {
                _acceso.CloseReader(reader);
                throw new Exception("No se encontro el Cliente");
            }
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public static int Save(BE.Cliente o)
        {
            var id = Helper.DB.Execute("DB", "ClienteSave", o);

            Helper.Cache.Clear();
            return(id);
        }
예제 #3
0
        protected void LlenarTabla()
        {
            GridView1.DataSource          = null;
            GridView1.AutoGenerateColumns = false;

            if (usuario.Perfil.Nombre == "CLIENTE")
            {
                BE.Cliente cliente = _gestorCliente.leer_cliente_CUIT(usuario.idUsuario.ToString());
                GridView1.DataSource = _gestorConsumidor.leer_Consumidor(cliente.idCliente);
            }
            else
            {
                if (usuario.Perfil.Nombre == "CONSUMIDOR")
                {
                    BE.Consumidor        consumidor      = _gestorConsumidor.leer_Consumidor_DNI(usuario.idUsuario.ToString());
                    List <BE.Consumidor> listaConsumidor = new List <BE.Consumidor>();
                    listaConsumidor.Add(consumidor);
                    GridView1.DataSource = listaConsumidor;
                }

                else
                {
                    GridView1.DataSource = _gestorConsumidor.leer_Consumidor();
                }
            }
            GridView1.DataBind();
        }
예제 #4
0
        public List <BE.Cliente> ListarClientes()
        {
            string            query = "SELECT * FROM Cliente;";
            List <BE.Cliente> lista = new List <BE.Cliente>();
            var reader = _acceso.GetReader(query);

            while (reader.Read())
            {
                BE.Cliente cliente = new BE.Cliente();
                cliente.Id        = int.Parse(reader["id"].ToString());
                cliente.Nombre    = reader["nombre"].ToString();
                cliente.Apellido  = reader["apellido"].ToString();
                cliente.TipoDoc   = int.Parse(reader["tipo_documento"].ToString());
                cliente.NroDoc    = int.Parse(reader["nro_documento"].ToString());
                cliente.Domicilio = reader["domicilio"].ToString();
                cliente.Email     = reader["email"].ToString();
                cliente.Telefono  = reader["telefono"] != DBNull.Value ? int.Parse(reader["telefono"].ToString()) : 0;
                cliente.Estado    = bool.Parse(reader["estado"].ToString());

                lista.Add(cliente);
            }
            _acceso.CloseReader(reader);

            return(lista);
        }
예제 #5
0
        protected void LlenarTabla()
        {
            GridView1.DataSource          = null;
            GridView1.AutoGenerateColumns = false;
            BE.Usuario usuario = SesionActualWindows.SesionActual().ObtenerUsuarioActual();
            if (usuario.Perfil.Nombre == "CLIENTE")
            {
                BE.Cliente cliente = _gestorCliente.leer_cliente_CUIT(usuario.idUsuario.ToString());
                GridView1.DataSource = _gestorUsuario.leer_usuario_Empresa(cliente.idCliente.ToString());
            }
            else
            {
                if (usuario.Perfil.Nombre == "ADM MASTER")
                {
                    List <BE.Usuario> listaUsuario = new List <BE.Usuario>();
                    listaUsuario.Add(_gestorUsuario.leer_usuario("admin"));

                    GridView1.DataSource = listaUsuario;
                }
                else
                {
                    GridView1.DataSource = _gestorUsuario.leer_usuario();
                }
            }
            GridView1.DataBind();
        }
예제 #6
0
        private void Form_Closed(object sender, FormClosedEventArgs e)
        {
            BuscarCliente formBuscarCliente = (BuscarCliente)sender;

            if (formBuscarCliente.cliente != null)
            {
                cliente          = formBuscarCliente.cliente;
                txtNombre.Text   = cliente.Nombre;
                txtApellido.Text = cliente.Apellido;
                this.Show();
                try
                {
                    _vehiculo            = _vehiculoStockBll.BuscarVehiculoOfrecido(cliente);
                    txtPatente.Text      = BLL.Cifrado.Desencriptar(_vehiculo.Patente);
                    txtTipoVehiculo.Text = _vehiculo.TipoVehiculo.ToString();
                    txtMarca.Text        = _vehiculo.Marca;
                    txtModelo.Text       = _vehiculo.Modelo;
                    txtVersion.Text      = _vehiculo.Version;
                    txtKilometraje.Text  = _vehiculo.Kilometraje.ToString();
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                return;
            }
        }
예제 #7
0
        protected void LlenarListas()
        {
            DataTable DTconsumidores = new DataTable();

            BE.Usuario usuario = SesionActualWindows.SesionActual().ObtenerUsuarioActual();
            if (usuario.Perfil.Nombre == "CLIENTE")
            {
                BE.Cliente        cliente      = _gestorCliente.leer_cliente_CUIT(usuario.idUsuario.ToString());
                List <BE.Cliente> listaCliente = new List <BE.Cliente>();
                listaCliente.Add(_gestorCliente.leer_cliente(cliente.idCliente.ToString()));
                lstCliente.DataSource = listaCliente;
                DTconsumidores        = ToDataTable(_gestorConsumidor.leer_Consumidor(cliente.idCliente));
            }
            else
            {
                lstCliente.DataSource = _gestorCliente.leer_cliente();
                DTconsumidores        = ToDataTable(_gestorConsumidor.leer_Consumidor());
            }
            lstCliente.DataTextField  = "razonSocial";
            lstCliente.DataValueField = "idCliente";
            lstCliente.DataBind();

            DTconsumidores.Columns.Add("NombreApellido", typeof(string), "Nombre + ' ' + Apellido");

            lstConsumidor.DataSource     = DTconsumidores;
            lstConsumidor.DataTextField  = "NombreApellido";
            lstConsumidor.DataValueField = "idConsumidor";
            lstConsumidor.DataBind();
        }
예제 #8
0
        public void ActualizarCliente(BE.Cliente cliente)
        {
            string sql = $@"update cliente set nombre='{cliente.Nombre}',apellido='{cliente.Apellido}',domicilio='{cliente.Domicilio}',
                         email='{cliente.Email}',tipo_documento={cliente.TipoDoc},nro_documento={cliente.NroDoc},
                         estado={cliente.Estado},telefono= {cliente.Telefono} WHERE id = {cliente.Id}
                         ;";

            _acceso.ExecuteNonQuery(sql);
        }
예제 #9
0
        private void Form_Closed(object sender, FormClosedEventArgs e)
        {
            BuscarCliente formBuscarCliente = (BuscarCliente)sender;

            cliente          = formBuscarCliente.cliente;
            txtNombre.Text   = cliente.Nombre;
            txtApellido.Text = cliente.Apellido;
            this.Show();
        }
예제 #10
0
        public BE.Cliente AltaCliente(BE.Cliente cliente)
        {
            int    estado = (cliente.Estado == true) ? 1 : 0;
            string query  = $@"INSERT INTO cliente (tipo_documento,nro_documento, nombre, apellido, domicilio, email, telefono,estado) 
                           output INSERTED.ID VALUES ({cliente.TipoDoc},{cliente.NroDoc},'{cliente.Nombre}','{cliente.Apellido}','{cliente.Domicilio}',
                           '{cliente.Email}',{cliente.Telefono},{estado});";

            int id = _acceso.ExecuteScalar(query);

            cliente.Id = id;
            return(cliente);
        }
예제 #11
0
 public BE.Cliente AltaCliente(BE.Cliente cliente)
 {
     if (!ExisteCliente(cliente))
     {
         _clienteDal.AltaCliente(cliente);
         return(cliente);
     }
     else
     {
         throw new Exception("El usuario ya existe");
     }
 }
예제 #12
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            int indice        = (int)grillaCliente.CurrentRow.Cells[0].Value;
            var listaFamilias = _clienteBll.ListarClientes();

            BE.Cliente _cliente = listaFamilias.Where(i => i.Id == indice).FirstOrDefault();
            this.Hide();
            ModificarCliente formMCliente = new ModificarCliente(_cliente);

            formMCliente.MdiParent = this.ParentForm;
            formMCliente.Show();
            formMCliente.FormClosed += new FormClosedEventHandler(Form_Closed);
        }
예제 #13
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtRazonSocial.Text) && !String.IsNullOrEmpty(txtDomicilio.Text) && !String.IsNullOrEmpty(txtCP.Text) && !String.IsNullOrEmpty(txtPais.Text) && !String.IsNullOrEmpty(UCMail.Text) && !String.IsNullOrEmpty(txtProvincia.Text))
            {
                if ((UCCuit.BackColor != System.Drawing.Color.Empty) || (UCMail.BackColor != System.Drawing.Color.Empty) || (txtSFI.BackColor != System.Drawing.Color.Empty))
                {
                    lblInfo.Text = Traductor.Mensaje("ERR170", SesionActualWindows.SesionActual().ObtenerUsuarioActual().Cultura.ToString());
                }
                else
                {
                    try
                    {
                        BE.Cliente cliente = new BE.Cliente();
                        cliente.idCliente   = 0;
                        cliente.razonSocial = txtRazonSocial.Text;
                        cliente.domicilio   = txtDomicilio.Text;
                        string cuit = UCCuit.Text;
                        cuit               = cuit.Replace("-", "");
                        cliente.cuit       = cuit;
                        cliente.Email      = UCMail.Text;
                        cliente.localidad  = txtLocalidad.Text;
                        cliente.provincia  = txtProvincia.Text;
                        cliente.pais       = txtPais.Text;
                        cliente.SFI        = Convert.ToInt16(txtSFI.Text);
                        cliente.CP         = txtCP.Text;
                        cliente.fechaAlta  = DateTime.Today;
                        cliente.clienteDVH = "1";

                        _gestorCliente.insertar_cliente(cliente);
                        {
                            LlenarTabla();
                            LimpiarCampos();
                            lblInfo.Text = Traductor.Mensaje("ERR140", SesionActualWindows.SesionActual().ObtenerUsuarioActual().Cultura.ToString());
                            _gestorIntegridadBLL.recalcular_t_Cliente("corregir");
                        }
                    }
                    catch (SeguridadException ex)
                    {
                        lblInfo.Text = Traductor.TraducirMensage(ex.CodigError, ex.Message);
                    }
                    catch (Exception ex)
                    {
                        lblInfo.Text = ex.Message;
                    }
                }
            }
            else
            {
                lblInfo.Text = Traductor.Mensaje("ERR141", SesionActualWindows.SesionActual().ObtenerUsuarioActual().Cultura.ToString());
            }
        }
예제 #14
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            BE.Cliente _cliente = new BE.Cliente();

            if (txtNombre.Text == "" || txtNombre.Text == null || txtApellido.Text == "" || txtApellido.Text == null ||
                txtDomicilio.Text == "" || txtDomicilio.Text == null || txtNroDoc.Text == "" || txtNroDoc.Text == null ||
                txtEmail.Text == "" || txtEmail.Text == null)
            {
                MessageBox.Show("Por favor complete los campos obligatorios");
                return;
            }

            if (String.IsNullOrEmpty(txtEmail.Text) && String.IsNullOrEmpty(txtTelefono.Text))
            {
                MessageBox.Show("Por favor debe introducir un email o un telefono de contacto");
                return;
            }

            _cliente.Nombre   = txtNombre.Text.ToUpper();
            _cliente.Apellido = txtApellido.Text.ToUpper();
            var tDoc = (KeyValuePair <int, string>)cmbTipoDoc.SelectedItem;

            _cliente.TipoDoc   = tDoc.Key;
            _cliente.NroDoc    = long.Parse(txtNroDoc.Text);
            _cliente.Domicilio = txtDomicilio.Text;
            _cliente.Email     = txtEmail.Text;
            _cliente.Estado    = true;
            if (!String.IsNullOrEmpty(txtTelefono.Text))
            {
                _cliente.Telefono = long.Parse(txtTelefono.Text);
            }

            BLL.Cliente _clienteBll = new BLL.Cliente();
            try
            {
                _clienteBll.AltaCliente(_cliente);
                var dialogResult = MessageBox.Show("Se cargo el cliente");
                //this.Hide();
                if (dialogResult == DialogResult.Cancel)
                {
                    this.Close();
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #15
0
 private bool ExisteCliente(BE.Cliente cliente)
 {
     try
     {
         var _cliente = _clienteDal.BuscarCliente(cliente);
         if (_cliente != null)
         {
             return(true);
         }
         return(false);
     }
     catch
     {
         return(false);
     }
 }
예제 #16
0
 private void btn_habilitar_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 1)
     {
         BE.Cliente clienteHabilitar = new BE.Cliente();
         clienteHabilitar.id_cliente = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);
         cliente_BLL.Habilitar(clienteHabilitar);
         ActualizarGrilla();
         MessageBox.Show("Se habilitó el cliente seleccionado");
         //bitacora_BAJA.RegistrarEnBitacora(this.usuario_logueado, DateTime.Now, "Se habilitó un Usuario");
     }
     else
     {
         MessageBox.Show("No se debe seleccionar un registro a habilitar");
     }
 }
예제 #17
0
 protected void LlenarTabla()
 {
     GridView1.DataSource          = null;
     GridView1.AutoGenerateColumns = false;
     BE.Usuario usuario = SesionActualWindows.SesionActual().ObtenerUsuarioActual();
     if (usuario.Perfil.Nombre == "CLIENTE")
     {
         BE.Cliente cliente = _gestorCliente.leer_cliente_CUIT(usuario.idUsuario.ToString());
         GridView1.DataSource = _gestorMovCustomer.leer_mov_Customer(cliente.idCliente.ToString());
     }
     else
     {
         GridView1.DataSource = _gestorMovCustomer.leer_mov_Customer();
     }
     GridView1.DataBind();
 }
예제 #18
0
        public BE.VehiculoStock BuscarVehiculoOfrecido(BE.Cliente cliente)
        {
            string query = $@"SELECT * FROM vehiculoStock WHERE id_cliente = {cliente.Id} AND (adquirido is null OR adquirido = 0);";

            BE.VehiculoStock vehiculo = new BE.VehiculoStock();
            DataTable        tabla    = _acceso.ExecuteReader(query);

            if (tabla.Rows.Count == 1)
            {
                foreach (DataRow fila in tabla.Rows)
                {
                    vehiculo.Id           = int.Parse(fila["id"].ToString());
                    vehiculo.Patente      = fila["patente"].ToString();
                    vehiculo.TipoVehiculo = int.Parse(fila["tipo_vehiculo"].ToString());
                    vehiculo.Marca        = fila["marca"].ToString();
                    vehiculo.Modelo       = fila["modelo"].ToString();
                    vehiculo.Anio         = int.Parse(fila["anio"].ToString());
                    vehiculo.Version      = fila["version"].ToString();
                    vehiculo.Kilometraje  = int.Parse(fila["kilometraje"].ToString());
                    vehiculo.Color        = fila["color"].ToString();

                    Estado _estadoDal = new Estado();
                    vehiculo.Estado = _estadoDal.BuscarEstadoId(int.Parse(fila["id_estado"].ToString()));

                    vehiculo.Precio = fila["precio"].ToString();
                    if (!String.IsNullOrEmpty(fila["adquirido"].ToString()))
                    {
                        vehiculo.Adquirido = Convert.ToBoolean(fila["adquirido"].ToString());
                    }
                    if (!String.IsNullOrEmpty(fila["disponible"].ToString()))
                    {
                        vehiculo.Disponible = Convert.ToBoolean(fila["disponible"].ToString());
                    }


                    Cliente _clienteDal = new Cliente();
                    vehiculo.Cliente = _clienteDal.BuscarClienteId(int.Parse(fila["id_cliente"].ToString()));

                    vehiculo.Dvh = long.Parse(fila["dvh"].ToString());
                }
                return(vehiculo);
            }
            else
            {
                throw new Exception("Existe mas de un vehiculo ofrecido y sin adquirir");
            }
        }
예제 #19
0
 protected void CalcularStock()
 {
     BE.Usuario usuario = SesionActualWindows.SesionActual().ObtenerUsuarioActual();
     if (usuario.Perfil.Nombre == "CLIENTE")
     {
         BE.Cliente cliente = new BE.Cliente();
         cliente = _gestorCliente.leer_cliente_CUIT(usuario.idUsuario.ToString());
         if (string.IsNullOrEmpty(cliente.idCliente.ToString()))
         {
             lblCant.Text = Traductor.Mensaje("ERR115", SesionActualWindows.SesionActual().ObtenerUsuarioActual().Cultura.ToString());
         }
         else
         {
             lblCant.Text = string.Format("{0:#,#}", _gestorMovEmpresa.calcular_stock_empresa(cliente.idCliente)).ToString() + Traductor.Mensaje("Puntos", SesionActualWindows.SesionActual().ObtenerUsuarioActual().Cultura.ToString());
         }
     }
 }
예제 #20
0
        protected void GridView1_RowEditing(Object sender, GridViewEditEventArgs e)
        {
            //Todas los campos excepto dropdownlist
            GridView1.EditIndex = e.NewEditIndex;
            LlenarTabla();
            lblInfo.Text = "";

            //Perfil
            DropDownList combo = GridView1.Rows[e.NewEditIndex].FindControl("lstPerfilTabla") as DropDownList;

            string usr = GridView1.DataKeys[e.NewEditIndex].Value.ToString();

            BE.Usuario usuario = _gestorUsuario.leer_usuario(usr);

            if (combo != null)
            {
                BE.Usuario usuario1 = SesionActualWindows.SesionActual().ObtenerUsuarioActual();
                if (usuario1.Perfil.Nombre == "CLIENTE")
                {
                    BE.Cliente       cliente = _gestorCliente.leer_cliente_CUIT(usuario1.idUsuario.ToString());
                    BE.PermisoFiltro perm    = new BE.PermisoFiltro();
                    perm.Nombre      = "CONSUMIDOR";
                    combo.DataSource = _gestorPermiso.leer_permiso(perm);
                }
                else
                {
                    combo.DataSource = _gestorPermiso.leer_permiso();
                }
                combo.DataTextField  = "Descripcion";
                combo.DataValueField = "Nombre";
                combo.DataBind();
                combo.SelectedValue = Convert.ToString(usuario.Perfil.Nombre);
            }

            //Cultura
            DropDownList comboCultura = GridView1.Rows[e.NewEditIndex].FindControl("lstCultura") as DropDownList;

            if (combo != null)
            {
                comboCultura.DataSource     = _gestorCultura.leer_cultura();
                comboCultura.DataTextField  = "descripcion";
                comboCultura.DataValueField = "idCultura";
                comboCultura.DataBind();
                comboCultura.SelectedValue = Convert.ToString(usuario.Cultura);
            }
        }
예제 #21
0
 protected void LlenarListas()
 {
     if (usuario.Perfil.Nombre == "CLIENTE")
     {
         BE.Cliente        cliente      = _gestorCliente.leer_cliente_CUIT(usuario.idUsuario.ToString());
         List <BE.Cliente> listaCliente = new List <BE.Cliente>();
         listaCliente.Add(_gestorCliente.leer_cliente(cliente.idCliente.ToString()));
         lstEmpresa.DataSource = listaCliente;
     }
     else
     {
         lstEmpresa.DataSource = _gestorCliente.leer_cliente();
     }
     lstEmpresa.DataTextField  = "razonSocial";
     lstEmpresa.DataValueField = "idCliente";
     lstEmpresa.DataBind();
 }
예제 #22
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            int indice        = (int)grillaCliente.CurrentRow.Cells[0].Value;
            var listaFamilias = _clienteBll.ListarClientes();

            BE.Cliente _cliente = listaFamilias.Where(i => i.Id == indice).FirstOrDefault();
            try
            {
                _clienteBll.EliminarCliente(_cliente);
                MessageBox.Show("Cliente eliminado correctamente");
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }

            ActualizarGrilla();
        }
예제 #23
0
        private void RecalcularDigitosCliente()
        {
            //RECALCULO DVH Y DVV DE LA TABLA CLIENTE
            BLL.Cliente       cliente_BLL   = new BLL.Cliente();
            BE.Cliente        cliente_BE    = new BE.Cliente();
            List <BE.Cliente> lista_cliente = new List <BE.Cliente>();

            lista_cliente = cliente_BLL.SelectAll();
            string cadena = "";

            foreach (BE.Cliente item in lista_cliente)
            {
                cadena = item.activo.ToString() + item.nombre.ToString() + item.apellido.ToString() + item.documento.ToString() + item.telefono.ToString() + item.email.ToString();
                int valorDVH = UTILITIES.DigitoVerificador.ObtenerDVH(cadena);
                cliente_BLL.UpdateDVH(valorDVH, item.id_cliente);
            }

            BLL.DigitoVerificador.CalcularDVV("Cliente");
        }
예제 #24
0
        private void CargarVenta()
        {
            BLL.Factura f1 = new BLL.Factura();
            BE.Factura  f  = new BE.Factura();
            f.Id    = int.Parse(txtidfactura.Text);
            f.Fecha = dateTimePicker1.Value.Date;
            BE.Cliente c1 = new BE.Cliente();
            c1.Id        = int.Parse(txtidcliente.Text);
            c1.Nombre    = txtnombre.Text;
            c1.Apellido  = txtapellido.Text;
            c1.Direccion = txtdireccion.Text;
            c1.Telefono  = txttelefono.Text;
            f.Cliente    = c1;
            //            List<BE.DetalleFactura> listafd = new List<BE.DetalleFactura>();
            BE.DetalleFactura df;
            //          List<BE.Producto> listaprod =new List<BE.Producto>();
            BE.Producto p1;
            f1.Add(f);
            txtidfactura.Text = f1.GetMaxId().ToString();
            foreach (DataRow aux in _dtfact.Rows)
            {
                p1             = new BE.Producto();
                df             = new BE.DetalleFactura();
                p1.Id          = int.Parse(aux[0].ToString());
                p1.Descripcion = aux[1].ToString();
                p1.Precio      = decimal.Parse(aux[2].ToString());
                p1.Stock       = int.Parse(aux[3].ToString());

                df.Id       = int.Parse(txtidfactura.Text);
                df.Producto = p1;
                df.Cantidad = int.Parse(aux[4].ToString());
                f.setDetalle(df);
                p1 = null;
                df = null;
            }

            BLL.DetalleFactura fd1 = new BLL.DetalleFactura();
            foreach (BE.DetalleFactura item in f.getDetalle())
            {
                fd1.Add(item);
            }
        }
예제 #25
0
        protected void LlenarListas()
        {
            lstCultura.DataSource     = _gestorCultura.leer_cultura();
            lstCultura.DataTextField  = "descripcion";
            lstCultura.DataValueField = "idCultura";
            lstCultura.DataBind();

            BE.Usuario usuario = SesionActualWindows.SesionActual().ObtenerUsuarioActual();
            if (usuario.Perfil.Nombre == "CLIENTE")
            {
                BE.Cliente       cliente = _gestorCliente.leer_cliente_CUIT(usuario.idUsuario.ToString());
                BE.PermisoFiltro perm    = new BE.PermisoFiltro();
                perm.Nombre          = "CONSUMIDOR";
                lstPerfil.DataSource = _gestorPermiso.leer_permiso(perm);
            }
            else
            {
                lstPerfil.DataSource = _gestorPermiso.leer_permiso();
            }
            lstPerfil.DataTextField  = "Descripcion";
            lstPerfil.DataValueField = "Nombre";
            lstPerfil.DataBind();
        }
예제 #26
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtNroDoc.Text))
            {
                MessageBox.Show("Por favor debe introducir un numero de documento");
                return;
            }
            if (!int.TryParse(txtNroDoc.Text, out int n))
            {
                MessageBox.Show("Por favor debe introducir un formato numerico para el numero de documento");
                return;
            }

            var  tDoc    = (KeyValuePair <int, string>)cmbTipoDoc.SelectedItem;
            int  tipoDoc = tDoc.Key;
            long nroDoc  = long.Parse(txtNroDoc.Text);

            try
            {
                cliente = _clienteBll.BuscarCliente(tipoDoc, nroDoc);
                var opcion = MessageBox.Show("Cliente Encontrado", $@"Se encontro el cliente = {cliente.Apellido},{cliente.Nombre}", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                if (opcion == DialogResult.OK)
                {
                    this.Close();
                }
            }
            catch (Exception exp)
            {
                var usuario = Services.SessionManager.GetInstance.Usuario;
                _bitacoraBll.RegistrarBitacora(usuario, $"No se encontro el cliente de documento = {nroDoc}", 2);
                var opcion = MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                if (opcion == DialogResult.OK)
                {
                    this.Close();
                }
            }
        }
예제 #27
0
        protected void GridView1_RowUpdating(Object sender, GridViewUpdateEventArgs e)
        {
            BE.Cliente miCliente = _gestorCliente.leer_cliente(e.Keys[0].ToString());

            if (e.NewValues[0] == null || e.NewValues[1] == null || e.NewValues[2] == null || e.NewValues[3] == null)
            {
                lblInfo.Text = Traductor.Mensaje("ERR141", SesionActualWindows.SesionActual().ObtenerUsuarioActual().Cultura.ToString());
            }
            else
            {
                bool chequeoFormato = true;

                if (!_check.ValidarCuit(e.NewValues[1].ToString()))
                {
                    chequeoFormato = false;
                }
                else
                {
                    string cuit = e.NewValues[1].ToString();
                    cuit           = cuit.Replace("-", "");
                    miCliente.cuit = cuit;
                }
                if (!_check.ValidarEMail(e.NewValues[2].ToString()))
                {
                    chequeoFormato = false;
                }
                if (!_check.ValidarTextoNumEspacio(e.NewValues[4].ToString()))
                {
                    chequeoFormato = false;
                }
                if (!_check.ValidarTextoNumEspacio(e.NewValues[5].ToString()))
                {
                    chequeoFormato = false;
                }
                if (!_check.ValidarTextoNumEspacio(e.NewValues[6].ToString()))
                {
                    chequeoFormato = false;
                }
                if (!_check.ValidarTextoNumEspacio(e.NewValues[7].ToString()))
                {
                    chequeoFormato = false;
                }
                if (!_check.ValidarNumerico(e.NewValues[8].ToString()))
                {
                    chequeoFormato = false;
                }
                else
                {
                    miCliente.SFI = Convert.ToInt16(e.NewValues[8].ToString());
                }


                miCliente.razonSocial = e.NewValues[0].ToString();
                miCliente.Email       = e.NewValues[2].ToString();
                miCliente.domicilio   = e.NewValues[3].ToString();
                miCliente.localidad   = e.NewValues[4].ToString();
                miCliente.provincia   = e.NewValues[5].ToString();
                miCliente.pais        = e.NewValues[6].ToString();
                miCliente.CP          = e.NewValues[7].ToString();


                if (chequeoFormato)
                {
                    _gestorCliente.insertar_cliente(miCliente);
                    GridView1.EditIndex = -1;
                    lblInfo.Text        = "";
                    LlenarTabla();
                    _gestorIntegridadBLL.recalcular_t_Cliente("corregir");
                }
                else
                {
                    lblInfo.Text = Traductor.Mensaje("ERR169", SesionActualWindows.SesionActual().ObtenerUsuarioActual().Cultura.ToString());
                }
            }
        }
예제 #28
0
 public BE.VehiculoStock BuscarVehiculoOfrecido(BE.Cliente cliente)
 {
     return(_vehiculoStockDal.BuscarVehiculoOfrecido(cliente));
 }
예제 #29
0
 public ActionResult Edit(BE.Cliente o)
 {
     DB.Cliente.Save(o);
     return(RedirectToAction("Index"));
 }
예제 #30
0
 public ModificarCliente(BE.Cliente cliente)
 {
     _cliente = cliente;
     InitializeComponent();
     Traducir();
 }