Esempio n. 1
0
 public void addTeam(Team t, Color c)
 {
     if (c == Color.Blue)
         blueAlliance.Add(t);
     else
         redAlliance.Add(t);
 }
Esempio n. 2
0
 public async Task scoreTeam(Team t, Score s, int scoringTeam, string scoredBy)
 {
     string uri = "http://71.92.131.203:7475/db/data/cypher/";
     string query = "MATCH (n: Team { number:" + t.number + " })" +
                    "MERGE (s: Score { tNum: " + t.number + ", scoringTeam: " + scoringTeam + " }) WITH n, s " +
                    "MERGE (n)-[r:HAS]->(s)" + //: Score { tNum:" + t.number + " }
                    " ON MATCH SET s.scorer=\"" + scoredBy + "\", s.upScore0=" + s.upScore[0] + ", s.upScore1=" + s.upScore[1] + ", s.upScore2=" + s.upScore[2] + ", s.upScore3=" + s.upScore[3] + ", s.upScore4=" + s.upScore[4] + ", s.upScore5=" + s.upScore[5] + ", s.upScore6=" + s.upScore[6] + ", s.upScore7=" + s.upScore[7] + ", s.upScore8=" + s.upScore[8] +
                    ", s.dnScore0=" + s.dnScore[0] + ", s.dnScore1=" + s.dnScore[1] + ", s.dnScore2=" + s.dnScore[2] + ", s.dnScore3=" + s.dnScore[3] + ", s.dnScore4=" + s.dnScore[4] + ", s.dnScore5=" + s.dnScore[5] + ", s.dnScore6=" + s.dnScore[6] + ", s.dnScore7=" + s.dnScore[7] + ", s.dnScore8=" + s.dnScore[8] +
                    " ON CREATE SET s.scorer=\"" + scoredBy + "\", s.upScore0=" + s.upScore[0] + ", s.upScore1=" + s.upScore[1] + ", s.upScore2=" + s.upScore[2] + ", s.upScore3=" + s.upScore[3] + ", s.upScore4=" + s.upScore[4] + ", s.upScore5=" + s.upScore[5] + ", s.upScore6=" + s.upScore[6] + ", s.upScore7=" + s.upScore[7] + ", s.upScore8=" + s.upScore[8] +
                    ", s.dnScore0=" + s.dnScore[0] + ", s.dnScore1=" + s.dnScore[1] + ", s.dnScore2=" + s.dnScore[2] + ", s.dnScore3=" + s.dnScore[3] + ", s.dnScore4=" + s.dnScore[4] + ", s.dnScore5=" + s.dnScore[5] + ", s.dnScore6=" + s.dnScore[6] + ", s.dnScore7=" + s.dnScore[7] + ", s.dnScore8=" + s.dnScore[8] +
                    ", s.time=timestamp() RETURN s"; // Attach sender to Entr and return all diary entries for this timeline
     var r = SendAndReceiveJsonRequest(uri, query);
     string responseStr = await r;
 }
Esempio n. 3
0
 public async Task SaveTeamScore(Team tscore)
 {
     string ps = JsonConvert.SerializeObject(tscore);
     try
     {
         IFolder rootFolder = FileSystem.Current.LocalStorage;
         IFolder folder = await rootFolder.CreateFolderAsync("Settings", CreationCollisionOption.OpenIfExists, CancellationToken.None);
         IFile f = await folder.CreateFileAsync(tscore.number.ToString() + "_" + DateTime.UtcNow.Ticks.ToString() + ".txt", CreationCollisionOption.ReplaceExisting, CancellationToken.None);
         await f.WriteAllTextAsync(ps);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
Esempio n. 4
0
        public async Task<Team> getTeam(int t)
        {
            string uri = "http://71.92.131.203:7475/db/data/cypher/";
            string query = "MATCH (n: Team { number: " + t + " }) RETURN n"; // Attach sender to Entr and return all diary entries for this timeline
            var r = SendAndReceiveJsonRequest(uri, query);
            string responseStr = await r;
            Team data = new Team();
            try
            {
                neo4jData val = Newtonsoft.Json.JsonConvert.DeserializeObject<neo4jData>(responseStr);


                foreach (var kvp in val.data)// process column 'a'
                {
                    foreach (var kv in kvp)
                    {
                        foreach (var k in kv)
                        {
                            if (k.Key == "data")// these are the events
                            {
                                string values = Newtonsoft.Json.JsonConvert.SerializeObject(k.Value);

                                string ds = Newtonsoft.Json.JsonConvert.SerializeObject(k.Value);
                                JToken token = JObject.Parse(ds);
 
                                try
                                {

                                    data.number = (int)token.SelectToken("number");
                                    /*
                                    data.upScore[0] = (int)token.SelectToken("upScore0");
                                    data.upScore[1] = (int)token.SelectToken("upScore1");
                                    data.upScore[2] = (int)token.SelectToken("upScore2");
                                    data.upScore[3] = (int)token.SelectToken("upScore3");
                                    data.upScore[4] = (int)token.SelectToken("upScore4");
                                    data.upScore[5] = (int)token.SelectToken("upScore5");
                                    data.upScore[6] = (int)token.SelectToken("upScore6");
                                    data.upScore[7] = (int)token.SelectToken("upScore7");
                                    data.upScore[8] = (int)token.SelectToken("upScore8");
                                    data.dnScore[0] = (int)token.SelectToken("dnScore0");
                                    data.dnScore[1] = (int)token.SelectToken("dnScore1");
                                    data.dnScore[2] = (int)token.SelectToken("dnScore2");
                                    data.dnScore[3] = (int)token.SelectToken("dnScore3");
                                    data.dnScore[4] = (int)token.SelectToken("dnScore4");
                                    data.dnScore[5] = (int)token.SelectToken("dnScore5");
                                    data.dnScore[6] = (int)token.SelectToken("dnScore6");
                                    data.dnScore[7] = (int)token.SelectToken("dnScore7");
                                    data.dnScore[8] = (int)token.SelectToken("dnScore8");
                                    */
                                }
                                catch (Exception ex)
                                {
                                    System.Diagnostics.Debug.WriteLine("Bad token: " + ex.Message);
                                }
                                return data;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            return data;
        }
Esempio n. 5
0
 //CREATE (n: Team { name: "My Favorite Team", number:3024 }) RETURN n
 public async void createTeam(Team t)
 {
     string uri = "http://71.92.131.203:7475/db/data/cypher/";
     string query = "MERGE (n: Team { number:" + t.number + " }) RETURN n"; // Attach sender to Entr and return all diary entries for this timeline
     var r = SendAndReceiveJsonRequest(uri, query);
 }
Esempio n. 6
0
        void doDone(Object sender, EventArgs args)
        {

            REST neo = new REST();
            Match m = new Match();
            Team t = new Team();
            int i = 0;
			if (mNum.Text == null || mNum.Text == "" || RedTeam1.Text==null || RedTeam1.Text=="" || RedTeam2.Text==null || RedTeam2.Text=="" || RedTeam3.Text==null || RedTeam3.Text=="" || BlueTeam1.Text==null || BlueTeam1.Text=="" || BlueTeam2.Text==null || BlueTeam2.Text=="" || BlueTeam3.Text==null || BlueTeam3.Text=="")
				return;
            if (RedTeam1.Text != null && RedTeam1.Text.Length > 0)
            {
                m.red1 = RedTeam1.Text;
				if (int.TryParse(RedTeam1.Text, out i)==false)
				{
					DisplayAlert ("Error", " Red Team 1 number is not a number", "Ok");
					return;
				}
                t.setNum(i);
                neo.createTeam(t);
            }

            if (RedTeam2.Text != null && RedTeam2.Text.Length > 0)
            {
                m.red2 = RedTeam2.Text;
				if (int.TryParse(RedTeam2.Text, out i)==false)
				{
					DisplayAlert ("Error", "Red Team 2 number is not a number", "Ok");
					return;
				}
                t.setNum(i);
                neo.createTeam(t);
            }

            if (RedTeam3.Text != null && RedTeam3.Text.Length > 0)
            {
                m.red3 = RedTeam3.Text;
				if (int.TryParse(RedTeam3.Text, out i)==false)
				{
					DisplayAlert ("Error", "Red Team 3 number is not a number", "Ok");
					return;
				}
                t.setNum(i);
                neo.createTeam(t);
            }

            if (BlueTeam1.Text != null && BlueTeam1.Text.Length > 0)
            {
                m.blue1 = BlueTeam1.Text;
				if (int.TryParse(BlueTeam1.Text, out i)==false)
				{
					DisplayAlert ("Error", "Blue Team 1 number is not a number", "Ok");
					return;
				}
				t.setNum(i);
                neo.createTeam(t);
            }

            if (BlueTeam2.Text != null && BlueTeam2.Text.Length > 0)
            {
                m.blue2 = BlueTeam2.Text;
				if (int.TryParse(BlueTeam2.Text, out i)==false)
				{
					DisplayAlert ("Error", "Blue Team 2 number is not a number", "Ok");
					return;
				}
				t.setNum(i);
                neo.createTeam(t);
            }

            if (BlueTeam3.Text != null && BlueTeam3.Text.Length > 0)
            {
                m.blue3 = BlueTeam3.Text;
				if (int.TryParse(BlueTeam3.Text, out i)==false)
				{
					DisplayAlert ("Error", "Blue Team 3 number is not a number", "Ok");
					return;
				}
				t.setNum(i);
                neo.createTeam(t);
            }
            if (mNum.Text != null)
                m.number = mNum.Text;

            neo.createMatch(m, MatchListPage.opt.teamNumber);
            Navigation.PopModalAsync();
        }