public void Bind()
        {
            SqlCommand     Cmd  = new SqlCommand("Select * from StudentTable", Conn);
            SqlDataAdapter adpt = new SqlDataAdapter(Cmd);
            DataSet        Ds   = new DataSet();

            adpt.Fill(Ds, "StudentTable");
            RP2.DataSource = Ds.Tables[0];
            RP2.DataBind();
        }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     Runner    = GameObject.Find("Runner");
     FiveCell  = GameObject.Find("5-Cell");
     A         = FiveCell.GetComponent <Renderer> ();
     EightCell = GameObject.Find("8-Cell");
     B         = EightCell.GetComponent <Renderer> ();
     RP2       = GameObject.Find("RP2");
     C         = RP2.GetComponent <Renderer> ();
     RP2cut    = GameObject.Find("RP2 Cut Open");
     D         = RP2cut.GetComponent <Renderer> ();
     Torus     = GameObject.Find("Torus");
     E         = Torus.GetComponent <Renderer> ();
     M         = Runner.GetComponent <MeshLoader>();
 }
Beispiel #3
0
    // metoda zjistujici nove pokyny pro pohyb robotu ze strategii, zjistuje zdali nepadl gol, updatuje cas a pohybuje scenou
    public void Tick()
    {
        //save actual situation to storage
        storage.Ball.Position           = From3Dto2D(GameBall.transform.position);
        storage.LeftRobots[0].Position  = From3Dto2D(BluePlayer1.transform.position);
        storage.LeftRobots[1].Position  = From3Dto2D(BluePlayer2.transform.position);
        storage.LeftRobots[2].Position  = From3Dto2D(BluePlayer3.transform.position);
        storage.LeftRobots[3].Position  = From3Dto2D(BluePlayer4.transform.position);
        storage.LeftRobots[4].Position  = From3Dto2D(BlueGoal.transform.position);
        storage.RightRobots[0].Position = From3Dto2D(RedPlayer1.transform.position);
        storage.RightRobots[1].Position = From3Dto2D(RedPlayer2.transform.position);
        storage.RightRobots[2].Position = From3Dto2D(RedPlayer3.transform.position);
        storage.RightRobots[3].Position = From3Dto2D(RedPlayer4.transform.position);
        storage.RightRobots[4].Position = From3Dto2D(RedGoal.transform.position);

        //*********************  LEFT ****************************
        leftStorage.Ball.Position           = storage.Ball.Position;
        leftStorage.myRobots[0].Position    = storage.LeftRobots[0].Position;
        leftStorage.myRobots[1].Position    = storage.LeftRobots[1].Position;
        leftStorage.myRobots[2].Position    = storage.LeftRobots[2].Position;
        leftStorage.myRobots[3].Position    = storage.LeftRobots[3].Position;
        leftStorage.myRobots[4].Position    = storage.LeftRobots[4].Position;
        leftStorage.oppntRobots[0].Position = storage.RightRobots[0].Position;
        leftStorage.oppntRobots[1].Position = storage.RightRobots[1].Position;
        leftStorage.oppntRobots[2].Position = storage.RightRobots[2].Position;
        leftStorage.oppntRobots[3].Position = storage.RightRobots[3].Position;
        leftStorage.oppntRobots[4].Position = storage.RightRobots[4].Position;

        //*********************  RIGHT ****************************
        rightStorage.Ball.Position           = storage.Ball.Position;
        rightStorage.myRobots[0].Position    = storage.RightRobots[0].Position;
        rightStorage.myRobots[1].Position    = storage.RightRobots[1].Position;
        rightStorage.myRobots[2].Position    = storage.RightRobots[2].Position;
        rightStorage.myRobots[3].Position    = storage.RightRobots[3].Position;
        rightStorage.myRobots[4].Position    = storage.RightRobots[4].Position;
        rightStorage.oppntRobots[0].Position = storage.LeftRobots[0].Position;
        rightStorage.oppntRobots[1].Position = storage.LeftRobots[1].Position;
        rightStorage.oppntRobots[2].Position = storage.LeftRobots[2].Position;
        rightStorage.oppntRobots[3].Position = storage.LeftRobots[3].Position;
        rightStorage.oppntRobots[4].Position = storage.LeftRobots[4].Position;

        //volanie funkci TickStrategy z DLL
        object[] leftSt  = new object[] { leftStorage };
        object[] rightSt = new object[] { rightStorage };

        MethodTickLeft.Invoke(leftInstance, leftSt);
        MethodTickRight.Invoke(rightInstance, rightSt);

        // ***********     LEFT        ***************
        //load new situation from storage and move robots
        BP1.MoveTo(From2Dto2D(leftStorage.myRobots[0].PositionMove));
        BP2.MoveTo(From2Dto2D(leftStorage.myRobots[1].PositionMove));
        BP3.MoveTo(From2Dto2D(leftStorage.myRobots[2].PositionMove));
        BP4.MoveTo(From2Dto2D(leftStorage.myRobots[3].PositionMove));
        BG.MoveTo(From2Dto2D(leftStorage.myRobots[4].PositionMove));
        //load boal position to robots
        BP1.ballPosition = From2Dto2D(leftStorage.Ball.Position);
        BP2.ballPosition = From2Dto2D(leftStorage.Ball.Position);
        BP3.ballPosition = From2Dto2D(leftStorage.Ball.Position);
        BP4.ballPosition = From2Dto2D(leftStorage.Ball.Position);
        BG.ballPosition  = From2Dto2D(leftStorage.Ball.Position);


        // ***********     RIGHT        ***************
        //load new situation from storage and move robots
        RP1.MoveTo(From2Dto2D(rightStorage.myRobots[0].PositionMove));
        RP2.MoveTo(From2Dto2D(rightStorage.myRobots[1].PositionMove));
        RP3.MoveTo(From2Dto2D(rightStorage.myRobots[2].PositionMove));
        RP4.MoveTo(From2Dto2D(rightStorage.myRobots[3].PositionMove));
        Vector2D a = new Vector2D(-rightStorage.myRobots[4].PositionMove.X, rightStorage.myRobots[4].PositionMove.Y);

        RG.MoveTo(From2Dto2D(rightStorage.myRobots[4].PositionMove));
        //load boal position to robots
        RP1.ballPosition = From2Dto2D(rightStorage.Ball.Position);
        RP2.ballPosition = From2Dto2D(rightStorage.Ball.Position);
        RP3.ballPosition = From2Dto2D(rightStorage.Ball.Position);
        RP4.ballPosition = From2Dto2D(rightStorage.Ball.Position);
        RG.ballPosition  = From2Dto2D(rightStorage.Ball.Position);


        LogToHolder();

        //************ adaptStrategy ***************
        //ak uzivatel ma v DLL adapt strategy a chce ho vyuzivat
        //left
        if (StaticVariable.leftAdaptation == true)
        {
            List <object> newRules = (List <object>)leftAdaptStrategyMethod.Invoke(leftStrategyAdaptation, new object[] { logHolder, leftInstance });

            if (newRules.Count > 0)
            {
                MethodLeftAdaptStrategy.Invoke(leftInstance, new object[] { newRules });
                Debug.Log("Added rules: " + newRules.Count);
            }
        }

        //right
        if (StaticVariable.rightAdaptation == true)
        {
            List <object> newRules = (List <object>)rightAdaptStrategyMethod.Invoke(rightStrategyAdaptation, new object[] { logHolder, rightInstance });

            if (newRules.Count > 0)
            {
                MethodRightAdaptStrategy.Invoke(rightInstance, new object[] { newRules });
                Debug.Log("Added rules: " + newRules.Count);
            }
        }
    }
Beispiel #4
0
        public IActionResult Table(string corp = "", string number = "")    // отображение списка комната + человек (изм 11.02.2020)
        {
            // FromSqlInterpolated
            //var info_room = _db.Database. ExecuteSqlCommand("select tr.pavilion, tr.number_room, tr.short_desc, tr.long_desc, tr.phone_number, tr.email, tp.surname, tp.name1, tp.name2 from t_room tr left join room_person rp on rp.id_room = tr.Id_room left join t_person tp on tp.id_person = rp.id_person").ToList();
            var infoDB = from tr in _db.TRoom
                         join rp in _db.RoomPerson on tr.IdRoom equals rp.IdRoom into RP2
                         from rp2 in RP2.DefaultIfEmpty()
                         join tp in _db.TPerson on rp2.IdPerson equals tp.IdPerson into TP2
                         from tp2 in TP2.DefaultIfEmpty()
                         select new
            {
                Id        = tr.IdRoom,
                Pavilion  = tr.Pavilion,
                Number    = tr.NumberRoom,
                ShortDesc = tr.ShortDesc,
                LongDesc  = tr.LongDesc,
                Phone     = tr.PhoneNumber,
                Email     = tr.Email,
                //tp2 != null ? tp2.Surname + " " + tp2.Name1 + " " + tp2.Name2 : ""
                IdP     = tp2.IdPerson,
                Surname = tp2.Surname,
                Name1   = tp2.Name1,
                Name2   = tp2.Name2
            };

            List <RoomFull> info = new List <RoomFull>();

            foreach (var a in infoDB)
            {
                TRoom r = new TRoom();
                r.IdRoom = a.Id;

                r.Pavilion    = a.Pavilion;
                r.NumberRoom  = a.Number;
                r.ShortDesc   = a.ShortDesc; // != null ? {true} : {false}
                r.LongDesc    = a.LongDesc != null ? a.LongDesc : "";
                r.LongDesc    = r.LongDesc.Length < 65 ? r.LongDesc : r.LongDesc.Substring(0, 50) + "...";
                r.PhoneNumber = a.Phone;
                r.Email       = a.Email;
                string str = "";

                if (a.Surname != null)
                {
                    str = a.Surname;
                    if (a.Name1 != null)
                    {
                        str = str + " " + a.Name1.Substring(0, 1) + ".";
                        if (a.Name2 != null)
                        {
                            str = str + " " + a.Name2.Substring(0, 1) + ".";
                        }
                    }
                }

                if (corp != null && corp != "" && corp != r.Pavilion)
                {
                    continue;
                }
                if (number != null && number != "" && int.Parse(number) != r.NumberRoom)
                {
                    continue;
                }

                info.Add(new RoomFull()
                {
                    IDPerson   = a.IdP,
                    RoomInfo   = r,
                    PersonInfo = str
                });
            }

            return(View(info));
        }