public DevelopmentManager(IEventManager eventManager, IPluginManager pluginManager) { // Create the logged in user's specific instance of the user manager proxy. // The actual implementation class could be changed in configuration // or using dependency injection (if we want to implement that)... _eventManager = eventManager; _pluginManager = pluginManager; _commonManagerProxy = new CommonManagerProxy(this); }
public int SaveIncident(CommonManagerProxy proxy, IncidentsDao request) { try { using (ITransaction tx = proxy.DevelopmentManager.GetTransaction()) { tx.PersistenceManager.UserRepository.Save(request); tx.Commit(); return(request.Id); } } catch (Exception ex) { LogError(proxy, ex); return(0); } }
public bool LogError(CommonManagerProxy proxy, Exception ex) { try { ErrorDao errDao = new ErrorDao { DateCreated = DateTime.Now, StackTrace = ex.StackTrace, Message = ex.Message }; SaveError(proxy, errDao); return(true); } catch { return(false); } }
public bool SaveError(CommonManagerProxy proxy, ErrorDao error) { try { using (ITransaction tx = proxy.DevelopmentManager.GetTransaction()) { tx.PersistenceManager.UserRepository.Save(error); tx.Commit(); } return(true); } catch (DBConcurrencyException ex) { return(false); } catch (Exception ex) { return(false); } }
public IncidentsDao GetIncidentDetails(CommonManagerProxy proxy, int incidentID, int rescuerID) { try { using (ITransaction tx = proxy.DevelopmentManager.GetTransaction()) { var incident = tx.PersistenceManager.UserRepository.Get <IncidentsDao>(incidentID); var updateUser = tx.PersistenceManager.UserRepository .GetAll <IncidentsRescueMappingsDao>() .First(i => i.RescuerID == rescuerID); updateUser.IsRead = true; tx.PersistenceManager.UserRepository.Save <IncidentsRescueMappingsDao>(updateUser); tx.Commit(); return(incident); } } catch (Exception ex) { LogError(proxy, ex); return(null); } }
// #endregion public bool SaveIncidentsRescueMappings(CommonManagerProxy proxy, int incidentId) { try { var list = new List <IncidentsRescueMappingsDao>(); using (ITransaction tx = proxy.DevelopmentManager.GetTransaction()) { var listOfRescuer = tx.PersistenceManager.UserRepository.GetAll <UserMasterDao>().Where(u => u.Category == 1); foreach (var person in listOfRescuer) { var request = new IncidentsRescueMappingsDao { IncidentID = incidentId, IsMissionComplete = false, IsRead = false, NeededAssistance = false, RescuerID = person.Id, DateCreated = DateTime.Now }; list.Add(request); tx.PersistenceManager.UserRepository.Save(request); } //if (list.Count > 0) //{ // tx.PersistenceManager.UserRepository.Save(list); //} tx.Commit(); return(true); } } catch (Exception ex) { LogError(proxy, ex); return(false); } }