Esempio n. 1
0
 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 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);
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
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);
     }
 }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
        //


        #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);
            }
        }