Ejemplo n.º 1
0
        public override void FinishedMigration(IDataConnector genericData)
        {
            if (!genericData.TableExists("estates"))
            {
                return;
            }
            DataReaderConnection dr = genericData.QueryData("WHERE `Key` = 'EstateID'", "estates", "`ID`, `Key`, `Value`");

            if (dr != null)
            {
                try
                {
                    while (dr.DataReader.Read())
                    {
                        try
                        {
                            UUID        ID     = UUID.Parse(dr.DataReader["ID"].ToString());
                            string      value  = dr.DataReader["Value"].ToString();
                            QueryFilter filter = new QueryFilter();
                            filter.andFilters["`ID`"]  = value;
                            filter.andFilters["`Key`"] = "EstateSettings";
                            List <string> results = genericData.Query(new string[1] {
                                "`Value`"
                            }, "estates", filter, null, null, null);
                            if ((results != null) && (results.Count >= 1))
                            {
                                EstateSettings es = new EstateSettings();
                                es.FromOSD((OSDMap)OSDParser.DeserializeLLSDXml(results[0]));
                                genericData.Insert("estateregions", new object[] { ID, value });

                                filter = new QueryFilter();
                                filter.andFilters["`EstateID`"] = value;

                                List <string> exist = genericData.Query(new string[1] {
                                    "`EstateID`"
                                }, "estatesettings", filter, null, null, null);
                                if (exist == null || exist.Count == 0)
                                {
                                    genericData.Insert("estatesettings", new object[] { value, es.EstateName, es.EstateOwner, es.ParentEstateID, es.ToOSD() });
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                catch
                {
                }
                finally
                {
                    dr.DataReader.Close();
                    genericData.CloseDatabase(dr);
                }
            }
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <dynamic> > LastUpdatedWell()
        {
            var query = $"select p.UniqueName as PlatformName, p.Id, p.SyncId as PlatformId, w.UniqueName, w.Latitude, w.Longitude, w.CreatedAt, w.UpdatedAt " +
                        "from [dbo].[Platforms] p inner join [dbo].[Wells] w on w.PlatformId = p.SyncId " +
                        "where w.UpdatedAt in ( " +
                        "select Max(w.UpdatedAt) as UpdatedAt from [dbo].[Platforms] p " +
                        "left join [dbo].[Wells] w on w.PlatformId = p.SyncId " +
                        "where w.UpdatedAt is not null group by p.SyncId) " +
                        "order by w.UpdatedAt desc";


            return(await Task.FromResult(_dataConnector.Query <dynamic>(System.Data.CommandType.Text, query)));
        }
Ejemplo n.º 3
0
        public override void FinishedMigration(IDataConnector genericData)
        {
            if (!genericData.TableExists("estates")) return;
            DataReaderConnection dr = genericData.QueryData("WHERE `Key` = 'EstateID'", "estates", "`ID`, `Key`, `Value`");

            if (dr != null)
            {
                try
                {
                    while (dr.DataReader.Read())
                    {
                        try
                        {
                            UUID ID = UUID.Parse(dr.DataReader["ID"].ToString());
                            string value = dr.DataReader["Value"].ToString();
                            QueryFilter filter = new QueryFilter();
                            filter.andFilters["`ID`"] = value;
                            filter.andFilters["`Key`"] = "EstateSettings";
                            List<string> results = genericData.Query(new string[1] { "`Value`" }, "estates", filter, null, null, null);
                            if ((results != null) && (results.Count >= 1))
                            {
                                EstateSettings es = new EstateSettings();
                                es.FromOSD((OSDMap)OSDParser.DeserializeLLSDXml(results[0]));
                                genericData.Insert("estateregions", new object[] { ID, value });

                                filter = new QueryFilter();
                                filter.andFilters["`EstateID`"] = value;

                                List<string> exist = genericData.Query(new string[1] { "`EstateID`" }, "estatesettings", filter, null, null, null);
                                if (exist == null || exist.Count == 0)
                                {
                                    genericData.Insert("estatesettings", new object[] { value, es.EstateName, es.EstateOwner, es.ParentEstateID, es.ToOSD() });
                                }
                            }
                        }
                        catch
                        {

                        }
                    }
                }
                catch
                {

                }
                finally
                {
                    dr.DataReader.Close();
                    genericData.CloseDatabase(dr);
                }
            }
        }