Beispiel #1
0
        public string CheckIn(string computerMac)
        {
            var checkIn = new Services.Client.CheckIn();

            var computer = BLL.Computer.GetComputerFromMac(computerMac);

            if (computer == null)
            {
                checkIn.Result  = "false";
                checkIn.Message = "This Computer Was Not Found";
                return(JsonConvert.SerializeObject(checkIn));
            }

            var computerTask = BLL.ActiveImagingTask.GetTask(computer.Id);

            if (computerTask == null)
            {
                checkIn.Result  = "false";
                checkIn.Message = "An Active Task Was Not Found For This Computer";
                return(JsonConvert.SerializeObject(checkIn));
            }

            computerTask.Status = "1";
            if (BLL.ActiveImagingTask.UpdateActiveImagingTask(computerTask))
            {
                checkIn.Result        = "true";
                checkIn.TaskArguments = computerTask.Arguments;
                var image = BLL.Image.GetImage(computer.ImageId);
                if (image != null)
                {
                    if (image.Environment == "")
                    {
                        image.Environment = "linux";
                    }
                    checkIn.ImageEnvironment = image.Environment;
                }

                checkIn.TaskType = computerTask.Type;
                return(JsonConvert.SerializeObject(checkIn));
            }
            else
            {
                checkIn.Result  = "false";
                checkIn.Message = "Could Not Update Task Status";
                return(JsonConvert.SerializeObject(checkIn));
            }
        }
Beispiel #2
0
        public string CheckIn(string computerMac)
        {
            var checkIn = new Services.Client.CheckIn();

            var computer = BLL.Computer.GetComputerFromMac(computerMac);
            if (computer == null)
            {
                checkIn.Result = "false";
                checkIn.Message = "This Computer Was Not Found";
                return JsonConvert.SerializeObject(checkIn);
            }

            var computerTask = BLL.ActiveImagingTask.GetTask(computer.Id);
            if (computerTask == null)
            {
                checkIn.Result = "false";
                checkIn.Message = "An Active Task Was Not Found For This Computer";
                return JsonConvert.SerializeObject(checkIn);
            }

            computerTask.Status = "1";
            if (BLL.ActiveImagingTask.UpdateActiveImagingTask(computerTask))
            {
                checkIn.Result = "true";
                checkIn.TaskArguments = computerTask.Arguments;
                return JsonConvert.SerializeObject(checkIn);
            }
            else
            {
                checkIn.Result = "false";
                checkIn.Message = "Could Not Update Task Status";
                return JsonConvert.SerializeObject(checkIn);
            }


        }