public void Create(Terminal terminal) { try { if (!String.IsNullOrEmpty(terminal.Name) && terminal.Location != null) { if (terminal.Location.IdLocation > 0) { LocCRUD.Update(terminal.Location); } else { LocCRUD.Create(terminal.Location); terminal.Location = LocCRUD.RetrieveLast <Location>(); } CrudFactory.Create(terminal); } else { // Both Terminal Name and Location are required. throw new BusinessException(22); } } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } }
public void Update(Location location) { Location be = null; try { be = CrudFactory.Retrieve <Location>(location); if (be != null) { if (!String.IsNullOrEmpty(location.Name)) { CrudFactory.Update(location); var valueList = new ValueListSelect { IdList = "Location", Value = location.IdLocation.ToString(), Description = location.Name }; VLCrud.Update(valueList); } else { // Location Name is required. throw new BusinessException(24); } } else { // Location Not Found. throw new BusinessException(23); } } catch (Exception ex) { ExceptionManager.GetInstance().Process(ex); } }