//constructor public AdministratorService() { _log = new Logger("AdministratorService()"); _log.Trace("Init"); _userlog = new Logger( true, "Administrators data is changed"); }
public ContactService() { _log = new Logger("ContactService()"); _log.Trace("Init"); _userlog = new Logger(true, "Contacts data is changed"); }
public BookingService() { _log = new Logger("BookingService()"); _log.Trace("Init"); _userlog = new Logger(true, "Bookings data is changed"); }
public CustomerService() { _log = new Logger("CustomerService()"); _log.Trace("Init"); _userlog = new Logger(true, "Customers data is changed"); }
public RoomService() { _log = new Logger("RoomService()"); _log.Trace("Init"); _userlog = new Logger(true, "Rooms data is changed"); }
public static void DispatchData(IDataProducer producer, object data, bool cloneDataOnFork, DispatchPolicy dispatchPolicy, Set<IDataConsumer> dataConsumers, Logger logger) { if (data == null) { return; } if (dataConsumers.Count == 0) { if (logger != null) { logger.Warn("DispatchData", "Data ready but nobody is listening."); } return; } if (dispatchPolicy == DispatchPolicy.BalanceLoadSum || dispatchPolicy == DispatchPolicy.BalanceLoadMax) { if (logger != null) { logger.Trace("DispatchData", "Dispatching data of type {0} (load balancing) ...", data.GetType()); } int minLoad = int.MaxValue; IDataConsumer target = null; foreach (IDataConsumer consumer in dataConsumers) { int load = (dispatchPolicy == DispatchPolicy.BalanceLoadSum) ? GetBranchLoadSum(consumer) : GetBranchLoadMax(consumer); if (load < minLoad) { minLoad = load; target = consumer; } } target.ReceiveData(producer, data); } else if (dispatchPolicy == DispatchPolicy.Random) { if (logger != null) { logger.Trace("DispatchData", "Dispatching data of type {0} (random policy) ...", data.GetType()); } ArrayList<IDataConsumer> tmp = new ArrayList<IDataConsumer>(dataConsumers.Count); foreach (IDataConsumer dataConsumer in dataConsumers) { tmp.Add(dataConsumer); } tmp[mRandom.Next(0, tmp.Count)].ReceiveData(producer, data); } else { if (logger != null) { logger.Trace("DispatchData", "Dispatching data of type {0} (to-all policy) ...", data.GetType()); } if (dataConsumers.Count > 1 && cloneDataOnFork) { foreach (IDataConsumer dataConsumer in dataConsumers) { dataConsumer.ReceiveData(producer, Utils.Clone(data, /*deepClone=*/true)); } } else { foreach (IDataConsumer dataConsumer in dataConsumers) { dataConsumer.ReceiveData(producer, data); } } } if (logger != null) { logger.Trace("DispatchData", "Data dispatched."); } }
public ContactTypeService() { _log = new Logger("ContactTypeService()"); _log.Trace("Init"); _userlog = new Logger(true, "ContactType updated"); }