AddEquipment() public method

public AddEquipment ( Equipment equipment ) : void
equipment Equipment
return void
Exemplo n.º 1
0
        private void mapChildren(Task task,TaskViewModel model)
        {
            task.ClearEmployees();
            task.ClearEquipment();
            if(model.EmployeeInput.IsNotEmpty())
                model.EmployeeInput.Split(',').Each(x => task.AddEmployee(_repository.Find<Employee>(Int32.Parse(x))));
            if(model.EquipmentInput.IsNotEmpty())
                model.EquipmentInput.Split(',').Each(x => task.AddEquipment(_repository.Find<Equipment>(Int32.Parse(x))));

            task.TaskType = _repository.Find<TaskType>(model.Task.TaskType.EntityId);
            task.Field = _repository.Find<Field>(model.Task.Field.EntityId);
            if (model.Product.IsNotEmpty())
            {
                var product = model.Product.Split('_');
                task.InventoryProduct= _repository.Find<InventoryProduct>(Int64.Parse(product[0]));
            }else
            {
                task.InventoryProduct = null;
            }
        }
Exemplo n.º 2
0
        private void CreateTask()
        {
            var taskType1 = new TaskType
            {
                Name = "Mow"
            };
            var taskType2 = new TaskType
            {
                Name = "Water"
            };
            _repository.Save(taskType1);
            _repository.Save(taskType2);
            _task1 = new Task
            {
                TaskType = taskType1,
                Field = _field1,
                ScheduledDate = DateTime.Parse("3/3/2011"),
                ScheduledStartTime = DateTime.Parse("3/3/2011 5:30 AM"),
                ScheduledEndTime = DateTime.Parse("3/3/2011 6:30 AM"),
                Notes = "Notes1",
                InventoryProduct = _invenotyMaterial1,
                QuantityNeeded = 4,
                UnitType = UnitType.Tons.ToString()
            };

            _task2 = new Task
            {
                TaskType = taskType2,
                Field=_field2,
                ScheduledDate = DateTime.Parse("3/3/2011"),
                ScheduledStartTime = DateTime.Parse("3/3/2011 6:30 AM"),
                ScheduledEndTime = DateTime.Parse("3/3/2011 7:30 AM"),
                Notes = "Notes2",
                InventoryProduct = _inventoryChemical2,
                QuantityNeeded = 4,
                UnitType = UnitType.Tons.ToString()
            };
            _task1.AddEmployee(_employee1);
            _task1.AddEmployee(_employee2);
            _task1.AddEquipment(_equip1);
            _task1.AddEquipment(_equip2);
            _task2.AddEmployee(_employee1);
            _task2.AddEmployee(_employee2);
            _task2.AddEquipment(_equip1);
            _task2.AddEquipment(_equip2);

            _repository.Save(_task1);
            _repository.Save(_task2);
        }