コード例 #1
0
        public static bool Exists(string type, long oid, out long agente_oid, out long entity_type_oid)
        {
            AgenteList  lista     = AgenteList.GetList(false);
            EntidadList ent_lista = EntidadList.GetList(false);
            long        ent_oid   = -1;

            agente_oid      = -1;
            entity_type_oid = -1;

            foreach (EntidadInfo e in ent_lista)
            {
                if (e.Tipo.Equals(type))
                {
                    ent_oid = e.Oid;
                }
            }

            if (ent_oid == -1)
            {
                return(false);
            }

            entity_type_oid = ent_oid;

            foreach (AgenteInfo a in lista)
            {
                if (a.Codigo.Equals("GD#" + ent_oid.ToString() + oid.ToString()))
                {
                    agente_oid = a.Oid;
                    return(true);
                }
            }

            return(false);
        }
コード例 #2
0
        /// <summary>
        /// Devuelve el siguiente Serial de Agente
        /// </summary>
        /// <returns></returns>
        private static Int64 GetNewSerial()
        {
            // Obtenemos la lista de clientes ordenados por serial
            SortedBindingList <AgenteInfo> Agentes =
                AgenteList.GetSortedList("Serial", ListSortDirection.Ascending);

            // Obtenemos el último serial de servicio
            Int64 lastcode;

            if (Agentes.Count > 0)
            {
                lastcode = Agentes[Agentes.Count - 1].Serial;
            }
            else
            {
                lastcode = 0;
            }

            lastcode++;
            return(lastcode);
        }