Ejemplo n.º 1
0
        public ActionResult Create(ClienteViewModels model)
        {
            if (ModelState.IsValid)
            {
                cliente.Nombre          = model.Nombre;
                cliente.Apellido        = model.Apellido;
                cliente.Dpi             = Convert.ToInt64(model.Dpi);
                cliente.Genero          = model.Genero;
                cliente.Direccion       = model.Direccion;
                cliente.FechaNacimiento = model.FechaNacimiento;

                //Seleccionamos el estad cliente que sea 'ACTIVO' y luego lo agregamos a FK EstadoClienteId
                EstadoCliente estado = dbCtx.EstadoCliente.FirstOrDefault(e => e.NombreEstado == "Activo");
                cliente.EstadoClienteId = estado.Id;

                dbCtx.Cliente.Add(cliente);
                dbCtx.SaveChanges();

                //int ClienteId = cliente.Id;

                TelefonoCliente telefono = new TelefonoCliente();
                telefono.NumeroTelefono     = model.NumeroTelefono;
                telefono.CompaniaTelefonoId = model.CompaniaTelefonoId;
                telefono.ClienteId          = cliente.Id;

                dbCtx.TelefonoCliente.Add(telefono);
                dbCtx.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
        public string ValidarSiElEstadoExiste(EstadoCliente estadoCliente)
        {
            if (estadoCliente == null)
            {
                return("El estado seleccionado no existe");
            }

            return(string.Empty);
        }
Ejemplo n.º 3
0
 public static EstadoClienteDTO DeModeloADTO(EstadoCliente estadoCliente)
 {
     return(estadoCliente != null ? new EstadoClienteDTO
     {
         Id = estadoCliente.Id,
         Descripcion = estadoCliente.Descripcion,
         Estado = estadoCliente.Estado
     } : null);
 }
        private EstadoCliente MappingEstadoCliente(DataRow row)
        {
            EstadoCliente oEstadoCliente = new EstadoCliente
            {
                ID_EstadoC  = Convert.ToInt32(row["id_estadoc"].ToString()),
                Descripcion = row["descripcion"].ToString()
            };

            return(oEstadoCliente);
        }
Ejemplo n.º 5
0
 public EstadoCliente GetEstadoCliente(int idEstadoCliente)
 {
     using (DBEntities_TP db = new DBEntities_TP())
     {
         EstadoCliente estadoCliente = new EstadoCliente();
         estadoCliente = db.EstadoClientes.Find(idEstadoCliente);
         return(estadoCliente);
     }
     ;
 }
Ejemplo n.º 6
0
        public ActionResult Edit(EstadoClienteViewModels model)
        {
            if (ModelState.IsValid)
            {
                EstadoCliente = dbCtx.EstadoCliente.FirstOrDefault(a => a.Id == model.Id);
                EstadoCliente.NombreEstado = model.NombreEstado;
                dbCtx.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 7
0
        public ActionResult Edit(int id)
        {
            ViewBag.Title = "Editar Estado";

            EstadoClienteViewModels estado = new EstadoClienteViewModels();

            EstadoCliente       = dbCtx.EstadoCliente.FirstOrDefault(a => a.Id == id);
            estado.Id           = EstadoCliente.Id;
            estado.NombreEstado = EstadoCliente.NombreEstado;

            return(View(estado));
        }
Ejemplo n.º 8
0
 internal void LoginFail(object sender, byte reason)
 {
     if (Estado == EstadoCliente.TRY_ONLINE)
     {
         T.INFO("NETWORK: ERROR {0} fuerza volver a TIME_WAIT.", reason);
         Estado = EstadoCliente.NETWORK_FAILURE;
     }
     if (Estado == EstadoCliente.ONLINE)
     {
         Estado = EstadoCliente.NETWORK_FAILURE;
     }
 }
Ejemplo n.º 9
0
        public static string GetEstadoCliente(EstadoCliente estado)
        {
            switch (estado)
            {
                case EstadoCliente.Certificacion:
                    return "Certificación";
                case EstadoCliente.Deshabilitado:
                    return "Deshabilitado";
                case EstadoCliente.Habilitado:
                    return "Habilitado";
            }

            return "NONE";
        }
        public ActionResult Post([FromBody] EstadoCliente estadoCliente)
        {
            // si el modelo es inválido o es null, regresa 400
            if (!this.ModelState.IsValid || estadoCliente == null)
            {
                return(BadRequest());
            }
            else
            {
                Datos.datosEstadoCliente = estadoCliente;

                //TODO calidar aquí
                return(Ok(Datos.datosEstadoCliente));
            }
        }
Ejemplo n.º 11
0
 internal void LoginSuccess(object sender, short idDisp)
 {
     if (Estado == EstadoCliente.TRY_ONLINE)
     {
         CoreDLL.Beep(4);
         T.INFO("NETWORK: Estamos ONLINE...");
         Estado = EstadoCliente.ONLINE;
         clientTU.IdDispositivo = IdDispositivo = idDisp;
         if (queued_fix != null)
         {
             T.TRACE("FIX - envaindo punto encolado");
             Fix(queued_fix);
         }
     }
 }
Ejemplo n.º 12
0
        public void CambiarEstadoCliente(int idcliente, decimal nroSiniestros)
        {
            EstadoCliente estadoCliente = new EstadoCliente();
            DAOCliente    dAOCliente    = new DAOCliente();

            int cuotasImpagas = getCuotasImpagas(idcliente);

            bool esClienteActivo = ClienteActivo(idcliente);

            if (esClienteActivo && nroSiniestros == 0 && cuotasImpagas == 0)
            {
                estadoCliente = dAOCliente.GetEstadoCliente(2);// "Plata");
            }
            else
            {
                estadoCliente = dAOCliente.GetEstadoCliente(1);// "Normal");
            }
            dAOCliente.SetEstadoCliente(idcliente, estadoCliente.id);
        }
Ejemplo n.º 13
0
        internal void StartTryingLogin()
        {
            // si no hay transporte, esperamos.
            if (transporteUDP == null || destination == null)
            {
                return;
            }

            if (Estado == EstadoCliente.TIME_WAIT)
            {
                T.INFO("NETWORK: Intentando pasar a ONLINE...");

                Estado = EstadoCliente.TRY_ONLINE;
                clientTU.LoginSuccess += LoginSuccess;
                clientTU.LoginFail    += LoginFail;
                clientTU.LoginRequest(transporteUDP, destination, IMEI, Password, TableVersion, "eyemobile_v1.0");
                LoginAttemps++;
                //saliente.RehabilitarEventos();
            }
        }
Ejemplo n.º 14
0
        internal void TickONLINE()
        {
            if (keepalive_wd-- <= 0)
            {
                T.TRACE("COMM: Enviando KeepAlive.");
                clientTU.KeepAlive(transporteUDP, destination);
                keepalive_wd = keepalive_wd_reset;
            }
            // si no hay transporte, esperamos.
            if (transporteUDP == null || destination == null)
            {
                Estado = EstadoCliente.NETWORK_FAILURE;
                return;
            }
            if (sending_files)
            {
                return;
            }
            try
            {
                var label = "";

                /*var array = saliente.Peek(ref label);
                 * if (array == null) return;
                 * if (FileClient.SendMessage(destination.UIQ, IdDispositivo, array, label))
                 * {
                 *  saliente.Pop(ref label);
                 * }*/
            }
            catch (Base64MessageQueue.EmptyMessageQueueException)
            {
                return;
            }
            catch (Exception e)
            {
                T.EXCEPTION(e, "TickONLINE");
            }
        }
Ejemplo n.º 15
0
 internal void AutoReportFail(object sender, int qid)
 {
     T.ERROR("Autoreporte fallo! reinicio cliente torino.");
     Estado = EstadoCliente.NETWORK_FAILURE;
 }
Ejemplo n.º 16
0
 private void GeneralFail(object sender)
 {
     T.ERROR("Keepalive fallo! reinicio cliente torino.");
     Estado = EstadoCliente.NETWORK_FAILURE;
 }
Ejemplo n.º 17
0
 public EstadoClienteController()
 {
     dbCtx         = new ApplicationDbContext();
     EstadoCliente = new EstadoCliente();
 }
Ejemplo n.º 18
0
        public static IEstadoCliente GetEstadoCliente()
        {
            EstadoCliente estadoCliente = new EstadoCliente();

            return((IEstadoCliente)estadoCliente);
        }
Ejemplo n.º 19
0
 public void NetworkReady()
 {
     T.NOTICE("NETWORK READY");
     Estado = EstadoCliente.TIME_WAIT;
 }
Ejemplo n.º 20
0
 public void NetworkFailure()
 {
     T.NOTICE("NETWORK FAILURE");
     Estado = EstadoCliente.NETWORK_FAILURE;
 }
Ejemplo n.º 21
0
 public static Cliente DeDTOAModelo(ClienteDTO clienteDTO, EstadoCliente estadoCliente)
 {
     return(clienteDTO != null ? new Cliente.Builder(clienteDTO.Nombre, clienteDTO.Apellido, clienteDTO.Edad, clienteDTO.IdEstadoCliente, estadoCliente.Estado, clienteDTO.Identidad).conEstadoCliente(estadoCliente).Constuir() : null);
 }
Ejemplo n.º 22
0
        public static List<ClienteFranquicia> GetClientesPorFranquicia(int idFranquicia, EstadoCliente estado)
        {
            var repo = new ClienteRepository();

            var clients = repo.Filtrar(c => c.FranquiciaId == idFranquicia && c.EstadoCliente == estado);

            var clientes = new List<ClienteFranquicia>();

            foreach (var client in clients)
            {
                clientes.Add(new Entidades.ViewModels.ClienteFranquicia()
                {
                    Id = client.Id,
                    Nombre = client.Nombre,
                    NombreFantasia = client.NombreFantasia,
                    Rut = $"{client.Rut}-{client.DV}",
                    Estado = Util.Estados.EstadosUtil.GetEstadoCliente(client.EstadoCliente),
                    Logo = String.Empty

                });
            }

            return clientes;
        }
Ejemplo n.º 23
0
 public ClienteMobile()
 {
     estado        = EstadoCliente.NETWORK_FAILURE;
     tickTimer     = new Timer(Tick, null, 0, 5000);
     sending_files = false;
 }