public List <Course> getCoursesByUserId(Guid id)
        {
            var results = COURSES.ToList();

            results.Where(x => x.Professors.Contains(id));
            if (results.Count == 0)
            {
                return(null);
            }
            return(results);
        }
        public bool addCourse(Course c)
        {
            var courses = COURSES.Where(x => x.id == c.id).ToList();

            if (courses.Count != 0)
            {
                return(false);
            }
            COURSES.Add(c);
            var result = SaveChanges();

            return(result == 1);
        }
Ejemplo n.º 3
0
        public CourseClass(COURSES co)
        {
            id      = co.COURSE_ID;
            subject = new SubjectClass(co.SUBJECT_ID);
            if (co.IS_MANUALLY == 0)
            {
                teacher = new UserPublicInfoClass(co.TEACHERS.USERS);
            }
            _class        = new ClassClass(co.CLASSES);
            order_in_week = co.ORDER_IN_WEEK;
            Day d = (Day)co.DAY_OF_THE_WEEK - 1;

            day = d.ToString();
        }
    // Use this for initialization
    void Start()
    {
        //Die Kameras im System finden und den Objekten zuweisen
        _cameraBack = GameObject.Find ("CameraBack").GetComponent<Camera> ();
        _cameraFront = GameObject.Find ("CameraFront").GetComponent<Camera> ();
        _cameraTop = GameObject.Find ("CameraTop").GetComponent<Camera> ();
        _cameraView01 = GameObject.Find ("Camera01").GetComponent<Camera> ();
        _goCamera = GameObject.Find("Camera01");
        _cameraStream = (CameraStream) _goCamera.GetComponent(typeof(CameraStream));

        //Die Strecken im System finden und den Objekten zuweisen
        _courseLabor = GameObject.Find ("CourseLabor");
        _courseCup2014 = GameObject.Find ("CourseCup2014");
        _courseCup2014Parking01 = GameObject.Find ("CourseCup2014Parking01");
        _courseCup2014Obstacles01 = GameObject.Find ("CourseCup2014Obstacles01");
        _courseStraight50Metres = GameObject.Find ("CoruseStraight50Metres");
        _currentCourse = COURSES.COURSE_LABOR;
        _courseCup2014.SetActive(false);
        _courseCup2014Parking01.SetActive(false);
        _courseCup2014Obstacles01.SetActive(false);
        _courseStraight50Metres.SetActive(false);

        _tempCar = new GameObject ();
        _car = GameObject.Find("Car");

        //Tires
        _tireFrontLeft = GameObject.Find ("TireFrontLeft");
        _tireFrontRight = GameObject.Find ("TireFrontRight");

        //Axis
        _wheelFrontLeft = GameObject.Find ("WheelFrontLeft");
        _wheelFrontRight = GameObject.Find ("WheelFrontRight");
        _wheelBackLeft = GameObject.Find ("WheelBackLeft");
        //_backAxisMiddle = GameObject.Find ("BackAxis");
        _cubeAxisFront = GameObject.Find ("CubeAxisFront");
        _cubeAxisBack = GameObject.Find ("CubeAxisBack");
        _steeringCutPoint = GameObject.Find("SteeringCutPoint");
        _carRoot = GameObject.Find ("CarRoot");
        //_golf = GameObject.Find ("Golf");
        _posStraighForeward = GameObject.Find ("PosStraighForeward");

        //Lights
        _moveCarLights = 0;
        _lightIndicatorLeft  = GameObject.Find ("LightIndicatorLeft"); _lightIndicatorLeft.SetActive (false);
        _lightIndicatorRight = GameObject.Find ("LightIndicatorRight"); _lightIndicatorRight.SetActive (false);
        _lightDrive = GameObject.Find ("LightDrive"); _lightDrive.SetActive (false);
        _lightBreak = GameObject.Find ("LightBreak");_lightBreak.SetActive (false);
        _lightBackward = GameObject.Find ("LightBackward");_lightBackward.SetActive (false);

        lineRenderer = gameObject.AddComponent<LineRenderer>();
        lineRenderer.SetColors(Color.green, Color.blue);
        lineRenderer.SetWidth(0.2F, 0.2F);
        lineRenderer.transform.Rotate (new Vector3 (90, 0, 0));

        btnStartServer.GetComponentInChildren<Text>().text = "Start Server";

        btnStartServer.onClick.AddListener(() => {
            //handle click here
            if(_server!=null){
                _server.disconnect();
                _server = null;
                btnStartServer.GetComponentInChildren<Text>().text = "Start Server";
            }
            else{
                IPAddress ipaddr = IPAddress.Parse(ipAddressField.text);
                _server = new Server (ipaddr, 4545, 1, dataFromServer);
                btnStartServer.GetComponentInChildren<Text>().text = "Close Server";
            }
        });

        //Setzt das Fahrzeug zurück auf Position 0,0,0
        btnReset.onClick.AddListener(() => {
            //handle click here
            _carRoot.transform.position = new Vector3(0,_carRoot.transform.position.y,0);
            _carRoot.transform.rotation = new Quaternion(0,0,0,0);
        });

        _cameraTop.enabled = false;
        _cameraFront.enabled = false;
        _cameraBack.enabled = false;

        //Button für die Auswahl der anzuzeigenen Sicht
        btnChangeCamera.onClick.AddListener(() => {
            //handle click here
            if(_currentCamera == CAMERAS.CAMERA_BACK){
                _cameraBack.enabled = false;
                _cameraFront.enabled = true;
                _currentCamera = CAMERAS.CAMERA_FRONT;
            }
            else if(_currentCamera == CAMERAS.CAMERA_FRONT){
                _cameraFront.enabled = false;
                _cameraTop.enabled = true;
                _currentCamera = CAMERAS.CAMERA_TOP;
            }
            else if(_currentCamera == CAMERAS.CAMERA_TOP){
                _cameraTop.enabled = false;
                _cameraView01.enabled = true;
                _currentCamera = CAMERAS.CAMERA_VIEW1;
            }
            else if(_currentCamera == CAMERAS.CAMERA_VIEW1){
                _cameraView01.enabled = false;
                _cameraBack.enabled = true;
                _currentCamera = CAMERAS.CAMERA_BACK;
            }
        });

        //Button für die Auswahl der anzuzeigenen Strecke
        btnChangeCourse.onClick.AddListener(() => {
            //handle click here
            if(_currentCourse == COURSES.COURSE_LABOR){
                _courseLabor.SetActive(false);
                _courseCup2014.SetActive(true);
                _currentCourse = COURSES.COURSE_CUP2014;
            }
            else if(_currentCourse == COURSES.COURSE_CUP2014){
                _courseCup2014.SetActive(false);
                _courseCup2014Parking01.SetActive(true);
                _currentCourse = COURSES.COURSE_CUP2014_PARKING01;
            }
            else if(_currentCourse == COURSES.COURSE_CUP2014_PARKING01){
                _courseCup2014Parking01.SetActive(false);
                _courseCup2014Obstacles01.SetActive(true);
                _currentCourse = COURSES.COURSE_CUP2014_OBSTACLES01;
            }
            else if(_currentCourse == COURSES.COURSE_CUP2014_OBSTACLES01){
                _courseCup2014Obstacles01.SetActive(false);
                _courseStraight50Metres.SetActive(true);
                _currentCourse = COURSES.CORUSE_STRAIGHT_50_METRES;
            }
            else if(_currentCourse == COURSES.CORUSE_STRAIGHT_50_METRES){
                _courseStraight50Metres.SetActive(false);
                _courseLabor.SetActive(true);
                _currentCourse = COURSES.COURSE_LABOR;
            }
        });
    }