public void Bind()
        {
            con.Open();
            SqlCommand     cmd   = new SqlCommand("select * from EmployeeTable1", con);
            SqlDataAdapter adapt = new SqlDataAdapter(cmd);
            DataSet        ds    = new DataSet();

            adapt.Fill(ds, "EmployeeTable1");
            RP1.DataSource = ds.Tables[0];
            RP1.DataBind();
            con.Close();
        }
示例#2
0
        public void Bind()
        {
            conn.Open();
            SqlCommand     cmd = new SqlCommand("select * from StudentTable", conn);
            SqlDataAdapter sd  = new SqlDataAdapter(cmd);
            DataSet        ds  = new DataSet();

            sd.Fill(ds, "StudentTable");
            RP1.DataSource = ds.Tables[0];
            RP1.DataBind();
            conn.Close();
        }
示例#3
0
        public void Bind()
        {
            con.Open();
            SqlCommand     cmd   = new SqlCommand("Select * from StudentTable", con); //select all the record present in the datatable
            SqlDataAdapter adapt = new SqlDataAdapter(cmd);                           //retreiving data by creating an instance
            DataSet        ds    = new DataSet();                                     //setting data into single frame

            adapt.Fill(ds, "StudentTable");                                           //record of employee table record o
            RP1.DataSource = ds.Tables[0];
            RP1.DataBind();
            con.Close();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

            con.Open();
            SqlCommand    cmd = new SqlCommand("select * from Student", con);
            SqlDataReader rd  = cmd.ExecuteReader();

            RP1.DataSource = rd;
            RP1.DataBind();
            con.Close();
        }
示例#5
0
        public void Bind()
        {
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

            con.Open();
            SqlCommand     cmd  = new SqlCommand("Select * from StudentTable", con);
            SqlDataAdapter adpt = new SqlDataAdapter(cmd);
            DataSet        ds   = new DataSet();

            adpt.Fill(ds, "StudentTable");
            RP1.DataSource = ds.Tables[0];
            RP1.DataBind();
            con.Close();
        }
示例#6
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);
            }
        }
    }