예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //si es el primer ingreso a la pagina
         if (!IsPostBack)
         {
             Session["ClienteSel"] = null;
             CargoGrilla();
             LimpioPantalla();
         }
         else
         {
             //ya se esta trabajando
             if (Session["ClienteSel"] != null)
             {
                 ClienteSeleccionado = (EntidadesCompartidas.Cliente)Session["ClienteSel"];
             }
             else
             {
                 ClienteSeleccionado = null;
             }
         }
     }
     catch (Exception ex)
     {
         LblError.Text = ex.Message;
     }
 }
예제 #2
0
    protected void gvListadoClientes_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            EntidadesCompartidas.Cliente oCli = Logica.LogicaCliente.BuscarCliente(Convert.ToInt32(gvListadoClientes.SelectedRow.Cells[1].Text));

            if (oCli != null)
            {
                //Obtengo detalles de tarjetas del cliente
                List <EntidadesCompartidas.Tarjeta> oLista = Logica.LogicaTarjeta.TarjetasXCliente(oCli.CI);

                gvSeleccionCliente.DataSource = oLista;
                gvSeleccionCliente.DataBind();

                lblCliente.Text = oCli.ToString();
            }
            else
            {
                lblCliente.Text = "";
                gvSeleccionCliente.DataSource = null;
                gvSeleccionCliente.DataBind();
            }
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
예제 #3
0
    protected void BtnAgregarCliente_Click(object sender, EventArgs e)
    {
        try
        {
            //verifico que no haya un cliente seleccionado, ya q en ese caso seria modificacion
            if (ClienteSeleccionado == null)
            {
                //creo al cliente a dar de alta
                EntidadesCompartidas.Cliente unCliente = new EntidadesCompartidas.Cliente(0, TxtNombre.Text.Trim(), TxtDireccion.Text.Trim());
                foreach (ListItem unLugar in LbTelefonos.Items)
                {
                    unCliente.AgregarTelefono(unLugar.Text.Trim());
                }

                //doy de alta
                Logica.FabricaLogica.GetLogicaCLiente().Alta(unCliente);

                //si llego aca es pq no hubo errores
                LblError.Text = "Alta de Cliente + Telefonos en Transaccion Logica Correcta";
                CargoGrilla();
                LimpioPantalla();
            }
            else
            {
                LblError.Text = "No puede ser un alta - Debe ser una Modificacion porque los datos provienen de un cliente seleccionado";
            }
        }
        catch (Exception ex)
        {
            LblError.Text = ex.Message;
        }
    }
예제 #4
0
        public List <EntidadesCompartidas.Cuenta> ListaCuentasDeCliente(EntidadesCompartidas.Cliente pCLiente)
        {
            SqlConnection _cnn    = new SqlConnection(Conexion.Cnn);
            Cuenta        _unaCta = null;
            List <Cuenta> _lista  = new List <Cuenta>();

            SqlCommand _comando = new SqlCommand("ListadoCuentasCliente", _cnn);

            _comando.CommandType = System.Data.CommandType.StoredProcedure;
            _comando.Parameters.AddWithValue("@NumCli", pCLiente.NumCli);

            try
            {
                _cnn.Open();
                SqlDataReader _lector = _comando.ExecuteReader();
                if (_lector.HasRows)
                {
                    while (_lector.Read())
                    {
                        _unaCta = new Cuenta((int)_lector["NumCta"], (PersistenciaCliente.GetInstancia().Buscar((int)_lector["NumCli"])), Convert.ToDouble(_lector["SaldoCta"]));
                        _lista.Add(_unaCta);
                    }
                }
                _lector.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                _cnn.Close();
            }
            return(_lista);
        }
예제 #5
0
    protected void BtnBusco_Click(object sender, EventArgs e)
    {
        try
        {
            EntidadesCompartidas.Cliente _unCliente = null;
            _unCliente = Logica.FabricaLogica.GetLogicaCliente().Buscar(Convert.ToInt32(TxtNumero.Text));
            this.LimpioControles();
            ManejoTelefonosCliente.LimpiarTodo();


            if (_unCliente == null)
            {
                BtnAlta.Enabled = true;
            }
            else
            {
                BtnModificar.Enabled = true;
                BtnBaja.Enabled      = true;
                Session["Cliente"]   = _unCliente;
                TxtNumero.Text       = _unCliente.NumCli.ToString();
                TxtNombre.Text       = _unCliente.NomCli;
                TxtDireccion.Text    = _unCliente.DirCli;
                TxtUsuario.Text      = _unCliente.UsuCli;
                TxtPassword.Text     = _unCliente.PassCli;
                ManejoTelefonosCliente.ListaTelefonos = _unCliente.ListaTelefonos;
            }
        }
        catch (Exception ex)
        {
            LblError.Text = ex.Message;
        }
    }
예제 #6
0
 protected void BtnBusco_Click(object sender, EventArgs e)
 {
     try
     {
         EntidadesCompartidas.Cliente _unCliente = null;
         _unCliente = Logica.LogicaCliente.ClienteBuscar(Convert.ToInt32(TxtCedula.Text));
         this.LimpioControles();
         if (_unCliente == null)
         {
             BtnAlta.Enabled = true;
         }
         else
         {
             BtnModificar.Enabled = true;
             BtnBaja.Enabled      = true;
             Session["Cliente"]   = _unCliente;
             TxtCedula.Text       = _unCliente.CICli.ToString();
             TxtNombre.Text       = _unCliente.NomCli;
             TxtDireccion.Text    = _unCliente.DirCli;
         }
     }
     catch (Exception ex)
     {
         LblError.Text = ex.Message;
     }
 }
예제 #7
0
        //operaciones
        public List <EntidadesCompartidas.Prestamo> ListoPrestamosCliente(EntidadesCompartidas.Cliente unCliente)
        {
            SqlConnection   _cnn        = new SqlConnection(Conexion.Cnn);
            Prestamo        _unPrestamo = null;
            List <Prestamo> _lista      = new List <Prestamo>();

            SqlCommand _comando = new SqlCommand("ListarPrestamosCliente", _cnn);

            _comando.CommandType = System.Data.CommandType.StoredProcedure;
            _comando.Parameters.AddWithValue("@NumCli", unCliente.NumCli);

            try
            {
                _cnn.Open();
                SqlDataReader _lector = _comando.ExecuteReader();
                if (_lector.HasRows)
                {
                    while (_lector.Read())
                    {
                        _unPrestamo = new Prestamo(Convert.ToInt32(_lector["IdPres"]), unCliente, Convert.ToDateTime(_lector["FechaPres"]), Convert.ToDouble(_lector["MontoPres"]), Convert.ToBoolean(_lector["AprobadoPres"]));
                        _lista.Add(_unPrestamo);
                    }
                }
                _lector.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                _cnn.Close();
            }
            return(_lista);
        }
예제 #8
0
 protected void LimpioPantalla()
 {
     TxtCodigo.Text    = "";
     TxtDireccion.Text = "";
     TxtNombre.Text    = "";
     TxtTelefono.Text  = "";
     LbTelefonos.Items.Clear();
     LbTelefonos.SelectedIndex = -1;
     LblError.Text             = "";
     GVClientes.SelectedIndex  = -1;
     ClienteSeleccionado       = null;
     Session["ClienteSel"]     = null;
 }
예제 #9
0
 protected void BtnBaja_Click(object sender, EventArgs e)
 {
     try
     {
         EntidadesCompartidas.Cliente _unCliente = (EntidadesCompartidas.Cliente)Session["Cliente"];
         Logica.LogicaCliente.ClienteBaja(_unCliente);
         this.DesActivoBotones();
         this.LimpioControles();
         LblError.Text = "Baja con Exito";
     }
     catch (Exception ex)
     {
         LblError.Text = ex.Message;
     }
 }
예제 #10
0
 protected void BtnAlta_Click(object sender, EventArgs e)
 {
     try
     {
         EntidadesCompartidas.Cliente _unCliente = null;
         _unCliente = new EntidadesCompartidas.Cliente(Convert.ToInt32(TxtCedula.Text), TxtNombre.Text.Trim(), TxtDireccion.Text.Trim());
         Logica.LogicaCliente.ClienteAlta(_unCliente);
         this.DesActivoBotones();
         this.LimpioControles();
         LblError.Text = "Alta con Exito";
     }
     catch (Exception ex)
     {
         LblError.Text = ex.Message;
     }
 }
예제 #11
0
 protected void BtnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         EntidadesCompartidas.Cliente _unCliente = (EntidadesCompartidas.Cliente)Session["Cliente"];
         _unCliente.NomCli = TxtNombre.Text.Trim();
         _unCliente.DirCli = TxtDireccion.Text.Trim();
         Logica.LogicaCliente.ClienteModificar(_unCliente);
         this.DesActivoBotones();
         this.LimpioControles();
         LblError.Text = "Modificacion con Exito";
     }
     catch (Exception ex)
     {
         LblError.Text = ex.Message;
     }
 }
예제 #12
0
 protected void RpClientes_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Listar")
     {
         try
         {
             EntidadesCompartidas.Cliente       _unCliente = Logica.FabricaLogica.GetLogicaCliente().Buscar(Convert.ToInt32(((TextBox)(e.Item.Controls[1])).Text));
             List <EntidadesCompartidas.Cuenta> _miLista   = Logica.FabricaLogica.GetLogicaCliente().ListaCuentasDeCliente(_unCliente);
             GVCuentas.DataSource = _miLista;
             GVCuentas.DataBind();
         }
         catch (Exception ex)
         {
             LblError.Text = ex.Message;
         }
     }
 }
예제 #13
0
        public List <EntidadesCompartidas.Movimiento> ListaMovsDeCliente(EntidadesCompartidas.Cliente pCLiente)
        {
            SqlConnection     _cnn   = new SqlConnection(Conexion.Cnn);
            List <Movimiento> _lista = new List <Movimiento>();
            Movimiento        _unMov = null;

            SqlCommand _comando = new SqlCommand("TodosLosMovsDeCliente", _cnn);

            _comando.Parameters.AddWithValue("@numCli", pCLiente.NumCli);
            _comando.CommandType = System.Data.CommandType.StoredProcedure;

            try
            {
                _cnn.Open();
                SqlDataReader _lector = _comando.ExecuteReader();
                if (_lector.HasRows)
                {
                    while (_lector.Read())
                    {
                        //busco la cuenta
                        Cuenta _unaCuenta = null;
                        _unaCuenta = PersistenciaCuentaCAhorro.GetInstancia().Buscar((int)_lector["NumCta"]);
                        if (_unaCuenta == null)
                        {
                            _unaCuenta = PersistenciaCuentaCorriente.GetInstancia().Buscar((int)_lector["NumCta"]);
                        }

                        //creo el movimiento
                        _unMov = new Movimiento((int)_lector["IdMov"], (DateTime)_lector["FechaMov"], Convert.ToDouble(_lector["MontoMov"]), (string)_lector["TipoMov"], _unaCuenta);
                        _lista.Add(_unMov);
                    }
                }
                _lector.Close();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                _cnn.Close();
            }
            return(_lista);
        }
예제 #14
0
    protected void BtnBaja_Click(object sender, EventArgs e)
    {
        try
        {
            EntidadesCompartidas.Cliente _unCliente = (EntidadesCompartidas.Cliente)Session["Cliente"];
            Logica.FabricaLogica.GetLogicaCliente().Baja(_unCliente);
            this.DesActivoBotones();
            this.LimpioControles();
            ManejoTelefonosCliente.LimpiarTodo();
            TxtNumero.Enabled  = true;
            TxtNumero.ReadOnly = false;

            LblError.Text = "Baja con Exito";
        }
        catch (Exception ex)
        {
            LblError.Text = ex.Message;
        }
    }
예제 #15
0
    protected void BtnAlta_Click(object sender, EventArgs e)
    {
        try
        {
            EntidadesCompartidas.Cliente _unCliente = null;
            _unCliente = new EntidadesCompartidas.Cliente(0, TxtNombre.Text.Trim(), TxtDireccion.Text.Trim(), TxtUsuario.Text.Trim(), TxtPassword.Text.Trim(), ManejoTelefonosCliente.ListaTelefonos);
            Logica.FabricaLogica.GetLogicaCliente().Alta(_unCliente);
            this.DesActivoBotones();
            this.LimpioControles();
            ManejoTelefonosCliente.LimpiarTodo();
            TxtNumero.Enabled  = true;
            TxtNumero.ReadOnly = false;

            LblError.Text = "Alta con Exito";
        }
        catch (Exception ex)
        {
            LblError.Text = ex.Message;
        }
    }
예제 #16
0
 protected void BtnBuscarCliente_Click(object sender, EventArgs e)
 {
     try
     {
         //busco al cliente
         EntidadesCompartidas.Cliente _unCliente = null;
         _unCliente = Logica.LogicaCliente.ClienteBuscar(Convert.ToInt32(TxtCliente.Text));
         if (_unCliente == null)
         {
             throw new Exception("No se encontro al cliente");
         }
         else
         {
             Session["UnCliente"] = _unCliente;
             LblCliente.Text      = _unCliente.NomCli;
         }
     }
     catch (Exception ex)
     {
         LblError.Text = ex.Message;
     }
 }
예제 #17
0
 protected void GVClientes_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         //busco el cliente seleccionado
         ClienteSeleccionado = Logica.FabricaLogica.GetLogicaCLiente().Busco(Convert.ToInt32(GVClientes.SelectedRow.Cells[0].Text));
         if (ClienteSeleccionado == null)
         {
             LblError.Text         = "Error al buscar el cliente seleccionado";
             Session["ClienteSel"] = null;
             ClienteSeleccionado   = null;
         }
         else
         {
             Session["ClienteSel"] = ClienteSeleccionado;
             CargoCliente();
         }
     }
     catch (Exception ex)
     {
         LblError.Text = ex.Message;
     }
 }
예제 #18
0
    protected void BtnModificar_Click(object sender, EventArgs e)
    {
        try
        {
            EntidadesCompartidas.Cliente _unCliente = (EntidadesCompartidas.Cliente)Session["Cliente"];
            _unCliente.NomCli         = TxtNombre.Text.Trim();
            _unCliente.DirCli         = TxtDireccion.Text.Trim();
            _unCliente.UsuCli         = TxtUsuario.Text.Trim();
            _unCliente.PassCli        = TxtPassword.Text.Trim();
            _unCliente.ListaTelefonos = ManejoTelefonosCliente.ListaTelefonos;
            Logica.FabricaLogica.GetLogicaCliente().Modificar(_unCliente);
            this.DesActivoBotones();
            this.LimpioControles();
            ManejoTelefonosCliente.LimpiarTodo();
            TxtNumero.Enabled  = true;
            TxtNumero.ReadOnly = false;

            LblError.Text = "Modificacion con Exito";
        }
        catch (Exception ex)
        {
            LblError.Text = ex.Message;
        }
    }
예제 #19
0
 public bool AltaCliente(EntidadesCompartidas.Cliente pCliente)
 {
     return(true);
 }
예제 #20
0
 //constructores
 public CuentaCorriente(int pNumCta, Cliente pUnCliente, double pSaldoCuenta, double pMinimoCta)
     : base(pNumCta, pUnCliente, pSaldoCuenta)
 {
     _minimoCta = pMinimoCta;
 }
예제 #21
0
 public bool Calificar(int puntaje, string comentario, EntidadesCompartidas.Cliente cliente)
 {
     return(true);
 }
예제 #22
0
 public bool ModificarCliente(EntidadesCompartidas.Cliente pCliente)
 {
     return(true);
 }