示例#1
0
        public ActionResult Grafico()
        {
            ServicioCliente servicio = new ServicioCliente();
            List <Cliente>  clientes = servicio.OntenerClientes();

            var deportistasPorAnyo = clientes.GroupBy(p => p.FechaNacimiento.Year).Select(p => new { Year = p.Key, Cantidad = p.Count() });
            var datosGrafico       = "[";

            if (deportistasPorAnyo.Count() > 0)
            {
                foreach (var valor in deportistasPorAnyo)
                {
                    datosGrafico += "['" + valor.Year + "', " + valor.Cantidad + "],";
                }
                datosGrafico  = datosGrafico.Substring(0, datosGrafico.Length - 1);
                datosGrafico += "]";
            }
            else
            {
                datosGrafico = "[]";
            }

            ViewBag.DatosGrafico = datosGrafico;
            return(View());
        }
示例#2
0
        public string ModificarCliente(/*int id_cliente,*/ string cedula, string nombre, string apellido1, string apellido2, string direccion, string telefono, int deuda)
        {
            Cliente nuevoCliente = new Cliente(/*id_cliente,*/ cedula, nombre, apellido1, apellido2, direccion, telefono, deuda);

            using (ServicioCliente elCliente = new ServicioCliente())
                return(elCliente.ModificarCliente(nuevoCliente));
        }
示例#3
0
 public DataTable listarCliente()
 {
     using (ServicioCliente comp = new ServicioCliente())
     {
         return(comp.listarCliente());
     }
 }
示例#4
0
        public string InsertarCliente(string cedula, string nombre, string apellido1, string apellido2, string direccion, string telefono, int deuda)
        {
            Cliente nuevoCliente = new Cliente(cedula, nombre, apellido1, apellido2, direccion, telefono, deuda);

            using (ServicioCliente elCliente = new ServicioCliente())
                return(elCliente.InsertarCliente(nuevoCliente));
        }
        public ClientesController() : base()
        {
            _contexto = new Contexto();
            var repository = new ClienteRepository(_avikaDB, _logger);

            this._servicio = new ServicioCliente(repository);
        }
示例#6
0
 public DataSet ConsultarCliente(string id)
 {
     using (ServicioCliente comp = new ServicioCliente())
     {
         return(comp.ConsultarCliente(id));
     }
 }
示例#7
0
        //
        // GET: /Reporte/

        public ActionResult Listado()
        {
            ServicioCliente servicio = new ServicioCliente();
            List <Cliente>  clientes = servicio.OntenerClientes();

            return(View(clientes));
        }
        public string ModificarCliente(int code, string name, string lastname, string telephone, string address, string postalCode, Double staticPrice)
        {
            Cliente nuevoCliente = new Cliente(code, name, lastname, telephone, address, postalCode, staticPrice);

            using (ServicioCliente elCliente = new ServicioCliente())
                return(elCliente.ModificarCliente(nuevoCliente));
        }
        public string InsertSaveBills(int id_cliente)
        {
            Cliente nuevoCliente = new Cliente(id_cliente);

            using (ServicioCliente elCliente = new ServicioCliente())
                return(elCliente.InsertSaveBills(nuevoCliente));
        }
示例#10
0
        private void CargarItemsValoresNegociadosViewModel(
            DetalleViewModelBase <DetalleValorNegociadoAyuda> viewModel,
            int p    = 1,
            bool exp = false)
        {
            var items = ServicioCliente.ObtenerValoresNegociados(Socio.NroCuenta);

            if (viewModel.Desde.HasValue)
            {
                items = items.Where(e => e.FecDep.Date >= viewModel.Desde.Value.Date);
            }

            if (viewModel.Hasta.HasValue)
            {
                items = items.Where(e => e.FecDep.Date <= viewModel.Hasta.Value.Date);
            }

            if (exp)
            {
                viewModel.Items = items.ToList();
            }
            else
            {
                viewModel.CargarItemsYPaginacionDesdeListaCompletaDeItems(items.ToList(), p, CANT_ITEMS_POR_PAGINA);
            }
        }
示例#11
0
        public string ListarCliente(int id_cliente)

        {
            Cliente nuevoCliente = new Cliente();

            using (ServicioCliente elCliente = new ServicioCliente())
                return(elCliente.ListarCliente(nuevoCliente));
        }
示例#12
0
        public string InsertarCliente(string nombre, string ced, string ap, string tel, string mail,
                                      string dir, string est)
        {
            Cliente nuevoInventario = new Cliente(nombre, ced, ap, tel, mail, dir, est);

            using (ServicioCliente elInventario = new ServicioCliente())
                return(elInventario.ingresarCliente(nuevoInventario));
        }
 public JsonResult StaffNewPersonSave(NewClienteStaff obj)
 {
     try
     {
         if (obj != null)
         {
             if (obj.Cliente.strImagen != null)
             {
                 string data       = obj.Cliente.strImagen;
                 var    base64Data = Regex.Match(data, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
                 var    compare    = Encoding.UTF8.GetBytes(obj.Cliente.strImagen);
                 obj.Cliente.imagen = Convert.FromBase64String(base64Data);
                 string archivo    = string.Format("{0}.jpg", obj.Cliente.NombreCompleto);
                 var    PathString = HostingEnvironment.MapPath(string.Format("~/Images/{0}", archivo));
                 System.IO.File.WriteAllBytes(PathString, obj.Cliente.imagen);
             }
             obj.Cliente.Identificacion  = obj.Cliente.Identificacion.TrimStart('0');
             obj.Cliente.TipoPersona_id  = 1;
             obj.Cliente.PrimerNombres   = !string.IsNullOrWhiteSpace(obj.Cliente.PrimerNombres) ? obj.Cliente.PrimerNombres.Trim() : null;
             obj.Cliente.SegundoNombres  = !string.IsNullOrWhiteSpace(obj.Cliente.SegundoNombres) ? obj.Cliente.SegundoNombres.Trim() : null;
             obj.Cliente.PrimerApellido  = !string.IsNullOrWhiteSpace(obj.Cliente.PrimerApellido) ? obj.Cliente.PrimerApellido.Trim() : null;
             obj.Cliente.SegundoApellido = !string.IsNullOrWhiteSpace(obj.Cliente.SegundoApellido) ? obj.Cliente.SegundoApellido.Trim() : null;
             ServicioCliente servicioCliente = new ServicioCliente();
             obj.Cliente.Direcciones           = new List <DireccionViewModel>();
             obj.Cliente.Auditoria.IdCreatorby = Utilidades.GetCurrentUser().Id;
             obj.Cliente.Auditoria.DateCreated = DateTime.Now;
             servicioCliente.Save(obj.Cliente);
             obj.Staff.IdCliente = obj.Cliente.Id;
             ServicioStaff servicio = new ServicioStaff();
             Random        grdn     = new Random();
             //para identificar si es boleta 1 - boleta virtual 2 - manilla 3 - escarapela 4
             var identificardor = "4";
             var year           = DateTime.Now.Year.ToString().Substring(2, 2);
             var month          = DateTime.Now.Month.ToString();
             var day            = DateTime.Now.Day.ToString();
             var min            = DateTime.Now.Minute.ToString();
             var seg            = DateTime.Now.Second.ToString();
             obj.Staff.Auditoria.IdCreatorby = Utilidades.GetCurrentUser().Id;
             obj.Staff.Auditoria.DateCreated = DateTime.Now;
             obj.Staff.CodigoUnico           = string.Format("{0}{1}{2}{3}{4}{5}{6}{7}{8}", identificardor, grdn.Next(1000), year, grdn.Next(1000), month, grdn.Next(1000), day, min, seg);
             servicio.AsociarStaff(obj.Staff);
             return(Json(new
             {
                 execute = (obj.Staff.Id > 0) ? true : false,
                 messagge = "El usuario a sido asociado al evento"
             }, JsonRequestBehavior.AllowGet));
         }
         return(null);
     }
     catch (Exception)
     {
         return(Json(new
         {
             execute = (obj.Staff.Id > 0) ? true : false,
             messagge = "El Cliente ya existe, ingreselo por medio del buscar de esta pantalla"
         }, JsonRequestBehavior.AllowGet));
     }
 }
示例#14
0
 public Model() : base(FactoriesSingleton <T> .UnitOfWork, FactoriesSingleton <T> .GenericRepository)
 {
     ServicioUsuario       = new ServicioUsuario(FactoriesSingleton <Usuario> .UnitOfWork, FactoriesSingleton <Usuario> .GenericRepository);
     ServicioCliente       = new ServicioCliente(FactoriesSingleton <Cliente> .UnitOfWork, FactoriesSingleton <Cliente> .GenericRepository);
     ServicioDirección     = new ServicioDirección(FactoriesSingleton <Dirección> .UnitOfWork, FactoriesSingleton <Dirección> .GenericRepository);
     ServicioTelefóno      = new ServicioTelefóno(FactoriesSingleton <Telefóno> .UnitOfWork, FactoriesSingleton <Telefóno> .GenericRepository);
     ServicioMetodoPago    = new ServicioMetodoPago(FactoriesSingleton <ClienteMetodoDePago> .UnitOfWork, FactoriesSingleton <ClienteMetodoDePago> .GenericRepository);
     ServicioCompra        = new ServicioCompra(FactoriesSingleton <Compra> .UnitOfWork, FactoriesSingleton <Compra> .GenericRepository);
     ServicioCompraCliente = new ServicioCompraCliente(FactoriesSingleton <CompraCliente> .UnitOfWork, FactoriesSingleton <CompraCliente> .GenericRepository);
 }
示例#15
0
 private void FrmClientes_Load(object sender, System.EventArgs e)
 {
     try
     {
         _servicio = new ServicioCliente();
         lista     = _servicio.GetLista();
         MostrarEnGrilla();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#16
0
        private void CargarServiciosCuotasViewModel(
            ServiciosCuotasViewModel viewModel,
            int p    = 1,
            bool exp = false)
        {
            var items = ServicioCliente.ObtenerServiciosCuotas(Socio.NroCuenta);

            viewModel.CuotasPendientes = viewModel.CuotasImpagas = viewModel.CuotasPagas = 0;
            viewModel.TotalPagado      = 0;

            if (items.Any())
            {
                foreach (var item in items)
                {
                    if (item.FechaPago.HasValue)
                    {
                        viewModel.CuotasPagas++;
                        viewModel.TotalPagado += item.Total;
                    }
                    else
                    {
                        viewModel.CuotasImpagas++;
                    }
                }

                var ultimaCuota = items.Last();
                viewModel.CuotasPendientes = ultimaCuota.Plan - ultimaCuota.Cuota;
            }

            if (viewModel.Desde.HasValue)
            {
                items = items.Where(e => e.Fecha.Date >= viewModel.Desde.Value.Date);
            }

            if (viewModel.Hasta.HasValue)
            {
                items = items.Where(e => e.Fecha.Date <= viewModel.Hasta.Value.Date);
            }

            if (exp)
            {
                viewModel.Items = items.ToList();
            }
            else
            {
                viewModel.CargarItemsYPaginacionDesdeListaCompletaDeItems(items.ToList(), p, CANT_ITEMS_POR_PAGINA);
            }
        }
示例#17
0
        internal static void CargarComboCliente(ref ComboBox cbm)
        {
            ServicioCliente servicioCliente = new ServicioCliente();

            cbm.DataSource = null;
            List <Cliente> lista          = servicioCliente.GetLista();
            var            defaultCliente = new Cliente {
                ClienteId = 0, Nombre = "[Seleccione]"
            };

            lista.Insert(0, defaultCliente);
            cbm.DataSource    = lista;
            cbm.DisplayMember = "Nombre";
            cbm.ValueMember   = "ClienteId";
            cbm.SelectedIndex = 0;
        }
示例#18
0
        public void CargarDatos3()
        {
            List <ServicioCliente> existe = ServicioCliente.LeerTodosServiciosCliente(lstClientes.SelectedItem.ToString());

            lstClienteServicio.Items.Clear();
            //verificamos si el cliente esta registrado e inhabilitamos el boton guardar
            if (existe.Any())
            {
                existe.ForEach(Cli => lstClienteServicio.Items.Add(Cli.detalle));
            }
            else
            {
                lstClienteServicio.Items.Add("¡No hay Servicios para este cliente!");
                // deshabilitamos el boton de guardar, dado que ya existe el cliente
            }
        }
示例#19
0
        private void CargarItemsCajaDeAhorrosViewModel(
            DetalleCajaDeAhorrosViewModel viewModel,
            int p    = 1,
            bool exp = false)
        {
            var items = ServicioCliente.ObtenerDetalleCajaDeAhorro(Socio.NroCuenta, viewModel.TipoComprobante, viewModel.Desde, viewModel.Hasta.Value);

            if (exp)
            {
                viewModel.Items = items.ToList();
            }
            else
            {
                viewModel.CargarItemsYPaginacionDesdeListaCompletaDeItems(items.ToList(), p, CANT_ITEMS_POR_PAGINA);
            }
        }
示例#20
0
        private void CargarItemsAyudasEconomicasViewModel(
            DetalleViewModelBase <AyudaEconomicaVigente> viewModel,
            int p    = 1,
            bool exp = false)
        {
            var items = ServicioCliente.ObtenerAyudasEconomicas(Socio.NroCuenta, viewModel.Desde, viewModel.Hasta.Value);

            if (exp)
            {
                viewModel.Items = items.ToList();
            }
            else
            {
                viewModel.CargarItemsYPaginacionDesdeListaCompletaDeItems(items.ToList(), p, CANT_ITEMS_POR_PAGINA);
            }
        }
示例#21
0
        public bool Update()
        {
            ServicioCliente serv  = new ServicioCliente();
            CLIENTE         datos = new CLIENTE();

            datos.CORREO_CLIENTE    = this.CORREO_CLIENTE;
            datos.DIRECCION_CLIENTE = this.DIRECCION_CLIENTE;
            datos.DV_CLIENTE        = this.DV_CLIENTE;
            datos.ID_COMUNA         = this.ID_COMUNA;
            datos.ID_USUARIO        = this.ID_USUARIO;
            datos.NOMBRE_CLIENTE    = this.NOMBRE_CLIENTE;
            datos.RUT_CLIENTE       = this.RUT_CLIENTE;
            datos.TELEFONO_CLIENTE  = this.TELEFONO_CLIENTE;

            return(serv.UpdateCliente(datos));
        }
        public ActionResult Staff_ReadByIdentificacion(int tipoId, string identificacion)
        {
            var cliente = new ServicioCliente().ReadByIdenTipo(tipoId, identificacion);

            if (cliente != null)
            {
                if (cliente.Direcciones.Count == 0)
                {
                    List <DireccionViewModel> objdireccion = new List <DireccionViewModel>();
                    objdireccion.Add(new DireccionViewModel {
                        Ciudad_id = 0, CodigoPostal = "", Direccion = ""
                    });
                    cliente.Direcciones = objdireccion;
                }
            }

            return(Json(new { objeto = cliente }, JsonRequestBehavior.AllowGet));
        }
示例#23
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (txtSaldo.Text == "" || lstClientes.SelectedIndex == -1 || lstServicio.SelectedIndex == -1)
            {
                MessageBox.Show("Debe seleccionar un cliente, un servicio y especificar el saldo", "Error en ingreso", MessageBoxButtons.OK);
            }
            else
            {
                //instanciamos de la clase clienteServicio
                ServicioCliente nuevo = new ServicioCliente();
                nuevo.saldo = Convert.ToDecimal(txtSaldo.Text);

                if (ServicioCliente.InsertarClienteServicio(lstClientes.SelectedItem.ToString(), lstServicio.SelectedItem.ToString(), nuevo))
                {
                    MessageBox.Show("Registro guardado correctamente", "Control de clientes y servicios", MessageBoxButtons.OK);
                    Limpiar();
                }
            }
        }
示例#24
0
        private void lstClienteServicio_Click(object sender, EventArgs e)
        {
            //cargamos el dato de saldo para ser actualizado.
            ServicioCliente existe = ServicioCliente.LeerDatoServicio(lstClienteServicio.SelectedItem.ToString(), lstClientes.SelectedItem.ToString());

            //verificamos si el cliente esta registrado e inhabilitamos el boton guardar
            if (existe.saldo != 0)
            {
                // deshabilitamos el boton de guardar, dado que ya existe el cliente
                btnAgregar.Enabled  = false;
                btnEditar.Enabled   = true;
                btnEliminar.Enabled = true;
                txtSaldo.Text       = Convert.ToString(existe.saldo);
            }
            else
            {
                txtSaldo.Text = "Error";
            }
        }
示例#25
0
        //CRUD Cliente
        public bool ExisteRutC(string cliente)
        {
            XmlSerializer ser    = new XmlSerializer(typeof(Modelo.Cliente));
            StringReader  reader = new StringReader(cliente);

            Modelo.Cliente  c    = (Modelo.Cliente)ser.Deserialize(reader);
            ServicioCliente serv = new ServicioCliente();

            Datos.CLIENTE cDatos = new Datos.CLIENTE();
            cDatos.RUT_CLIENTE = c.RUT_CLIENTE;

            if (!serv.ExisteRut(cDatos))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#26
0
        public bool RegistroCliente(string cliente)
        {
            XmlSerializer ser    = new XmlSerializer(typeof(Modelo.Cliente));
            StringReader  reader = new StringReader(cliente);

            Modelo.Cliente  c        = (Modelo.Cliente)ser.Deserialize(reader);
            ServicioCliente servicio = new ServicioCliente();

            Datos.CLIENTE cDatos = new Datos.CLIENTE();
            //Datos Cliente
            cDatos.RUT_CLIENTE       = c.RUT_CLIENTE;
            cDatos.DV_CLIENTE        = c.DV_CLIENTE;
            cDatos.DIRECCION_CLIENTE = c.DIRECCION_CLIENTE;
            cDatos.CORREO_CLIENTE    = c.CORREO_CLIENTE;
            cDatos.TELEFONO_CLIENTE  = c.TELEFONO_CLIENTE;
            cDatos.ID_COMUNA         = c.ID_COMUNA;
            cDatos.ID_USUARIO        = 0;
            cDatos.NOMBRE_CLIENTE    = c.NOMBRE_CLIENTE;

            return(servicio.AgregarCliente(cDatos));
        }
示例#27
0
        public bool BuscarCliente(short ID_USUARIO)
        {
            ServicioCliente serv  = new ServicioCliente();
            CLIENTE         datos = serv.BuscarCliente(ID_USUARIO);

            if (datos != null)
            {
                this.CORREO_CLIENTE    = datos.CORREO_CLIENTE;
                this.DIRECCION_CLIENTE = datos.DIRECCION_CLIENTE;
                this.DV_CLIENTE        = datos.DV_CLIENTE;
                this.ID_COMUNA         = datos.ID_COMUNA;
                this.ID_USUARIO        = datos.ID_USUARIO;
                this.NOMBRE_CLIENTE    = datos.NOMBRE_CLIENTE;
                this.RUT_CLIENTE       = datos.RUT_CLIENTE;
                this.TELEFONO_CLIENTE  = datos.TELEFONO_CLIENTE;

                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#28
0
        public ActionResult Resumen(
            int p    = 1,
            bool exp = false,
            string f = null)
        {
            List <SaldoCajaAhorro> saldos = new List <SaldoCajaAhorro>();

            try
            {
                //saldo = ServicioCliente.ObtenerSaldoCajaDeAhorro(Socio.NroCuenta, Socio.TipoCuentaAbreviado);
                saldos = ServicioCliente.ObtenerSaldosCajaDeAhorro(Socio.NroCuenta).ToList();
            }
            catch (Exception)
            {
                // NOTA: si no pude obtener el saldo asumimos que el socio no posee una Caja de ahorros
            }

            if (saldos != null && saldos.Count > 0)
            {
                saldos.ForEach(s => s.TipoDesc = String.Format("{0} $ ({1})", Configuracion.Configuracion.CajaAhorrosTitulo, ServiciosTiposCuentaCodigos.ObtenerNombreDesdeCodigo(s.Tipo), s.TipoAMV = "AMV" + s.Tipo));

                if (exp)
                {
                    switch (f)
                    {
                    case Formato.ARCHIVO_FORMATO_PDF:
                        return(ReportesPdfHelper.GenerarReporteResumenPdfFileResult(saldos));

                    case Formato.ARCHIVO_FORMATO_EXCEL:
                    default:
                        return(ReportesExcelHelper.GenerarActionResultExcelResumen(saldos));
                    }
                }
            }

            return(View(saldos));
        }
示例#29
0
        public ActionResult DetalleAyudaEconomicaDocumentos(
            int id,
            bool exp = false,
            string f = null)
        {
            var items = ServicioCliente.ObtenerDetalleAyudaEconomicaDocumentos(id).ToList();

            if (exp)
            {
                switch (f)
                {
                case Formato.ARCHIVO_FORMATO_PDF:
                    return(ReportesPdfHelper.GenerarReporteDetalleAyudaEconomicaDocumentosPdfFileResult(items));

                case Formato.ARCHIVO_FORMATO_EXCEL:
                default:
                    return(ReportesExcelHelper.GenerarActionResultExcelDetalleAyudaEconomicaDocumentos(items));
                }
            }
            else
            {
                return(View(items));
            }
        }
 public ClientesController(Context contexto) : base(contexto)
 {
     this._servicio = new ServicioCliente(this._contexto, this._logger);
 }