Пример #1
0
        public SqliteEvent FbEventToSQLite(Models.Event.FbData data)
        {
            try
            {
                SqliteEvent tempEvent = new SqliteEvent();
                tempEvent.Description = data.Description;
                tempEvent.Longitude   = data.Location.Info.Longitude;
                tempEvent.Latitude    = data.Location.Info.Latitude;
                tempEvent.Name        = data.Name;
                tempEvent.Picture     = data.Cover.Source;
                tempEvent.Time        = data.Time;
                tempEvent.Host        = data.Host.Name;
                if (string.IsNullOrEmpty(data.Location.Info.Street))
                {
                    tempEvent.Address = data.Location.Info.City;
                }
                else if (!string.IsNullOrEmpty(data.Location.Info.Street))
                {
                    tempEvent.Address = data.Location.Info.Street + " @" + data.Location.Info.City;
                }
                else if (string.IsNullOrEmpty(data.Location.Info.Street) && string.IsNullOrEmpty(data.Location.Info.City))
                {
                    tempEvent.Address = "Unknown";
                }

                return(tempEvent);
            }
            catch (Exception)
            {
                return(new SqliteEvent());
            }
        }
Пример #2
0
 internal static StreamEvent ToStreamEvent(this SqliteEvent @event)
 {
     return(new StreamEvent(
                @event.OriginalStreamId,
                @event.EventId,
                @event.SequenceNumber,
                @event.Checkpoint.ToString(),
                @event.Created,
                @event.Type,
                @event.JsonData,
                @event.JsonMetadata));
 }
Пример #3
0
    public static void AddGraphLinksRj()
    {
        using (SqliteTransaction tr = dbcon.BeginTransaction())
        {
            using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
            {
                dbcmdTr.Transaction = tr;

                SqliteEvent.GraphLinkInsert(Constants.JumpRjTable, "RJ(j)", "jump_rj.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpRjTable, "RJ(t)", "jump_rj.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpRjTable, "RJ(unlimited)", "jump_rj_in.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpRjTable, "triple jump", "jump_rj.png", true, dbcmdTr);
            }
            tr.Commit();
        }
    }
Пример #4
0
    public static void AddGraphLinksRunSimple()
    {
        using (SqliteTransaction tr = dbcon.BeginTransaction())
        {
            using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
            {
                dbcmdTr.Transaction = tr;

                SqliteEvent.GraphLinkInsert(Constants.RunTable, "20m", "run_simple.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "100m", "run_simple.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "200m", "run_simple.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "400m", "run_simple.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "1000m", "run_simple.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "2000m", "run_simple.png", true, dbcmdTr);
            }
            tr.Commit();
        }
    }
Пример #5
0
    public static void AddGraphLinksRunSimpleAgility()
    {
        using (SqliteTransaction tr = dbcon.BeginTransaction())
        {
            using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
            {
                dbcmdTr.Transaction = tr;

                SqliteEvent.GraphLinkInsert(Constants.RunTable, "Agility-20Yard", "agility_20yard.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "Agility-505", "agility_505.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "Agility-Illinois", "agility_illinois.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "Agility-Shuttle-Run", "agility_shuttle.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "Agility-ZigZag", "agility_zigzag.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "Margaria", "margaria.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunTable, "Gesell-DBT", "gesell_dbt.png", true, dbcmdTr);
            }
            tr.Commit();
        }
    }
Пример #6
0
    public static void AddGraphLinksRunInterval()
    {
        using (SqliteTransaction tr = dbcon.BeginTransaction())
        {
            using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
            {
                dbcmdTr.Transaction = tr;

                SqliteEvent.GraphLinkInsert(Constants.RunIntervalTable, "byLaps", "run_interval.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunIntervalTable, "byTime", "run_interval.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunIntervalTable, "unlimited", "run_interval.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunIntervalTable, "20m10times", "run_interval.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunIntervalTable, "7m30seconds", "run_interval.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunIntervalTable, "20m endurance", "run_interval.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunIntervalTable, "MTGUG", "mtgug.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.RunIntervalTable, "Agility-3L3R", "agility_3l3r.png", true, dbcmdTr);
            }
            tr.Commit();
        }
    }
Пример #7
0
    //put the graph links on the db
    //don't put the full description because if the user changes language, description will be in old lang
    //description will be on src/jumpType
    public static void AddGraphLinks()
    {
        using (SqliteTransaction tr = dbcon.BeginTransaction())
        {
            using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
            {
                dbcmdTr.Transaction = tr;

                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "Free", "jump_free.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "SJ", "jump_sj.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "SJl", "jump_sj_l.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "CMJ", "jump_cmj.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "CMJl", "jump_cmj_l.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "ABK", "jump_abk.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "ABKl", "jump_abk_l.png", true, dbcmdTr);
                //SqliteEvent.GraphLinkInsert (Constants.JumpTable, "Max", "jump_max.png", true, dbcmdTr); //we already have "Free"
                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "Rocket", "jump_rocket.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "DJa", "jump_dj_a.png", true, dbcmdTr);
                SqliteEvent.GraphLinkInsert(Constants.JumpTable, "DJna", "jump_dj.png", true, dbcmdTr);
            }
            tr.Commit();
        }
    }
Пример #8
0
        public async void GetPagesEvents()
        {
            try
            {
                var ids = await App.SqliteDB.GetPagesIds();

                if (ids.Count > 0)
                {
                    Events.Clear();
                    IsBusy = true;

                    for (int i = 0; i < ids.Count; i++)
                    {
                        var result = await _fbservice.GetPageEvents(ids[i]);

                        if (result.Data != null)
                        {
                            if (result.Data.Count > 0)
                            {
                                for (int x = 0; x < result.Data.Count; x++)
                                {
                                    SqliteEvent sqlEvent = _modelhelper.FbEventToSQLite(result.Data[x]);
                                    Events.Add(sqlEvent);
                                }
                            }
                        }
                    }
                    var desOrder = Events.OrderBy(x => x.Time).ToList();
                    Events = new ObservableCollection <SqliteEvent>(desOrder);
                    IsBusy = false;
                }
            }
            catch (Exception)
            {
                IsBusy = false;
            }
        }
Пример #9
0
    //upload a test
    private static Constants.UploadCodes serverUploadTest(ChronojumpServer myServer, Constants.TestTypes type, string tableName, Event myTest)
    {
        Constants.UploadCodes uCode;

        if (myTest.Simulated == Constants.Simulated)
        {
            //Test is simulated, don't upload
            uCode = Constants.UploadCodes.SIMULATED;
        }
        else if (myTest.Simulated > 0)
        {
            //Test is already uploaded, don't upload
            uCode = Constants.UploadCodes.EXISTS;
        }
        else
        {
            int idAtServer = -1;
            switch (type)
            {
            case Constants.TestTypes.JUMP:
                Jump jump = (Jump)myTest;
                idAtServer = myServer.UploadJump(jump);
                break;

            case Constants.TestTypes.JUMP_RJ:
                JumpRj jumpRj = (JumpRj)myTest;
                idAtServer = myServer.UploadJumpRj(jumpRj);
                break;

            case Constants.TestTypes.RUN:
                Run run = (Run)myTest;
                idAtServer = myServer.UploadRun(run);
                break;

            case Constants.TestTypes.RUN_I:
                RunInterval runI = (RunInterval)myTest;
                idAtServer = myServer.UploadRunI(runI);
                break;

            case Constants.TestTypes.RT:
                ReactionTime rt = (ReactionTime)myTest;
                idAtServer = myServer.UploadRT(rt);
                break;

            case Constants.TestTypes.PULSE:
                Pulse pulse = (Pulse)myTest;
                idAtServer = myServer.UploadPulse(pulse);
                break;

            case Constants.TestTypes.MULTICHRONOPIC:
                MultiChronopic mc = (MultiChronopic)myTest;
                idAtServer = myServer.UploadMultiChronopic(mc);
                break;
            }


            //update test (simulated) on client database
            myTest.Simulated = idAtServer;
            SqliteEvent.UpdateSimulated(true, tableName, myTest.UniqueID, idAtServer);

            uCode = Constants.UploadCodes.OK;
        }
        return(uCode);
    }