public BusinessLayer.UserDevice AddUserDevice(String at, string deviceType, int deviceMemoryResource, int deviceProcRating, String gcmCode = "") { AuthenticationToken oAt = new AuthSvc().AuthUser(at); return(BusinessLayer.UserDevice.AddUserDevice(oAt.Username, deviceType, deviceMemoryResource, deviceProcRating, gcmCode)); }
public void MarkDeviceActive(string at, int deviceId) { try { AuthenticationToken oAt = new AuthSvc().AuthUser(at, -1, deviceId); } catch (Exception e) { String ex = e.Message; } }
public void MarkDeviceActive(string at, int deviceId) { try { AuthenticationToken oAt = new AuthSvc().AuthUser(at, -1, deviceId); } catch(Exception e) { String ex = e.Message; } }
public List <BusinessLayer.CommunicationPackage> GetOutstandingCommunications(String at, int deviceId) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at, -1, deviceId); BusinessLayer.ActiveDevice ad = BusinessLayer.ActiveDevice.Populate(deviceId); ad.LastFetch = DateTime.Now; ad.Save(); return(BusinessLayer.CommunicationPackage.GetTargetDeviceCommunications(deviceId)); }
public List<BusinessLayer.CommunicationPackage> GetOutstandingCommunications(String at, int deviceId) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at,-1,deviceId); BusinessLayer.ActiveDevice ad = BusinessLayer.ActiveDevice.Populate(deviceId); ad.LastFetch = DateTime.Now; ad.Save(); return BusinessLayer.CommunicationPackage.GetTargetDeviceCommunications(deviceId); }
public void SubmitWorkOrderResult(string at, int workOrderId, String resultJson, DateTime compuatationStartTime, DateTime computationEndTime, decimal?resultSerialisationTime = null, decimal?requestDeserialisationTime = null) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at); BusinessLayer.WorkOrder wo = BusinessLayer.WorkOrder.Populate(workOrderId); //if (wo.SlaveWorkerId != oAt.DeviceId) // throw new Exception("Cannot modify Work Order which you are not meant to be working on."); CloudQueues.UpdatedWorkOrderQueueClient.Send(new BrokeredMessage(new SharedClasses.WorkOrderUpdate(workOrderId, SharedClasses.WorkOrderUpdate.UpdateType.SubmitResult, oAt.DeviceId, compuatationStartTime, computationEndTime, resultJson, requestDeserialisationTime, resultSerialisationTime))); }
public void DeleteUserDevice(String at, int deviceId) { BusinessLayer.UserDevice ud = BusinessLayer.UserDevice.Populate(deviceId); AuthenticationToken oAt = new AuthSvc().AuthUser(at, ud.User.UserId); if (ud.User.Username.Equals(oAt.Username)) { ud.Delete(); } }
public void AcknowledgeCommunication(String at, int communicationId, DateTime recieveTime) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at); BusinessLayer.CommunicationPackage cp = BusinessLayer.CommunicationPackage.Populate(communicationId); cp.DateAcknowledged = recieveTime; cp.Response = "ACK"; cp.Save(); }
public void CancelWorkOrder(String at, List<int> localDeviceIdList) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at); foreach (int localDeviceId in localDeviceIdList) { BusinessLayer.WorkOrder wo = BusinessLayer.WorkOrder.PopulateLocalDeviceId(localDeviceId, oAt.DeviceId); CloudQueues.UpdatedWorkOrderQueueClient.Send(new BrokeredMessage(new SharedClasses.WorkOrderUpdate(wo.WorkOrderId, SharedClasses.WorkOrderUpdate.UpdateType.Cancel, oAt.DeviceId, null, null, null, null, null))); } }
public void CancelWorkOrder(String at, List <int> localDeviceIdList) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at); foreach (int localDeviceId in localDeviceIdList) { BusinessLayer.WorkOrder wo = BusinessLayer.WorkOrder.PopulateLocalDeviceId(localDeviceId, oAt.DeviceId); CloudQueues.UpdatedWorkOrderQueueClient.Send(new BrokeredMessage(new SharedClasses.WorkOrderUpdate(wo.WorkOrderId, SharedClasses.WorkOrderUpdate.UpdateType.Cancel, oAt.DeviceId, null, null, null, null, null))); } }
public void MarkDeviceInactive(string at, int deviceId) { AuthenticationToken oAt = new AuthSvc().AuthUser(at, -1, deviceId); try { ActiveDevice ad = ActiveDevice.Populate(deviceId); ad.Delete(); //TODO: Re-assign work orders } catch { } }
public int GetDeviceId(String at, String gcmId) { AuthenticationToken oAt = new AuthSvc().AuthUser(at); BusinessLayer.UserDevice ud = BusinessLayer.UserDevice.Populate(gcmId); if (BusinessLayer.User.Populate(oAt.Username).UserId != ud.User.UserId) { throw new Exception("Error: Device is not tied to authenticating in user"); } return ud.DeviceId; }
public void AcknowledgeWorkOrder(String at, int workOrderId) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at); BusinessLayer.WorkOrder wo = BusinessLayer.WorkOrder.Populate(workOrderId); //TODO: Fix this auth issue //if (wo.SlaveWorkerId != oAt.DeviceId) // throw new Exception("Cannot modify Work Order which you are not meant to be working on."); CloudQueues.UpdatedWorkOrderQueueClient.Send(new BrokeredMessage(new SharedClasses.WorkOrderUpdate(workOrderId, SharedClasses.WorkOrderUpdate.UpdateType.Acknowledge, oAt.DeviceId, null, null))); }
public void MarkWorkOrderInComputation(string at, int workOrderId) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at); BusinessLayer.WorkOrder wo = BusinessLayer.WorkOrder.Populate(workOrderId); if (wo.SlaveWorkerId != oAt.DeviceId) { throw new Exception("Cannot modify Work Order which you are not meant to be working on."); } CloudQueues.UpdatedWorkOrderQueueClient.Send(new BrokeredMessage(new SharedClasses.WorkOrderUpdate(workOrderId, SharedClasses.WorkOrderUpdate.UpdateType.MarkBeingComputed, oAt.DeviceId, null, null))); }
public int GetDeviceId(String at, String gcmId) { AuthenticationToken oAt = new AuthSvc().AuthUser(at); BusinessLayer.UserDevice ud = BusinessLayer.UserDevice.Populate(gcmId); if (BusinessLayer.User.Populate(oAt.Username).UserId != ud.User.UserId) { throw new Exception("Error: Device is not tied to authenticating in user"); } return(ud.DeviceId); }
public void ModifyUser(String at, int userId, string forename, string surname, string password) { AuthenticationToken oAt = new AuthSvc().AuthUser(at, userId); BusinessLayer.User u = BusinessLayer.User.Populate(userId); u.Forename = forename; u.Password = password; u.Surname = surname; u.Save(); }
public BusinessLayer.UserDevice AddUserDevice(String at, string deviceType, int deviceMemoryResource, int deviceProcRating, String gcmCode = "") { AuthenticationToken oAt = new AuthSvc().AuthUser(at); return BusinessLayer.UserDevice.AddUserDevice(oAt.Username, deviceType, deviceMemoryResource, deviceProcRating, gcmCode); }
public void SubmitWorkOrderResult(string at, int workOrderId, String resultJson, DateTime compuatationStartTime, DateTime computationEndTime, decimal? resultSerialisationTime = null, decimal? requestDeserialisationTime = null) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at); BusinessLayer.WorkOrder wo = BusinessLayer.WorkOrder.Populate(workOrderId); //if (wo.SlaveWorkerId != oAt.DeviceId) // throw new Exception("Cannot modify Work Order which you are not meant to be working on."); CloudQueues.UpdatedWorkOrderQueueClient.Send(new BrokeredMessage(new SharedClasses.WorkOrderUpdate(workOrderId, SharedClasses.WorkOrderUpdate.UpdateType.SubmitResult, oAt.DeviceId, compuatationStartTime, computationEndTime, resultJson, requestDeserialisationTime, resultSerialisationTime))); }
public void MarkWorkOrderInComputation(string at, int workOrderId) { BusinessLayer.AuthenticationToken oAt = new AuthSvc().AuthUser(at); BusinessLayer.WorkOrder wo = BusinessLayer.WorkOrder.Populate(workOrderId); if (wo.SlaveWorkerId != oAt.DeviceId) throw new Exception("Cannot modify Work Order which you are not meant to be working on."); CloudQueues.UpdatedWorkOrderQueueClient.Send(new BrokeredMessage(new SharedClasses.WorkOrderUpdate(workOrderId, SharedClasses.WorkOrderUpdate.UpdateType.MarkBeingComputed, oAt.DeviceId, null, null))); }