protected override void DataPortal_Execute() { // Buscar por codigo CriteriaEx criteria = PlantillaExamen.GetCriteria(PlantillaExamen.OpenSession()); criteria.AddCodeSearch(_codigo); PlantillaExamenList list = PlantillaExamenList.GetList(criteria); _exists = !(list.Count == 0); }
/// <summary> /// Devuelve el siguiente Serial de PlantillaExamen. /// </summary> /// <returns>Código de 9 cifras</returns> private static Int64 GetNewSerial() { // Obtenemos la lista de clientes ordenados por serial SortedBindingList <PlantillaExamenInfo> plantillas = PlantillaExamenList.GetSortedList("Serial", ListSortDirection.Ascending); // Obtenemos el último serial de servicio Int64 lastcode; if (plantillas.Count > 0) { lastcode = plantillas[plantillas.Count - 1].Serial; } else { lastcode = Convert.ToInt64(Resources.Defaults.PLANTILLA_CODE_FORMAT); } lastcode++; return(lastcode); }