コード例 #1
0
        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));
        }
コード例 #2
0
 public void MarkDeviceActive(string at, int deviceId)
 {
     try {
         AuthenticationToken oAt = new AuthSvc().AuthUser(at, -1, deviceId);
     } catch (Exception e) {
         String ex = e.Message;
     }
 }
コード例 #3
0
ファイル: UserSvc.svc.cs プロジェクト: mmfraser/dissertation
 public void MarkDeviceActive(string at, int deviceId)
 {
     try {
         AuthenticationToken oAt = new AuthSvc().AuthUser(at, -1, deviceId);
     } catch(Exception e) {
         String ex = e.Message;
     }
 }
コード例 #4
0
        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));
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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)));
        }
コード例 #7
0
ファイル: UserSvc.svc.cs プロジェクト: mmfraser/dissertation
        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();
            }
        }
コード例 #8
0
        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();
        }
コード例 #9
0
        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)));
            }
        }
コード例 #10
0
        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();
        }
コード例 #11
0
        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();
            }
        }
コード例 #12
0
        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)));
            }
        }
コード例 #13
0
        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 {
            }
        }
コード例 #14
0
ファイル: UserSvc.svc.cs プロジェクト: mmfraser/dissertation
        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;
        }
コード例 #15
0
        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)));
        }
コード例 #16
0
        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)));
        }
コード例 #17
0
        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);
        }
コード例 #18
0
ファイル: UserSvc.svc.cs プロジェクト: mmfraser/dissertation
        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();
        }
コード例 #19
0
ファイル: UserSvc.svc.cs プロジェクト: mmfraser/dissertation
        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 {

            }
        }
コード例 #20
0
        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();
        }
コード例 #21
0
        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)));
        }
コード例 #22
0
ファイル: UserSvc.svc.cs プロジェクト: mmfraser/dissertation
        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);
        }
コード例 #23
0
        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)));
        }
コード例 #24
0
        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)));
        }