public void SetEvents(IDbConnection Db, IRequest request, long userId, List <GXEventsItem> events) #endif { //If proxy is used. string add = request.Headers[HttpHeaders.XForwardedFor]; //Get IP Address. if (add == null) { add = request.UserHostAddress; } lock (Sessions) { foreach (GXEventsItem e in events) { if (userId != 0) { lock (Db) { GXAmiUserActionLog a = new GXAmiUserActionLog(userId, e.Target, e.Action, add); Db.Insert(a); } } if (e.Target == ActionTargets.User) { HandleUser(e.Data as GXAmiUser, e); } else if (e.Target == ActionTargets.UserGroup) { HandleUserGroup(Db, e.Data as GXAmiUserGroup, e); } else if (e.Target == ActionTargets.Device) { HandleDevice(Db, (e.Data as GXAmiDevice).Id, e); } else if (e.Target == ActionTargets.DeviceGroup) { HandleDeviceGroup(Db, e.Data as GXAmiDeviceGroup, e); } else if (e.Target == ActionTargets.Task) { HandleTasks(Db, e.Data as GXAmiTask, e); } else if (e.Target == ActionTargets.DataCollector) { HandleDataCollectors(Db, (e.Data as GXAmiDataCollector).Guid, e); } else if (e.Target == ActionTargets.ValueChanged) { HandleValueUpdated(Db, e.Data as GXAmiLatestValue, e); } else if (e.Target == ActionTargets.TableValueChanged) { HandleTableValuesUpdated(Db, e.Data as GXAmiDataRow[], e); } else if (e.Target == ActionTargets.DeviceError) { HandleDeviceErrors(Db, e.Data as GXAmiDeviceError, e); } else if (e.Target == ActionTargets.DeviceProfile) { HandleDeviceProfiles(e.Data as GXAmiDeviceProfile, e); } else if (e.Target == ActionTargets.Schedule) { HandleSchedules(e.Data as GXAmiSchedule, e); } else if (e.Target == ActionTargets.Trace) { if (e.Data is GXAmiTrace) { ulong id = (e.Data as GXAmiTrace).DeviceId; if (id == 0) { HandleDataCollectors(Db, (e.Data as GXAmiTrace).DataCollectorGuid, e); } else { HandleDevice(Db, id, e); } } else if (e.Data is GXAmiDataCollector) { HandleDataCollectors(Db, (e.Data as GXAmiDataCollector).Guid, e); } else if (e.Data is GXAmiDevice) { HandleDevice(Db, (e.Data as GXAmiDevice).Id, e); } } else { System.Diagnostics.Trace.Assert(false); } } } }
public GXActionResponse(GXAmiUserActionLog[] actions) { this.Actions = actions; }