Beispiel #1
0
        /// <summary>
        /// Evento de la banda group footer
        /// </summary>
        private void gfTecnicos_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int tecnicoID  = this.GetCurrentColumnValue <int>("TecnicoID");
            int sucursalID = this.GetCurrentColumnValue <int>("SucursalID");

            var auditoriasRealizadas = (this.DataSource as ReporteAuditoriasRealizadasDS);
            var rows = Enumerable.AsEnumerable(auditoriasRealizadas.ReporteAuditoriasRealizadasDA).Where(x => x.SucursalID == sucursalID && x.TecnicoID == tecnicoID).ToList();

            if (rows.Count > 0)
            {
                this.xrlAuditoriasRealizadas.Text = rows.Count.ToString();
                List <double> calificaciones = new List <double>();
                foreach (var row in rows)
                {
                    double cantidadTotal     = double.Parse(row.CantidadAuditoria.ToString());
                    double cantidadResultado = double.Parse(row.ResultadoAuditoria.ToString());

                    var calificacion = Math.Round(((cantidadResultado * 100) / cantidadTotal), 2);
                    calificaciones.Add(calificacion);
                }
                var promedio = Math.Round(calificaciones.Sum() / rows.Count, 0);
                this.xrlPromedioAuditorias.Text = promedio.ToString() + " %";
            }
            else
            {
                this.xrlAuditoriasRealizadas.Text = "0";
                this.xrlPromedioAuditorias.Text   = "0 %";
            }
        }
Beispiel #2
0
        /// <summary>
        /// Evento para el detalle
        /// </summary>
        private void dtlTecnicos_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int sucursalID      = this.GetCurrentColumnValue <int>("SucursalID");
            int tecnicoID       = this.GetCurrentColumnValue <int>("TecnicoID");
            int ordenServicioID = this.GetCurrentColumnValue <int>("OrdenServicioID");

            var auditoriasRealizadas = (this.DataSource as ReporteAuditoriasRealizadasDS);
            var row = Enumerable.AsEnumerable(auditoriasRealizadas.ReporteAuditoriasRealizadasDA).FirstOrDefault(x => x.SucursalID == sucursalID && x.TecnicoID == tecnicoID && x.OrdenServicioID == ordenServicioID);

            double cantidadTotal     = double.Parse(row.CantidadAuditoria.ToString());
            double cantidadResultado = double.Parse(row.ResultadoAuditoria.ToString());

            if (cantidadTotal == 0)
            {
                this.xrtCalificacion.Text = "0 %";
            }
            else
            {
                var calificacion = Math.Round(((cantidadResultado * 100) / cantidadTotal), 2);
                this.xrtCalificacion.Text = Math.Round(calificacion, 0).ToString() + " %";
            }

            this.xrtcOrdenServicio.Text  = row.OrdenServicioID.ToString();
            this.xrtcFechaAuditoria.Text = row.FechaAuditoria.ToString();
            this.xrtcObservaciones.Text  = row.Observaciones;
        }
Beispiel #3
0
        /// <summary>
        /// Evento de presentacion de los subreportes
        /// </summary>
        private void xrsTecnicos_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int sucursalID           = this.GetCurrentColumnValue <int>("SucursalID");
            var auditoriasRealizadas = (this.DataSource as ReporteAuditoriasRealizadasDS);
            var tecnicos             = Enumerable.AsEnumerable(auditoriasRealizadas.ReporteAuditoriasRealizadasDA).Where(x => x.SucursalID == sucursalID).ToList();
            var tecnicosId           = tecnicos.Select(x => x.TecnicoID).Distinct().ToList();

            XRSubreport subReporte = sender as XRSubreport;

            if (subReporte.ReportSource == null)
            {
                return;
            }

            string filtroTecnicos = "";

            foreach (int tecnicoID in tecnicosId)
            {
                if (String.IsNullOrEmpty(filtroTecnicos))
                {
                    filtroTecnicos = filtroTecnicos + " [TecnicoID] = " + tecnicoID.ToString() + " ";
                }
                else
                {
                    filtroTecnicos = filtroTecnicos + " OR [TecnicoID] = " + tecnicoID.ToString() + " ";
                }
            }
            filtroTecnicos = "( " + filtroTecnicos + " ) ";

            subReporte.ReportSource.DataSource   = this.DataSource;
            subReporte.ReportSource.FilterString = String.Format("[SucursalID] = {0} AND {1} ", sucursalID, filtroTecnicos);
        }
        public override object GetValueFromRefCursor(Type type, IOracleRefCursorWrapper refCursor)
        {
            int counter = 0;
            var reader  = refCursor.GetDataReader();

            if (type.IsCollection())
            {
                var     subType  = type.GetCollectionUnderType();
                dynamic instance = subType.CreateListType().CreateInstance();
                while (reader.Read())
                {
                    counter = 0;
                    instance.Add(ReadObjectInstance(subType, reader, OracleTypeNetMetadata, ref counter));
                }

                return(type.IsArray ? Enumerable.ToArray(instance) : Enumerable.AsEnumerable(instance));
            }
            else
            {
                dynamic instance = type.CreateInstance();
                while (reader.Read())
                {
                    instance = ReadObjectInstance(type, reader, OracleTypeNetMetadata, ref counter);
                }

                return((T)instance);
            }
        }
Beispiel #5
0
        public S Execute <S>(Expression expression)
        {
            var e = Enumerable.AsEnumerable(this);
            MethodCallExpression mce = expression as MethodCallExpression;
            object x = null;

            if (mce != null)
            {
                switch (mce.Method.Name)
                {
                case "Skip":
                    return((S)e.Skip <T>(1));

                case "Count":
                    x = e.Count();
                    break;

                case "First":
                    x = e.First();
                    break;

                case "FirstOrDefault":
                    x = e.FirstOrDefault();
                    break;

                default:
                    throw new NotSupportedException();
                }
            }
            return((S)x);
        }
        public HealthCheckHostedService(IClusterClient client, IHealthCheckParticipant oracle, IOptions <HealthCheckHostedServiceOptions> myOptions)
        {
            host = new WebHostBuilder()
                   .UseKestrel(options => options.ListenAnyIP(myOptions.Value.Port))
                   .ConfigureServices(services =>
            {
                services.AddHealthChecks()
                .AddCheck <GrainHealthCheck>("GrainHealth")
                .AddCheck <SiloHealthCheck>("SiloHealth")
                .AddCheck <StorageHealthCheck>("StorageHealth")
                .AddCheck <ClusterHealthCheck>("ClusterHealth");

                services.AddSingleton <IHealthCheckPublisher, LoggingHealthCheckPublisher>()
                .Configure <HealthCheckPublisherOptions>(options =>
                {
                    options.Period = TimeSpan.FromSeconds(10);
                });

                services.AddSingleton(client);
                services.AddSingleton(Enumerable.AsEnumerable(new IHealthCheckParticipant[] { oracle }));
            })
                   .ConfigureLogging(builder =>
            {
                builder.AddConsole();
            })
                   .Configure(app =>
            {
                app.UseHealthChecks(myOptions.Value.PathString);
            })
                   .Build();
        }
        public HealthCheckHostedService(IClusterClient client, IMembershipOracle oracle, IOptions <HealthCheckHostedServiceOptions> myOptions)
        {
            host = new HostBuilder()
                   .ConfigureServices(services =>
            {
                services.AddHealthChecks()
                .AddCheck <GrainHealthCheck>("GrainHealth")
                .AddCheck <SiloHealthCheck>("SiloHealth")
                .AddCheck <StorageHealthCheck>("StorageHealth")
                .AddCheck <ClusterHealthCheck>("ClusterHealth");

                services.AddSingleton <IHealthCheckPublisher, LoggingHealthCheckPublisher>()
                .Configure <HealthCheckPublisherOptions>(options =>
                {
                    options.Period = TimeSpan.FromSeconds(1);
                });

                services.AddSingleton(client);
                services.AddSingleton(Enumerable.AsEnumerable(new IHealthCheckParticipant[] { oracle }));
            })
                   .ConfigureLogging(builder =>
            {
                builder.AddConsole();
            })
                   .Build();
        }
Beispiel #8
0
        /// <summary>
        /// Evento Before Print
        /// </summary>
        private void gfSucursal_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int sucursalID           = this.GetCurrentColumnValue <int>("SucursalID");
            var auditoriasRealizadas = (this.DataSource as ReporteAuditoriasRealizadasDS);
            var auditorias           = Enumerable.AsEnumerable(auditoriasRealizadas.ReporteAuditoriasRealizadasDA).Where(x => x.SucursalID == sucursalID).ToList();

            double        totalAuditoriasRealizadas   = 0;
            double        numeroTecnicosAuditados     = 0;
            double        promedioAuditoriasTecnico   = 0;
            List <double> calificaciones              = new List <double>();
            double        promedioCalificacionGeneral = 0;

            foreach (var row in auditorias)
            {
                double cantidadTotal     = double.Parse(row.CantidadAuditoria.ToString());
                double cantidadResultado = double.Parse(row.ResultadoAuditoria.ToString());

                var calificacion = Math.Round(((cantidadResultado * 100) / cantidadTotal), 2);
                calificaciones.Add(calificacion);
            }

            totalAuditoriasRealizadas   = auditorias.Select(x => x.AuditoriaMantenimientoID).Distinct().Count();
            numeroTecnicosAuditados     = auditorias.Select(x => x.TecnicoID).Distinct().Count();
            promedioAuditoriasTecnico   = numeroTecnicosAuditados > 0 ? Math.Round(((totalAuditoriasRealizadas / numeroTecnicosAuditados) * 100) / totalAuditoriasRealizadas, 2) : 0;
            promedioCalificacionGeneral = Math.Round(calificaciones.Sum() / auditorias.Count, 0);

            this.xrtTotalAuditoriasSucursal.Text = totalAuditoriasRealizadas.ToString();
            this.xrtTecnicosAuditados.Text       = numeroTecnicosAuditados.ToString();
            this.xrtPromedioTecnicos.Text        = promedioAuditoriasTecnico.ToString() + " %";
            this.xrtPromedioCalificacion.Text    = promedioCalificacionGeneral.ToString();
        }
Beispiel #9
0
        public IQueryable <EmployeeResource> Items()
        {
            var entities = Enumerable.AsEnumerable(EntityContext.Employees);
            var result   = mapper.Map <IEnumerable <Employee>, IEnumerable <EmployeeResource> >(entities);

            return(result.AsQueryable());
        }
Beispiel #10
0
        public virtual void Delete(Expression <Func <T, bool> > where)
        {
            IEnumerable <T> objects = Enumerable.AsEnumerable <T>(_dbset.Where(@where));

            foreach (T obj in objects)
            {
                _dbset.Remove(obj);
            }
        }
Beispiel #11
0
        public IEnumerable <T> GetAll(Func <T, bool> predicate = null)
        {
            if (predicate != null)
            {
                return(Enumerable.Where(_context.Set <T>(), predicate));
            }

            return(Enumerable.AsEnumerable <T>(_context.Set <T>()));
        }
Beispiel #12
0
        /// <summary>
        /// Gets a collection of pathfinder nodes to a given location. Returns 0 elements if unsuccessful.
        /// </summary>
        /// <param name="c">The client to perform the operation on.</param>
        /// <param name="loc">The location to reach.</param>
        /// <param name="tiles">A list of tiles to use for pathfinding.</param>
        /// <param name="pathFinder">The pathfinder to use.</param>
        /// <param name="considerPlayerWalkable">Whether to consider the player as walkable.</param>
        /// <param name="considerCreatureOnLocationWalkable">Whether to consider any creatures on the target location as walkable.</param>
        /// <returns></returns>
        public IEnumerable <Objects.PathFinder.Node> GetTilesToLocation(Objects.Client c,
                                                                        Location loc, Map.TileCollection tiles, Objects.PathFinder pathFinder,
                                                                        bool considerPlayerWalkable = false, bool considerCreatureOnLocationWalkable = false)
        {
            if (pathFinder == null)
            {
                return(Enumerable.Empty <Objects.PathFinder.Node>());
            }
            //return pathFinder.

            if (!this.IsOnScreen(c.Player.Location))
            {
                return(Enumerable.Empty <Objects.PathFinder.Node>());
            }

            uint playerId = c.Player.ID;

            Map.Tile playerTile = tiles.GetTile(count: playerId);
            Map.Tile fromTile   = tiles.GetTile(this);
            Map.Tile targetTile = tiles.GetTile(loc);
            if (playerTile == null || fromTile == null || targetTile == null)
            {
                return(Enumerable.Empty <Objects.PathFinder.Node>());
            }

            // check if target tile is walkable
            if (!targetTile.IsWalkable() && (!considerPlayerWalkable || targetTile != playerTile))
            {
                return(Enumerable.Empty <Objects.PathFinder.Node>());
            }
            if (fromTile == targetTile)
            {
                return(Enumerable.AsEnumerable(new Objects.PathFinder.Node[] { new Objects.PathFinder.Node() }));
            }
            lock (pathFinder)
            {
                pathFinder.ResetGrid();
                foreach (Map.Tile tile in tiles.GetTiles())
                {
                    if (tile == null)
                    {
                        continue;
                    }

                    if ((considerPlayerWalkable && tile == playerTile) || tile.IsWalkable())
                    {
                        pathFinder.Grid[tile.MemoryLocation.X, tile.MemoryLocation.Y] = 1;
                    }
                    else
                    {
                        pathFinder.Grid[tile.MemoryLocation.X, tile.MemoryLocation.Y] = (byte)Enums.MiniMapSpeedValues.Unwalkable;
                    }
                }
                pathFinder.Grid[fromTile.MemoryLocation.X, fromTile.MemoryLocation.Y] = 1;
                return(pathFinder.FindPath(fromTile.MemoryLocation, targetTile.MemoryLocation));
            }
        }
Beispiel #13
0
        /// <summary>
        /// borra la entidad bajo criterio .
        /// </summary>
        /// <param name="where">The where.</param>
        public override void Delete(Expression <Func <T, bool> > where)
        {
            IEnumerable <T> objects = Enumerable.AsEnumerable <T>(_dbset.Where(@where));

            foreach (T obj in objects)
            {
                _dbset.Remove(obj);
            }
            SaveChanges();
        }
Beispiel #14
0
 public static void ProcessClassRelationships(IEnumerable <OntologyClass> classes)
 {
     foreach (OntologyClass ontCls in classes)
     {
         ontCls.IncomingRelationships = classes
                                        .Map(c => Enumerable.AsEnumerable <OntologyProperty>(c.OutgoingRelationships))
                                        .Flatten()
                                        .Where(p => p.Range == ontCls.Name)
                                        .ToArray();
     }
 }
        /// <summary>
        /// Se ejecuta antes de la impresion de cada detalle
        /// </summary>
        private void Detail_BeforePrint(object sender, PrintEventArgs e)
        {
            var unidadId = this.GetCurrentColumnValue <int>("UnidadID");
            var mes      = this.GetCurrentColumnValue <int>("Mes");
            var Anio     = this.GetCurrentColumnValue <int>("Anio");

            ReporteRendimientoUnidadDS dataSource = (ReporteRendimientoUnidadDS)this.DataSource;
            var row = Enumerable.AsEnumerable(dataSource.Meses).Where(x => x.Mes == mes && x.Anio == Anio).FirstOrDefault();

            if (row != null)
            {
                this.xrlMesAnio.Text = row.NombreMes.ToString() + " - " + row.Anio.ToString();
            }
        }
        public ActionResult Index()
        {
            ViewBag.Total = PostService.Count(p => p.Status == Status.Pended || CurrentUser.IsAdmin);
            var banners    = AdsService.GetsByWeightedPrice(8, AdvertiseType.Banner).OrderBy(a => Guid.NewGuid()).ToList();
            var fastShares = FastShareService.GetAllFromCache(s => s.Sort).ToList();
            var postsQuery = PostService.GetQuery <PostOutputDto>(p => (p.Status == Status.Pended || CurrentUser.IsAdmin)); //准备文章的查询
            var posts      = postsQuery.Where(p => !p.IsFixedTop).OrderBy(OrderBy.ModifyDate.GetDisplay() + " desc").Take(15).Cacheable().ToList();
            var viewModel  = GetIndexPageViewModel();

            viewModel.Banner  = banners;
            viewModel.Posts   = Enumerable.AsEnumerable(postsQuery.Where(p => p.IsFixedTop).OrderByDescending(p => p.ModifyDate)).Union(posts).ToList();
            ViewBag.FastShare = fastShares;
            return(View(viewModel));
        }
        public ActionResult Post([Optional] OrderBy?orderBy, [Range(1, int.MaxValue, ErrorMessage = "页码必须大于0")] int page = 1, [Range(1, int.MaxValue, ErrorMessage = "页大小必须大于0")] int size = 15)
        {
            ViewBag.Total = PostService.Count(p => p.Status == Status.Pended || CurrentUser.IsAdmin && !p.IsFixedTop);
            var viewModel  = GetIndexPageViewModel();
            var postsQuery = PostService.GetQuery <PostOutputDto>(p => (p.Status == Status.Pended || CurrentUser.IsAdmin)); //准备文章的查询
            var posts      = postsQuery.Where(p => !p.IsFixedTop).OrderBy((orderBy ?? OrderBy.ModifyDate).GetDisplay() + " desc").Skip(size * (page - 1)).Take(size).Cacheable().ToList();

            if (page == 1)
            {
                posts = Enumerable.AsEnumerable(postsQuery.Where(p => p.IsFixedTop).OrderByDescending(p => p.ModifyDate)).Union(posts).ToList();
            }

            viewModel.Posts = posts;
            return(View(viewModel));
        }
Beispiel #18
0
 private int PlayerScore_Bad(ListMap map, PlayerType player, Matrix <double> playerMatrix)
 {
     if (player == PlayerType.Blue)
     {
         var pathVector = playerMatrix.RowSums();
         var numberLeft = Enumerable.AsEnumerable <double>(pathVector).Count(x => (int)x == 0);
         return(map.Size - numberLeft);
     }
     else
     {
         var pathVector = playerMatrix.ColumnSums();
         var numberLeft = Enumerable.AsEnumerable <double>(pathVector).Count(x => (int)x == 0);
         return(map.Size - numberLeft);
     }
 }
        public ActionResult All()
        {
            var tags = Enumerable.AsEnumerable(PostService.GetQuery(p => !string.IsNullOrEmpty(p.Label)).Select(p => p.Label).Cacheable()).SelectMany(s => s.Split(',', ',')).OrderBy(s => s).ToList(); //tag

            ViewBag.tags = tags.GroupBy(t => t).OrderByDescending(g => g.Count()).ThenBy(g => g.Key);
            ViewBag.cats = CategoryService.GetAll(c => c.Post.Count, false).Select(c => new TagCloudViewModel
            {
                Id    = c.Id,
                Name  = c.Name,
                Count = c.Post.Count(p => p.Status == Status.Pended || CurrentUser.IsAdmin)
            }).Cacheable().ToList(); //category
            ViewBag.seminars = SeminarService.GetAll(c => c.Post.Count, false).Select(c => new TagCloudViewModel
            {
                Id    = c.Id,
                Name  = c.Title,
                Count = c.Post.Count(p => p.Post.Status == Status.Pended || CurrentUser.IsAdmin)
            }).Cacheable().ToList(); //seminars
            return(View());
        }
Beispiel #20
0
        public IActionResult Export()
        {
            byte[] archiveFile;

            var generator = new POGenerator();

            using (var archiveStream = new MemoryStream())
            {
                using (var archive = new ZipArchive(archiveStream, ZipArchiveMode.Create, true))
                {
                    foreach (var textCatalog in localizationProvider.TextCatalogs)
                    {
                        var entries = Enumerable.AsEnumerable <IPOEntry>(textCatalog.Value);

                        var contextIds = entries.Select(i => i.Key.ContextId).Distinct();

                        foreach (var contextId in contextIds)
                        {
                            var filteredCatalog = new POCatalog(entries.Where(entry => entry.Key.ContextId == contextId))
                            {
                                Encoding           = textCatalog.Value.Encoding,
                                PluralFormCount    = textCatalog.Value.PluralFormCount,
                                PluralFormSelector = textCatalog.Value.PluralFormSelector,
                                Language           = textCatalog.Value.Language,
                                Headers            = new Dictionary <string, string>
                                {
                                    { "X-Generator", "BlazorBoilerplate" },
                                }
                            };

                            var zipEntry = archive.CreateEntry($"{contextId}-{textCatalog.Key}.po");

                            using var entryStream = zipEntry.Open();
                            generator.Generate(entryStream, filteredCatalog);
                        }
                    }
                }

                archiveFile = archiveStream.ToArray();
            }

            return(File(archiveFile, MediaTypeNames.Application.Zip, "PO.zip"));
        }
Beispiel #21
0
 private void MobileClientGuildMembersOnlineHandler(MobileClientGuildMembersOnline msg)
 {
     using (IEnumerator <MobileGuildMember> enumerator = Enumerable.AsEnumerable <MobileGuildMember>(msg.Members).GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             MobileGuildMember current = enumerator.get_Current();
             Debug.Log(string.Concat(new string[]
             {
                 "Guild member ",
                 current.Name,
                 " (",
                 current.Guid,
                 ") is online."
             }));
             GuildData.AddGuildMember(current);
         }
     }
     this.allPanels.adventureMapPanel.m_guildChatSlider_Bottom.UpdateGuildMateRoster();
 }
Beispiel #22
0
        public void DisplayProducts(DataTable table)
        {
            student stu;

            Microsoft.EntityFrameworkCore.DbSet <student> j;



            DbDataRecord d = table;

            d.as
            // table
            Enumerable.AsEnumerable <student>(stu);
            //var productNames = from products in table.AsEnumerable() select products.Field<string>("ProductName");
            //Console.WriteLine("Product Names: ");
            //foreach (string productName in productNames)
            //{
            //    Console.WriteLine(productName);
            //}
        }
Beispiel #23
0
        /// <summary>
        /// Evento de impresion del report footer
        /// </summary>
        private void rfGeneral_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            var auditoriasRealizadas = (this.DataSource as ReporteAuditoriasRealizadasDS);
            var auditorias           = Enumerable.AsEnumerable(auditoriasRealizadas.ReporteAuditoriasRealizadasDA).ToList();

            double        totalAuditoriasRealizadas   = 0;
            double        numeroTecnicosAuditados     = 0;
            double        promedioAuditoriasTecnico   = 0;
            List <double> calificaciones              = new List <double>();
            double        promedioCalificacionGeneral = 0;

            var auditoriasRealizadasId = auditorias.Select(x => x.AuditoriaMantenimientoID).Distinct().ToList();

            for (int i = 0; i < auditoriasRealizadasId.Count; i++)
            {
                var row = auditorias.FirstOrDefault(x => x.AuditoriaMantenimientoID == auditoriasRealizadasId[i]);
            }

            foreach (var row in auditorias)
            {
                double cantidadTotal     = double.Parse(row.CantidadAuditoria.ToString());
                double cantidadResultado = double.Parse(row.ResultadoAuditoria.ToString());

                var calificacion = Math.Round(((cantidadResultado * 100) / cantidadTotal), 2);
                calificaciones.Add(calificacion);
            }

            totalAuditoriasRealizadas   = auditorias.Select(x => x.AuditoriaMantenimientoID).Distinct().Count();
            numeroTecnicosAuditados     = auditorias.Select(x => x.TecnicoID).Distinct().Count();
            promedioAuditoriasTecnico   = numeroTecnicosAuditados > 0 ? Math.Round(((totalAuditoriasRealizadas / numeroTecnicosAuditados) * 100) / totalAuditoriasRealizadas, 2) : 0;
            promedioCalificacionGeneral = Math.Round(calificaciones.Sum() / auditorias.Count, 0);

            this.xrtTotalGeneralAuditorias.Text             = totalAuditoriasRealizadas.ToString();
            this.xrtTotalGeneralTecnicos.Text               = numeroTecnicosAuditados.ToString();
            this.xrtTotalGeneralPromedioAuditorias.Text     = promedioAuditoriasTecnico.ToString() + " %";
            this.xrtTotalGeneralPromedioCalificaciones.Text = promedioCalificacionGeneral.ToString();
        }
        public T Get <T>(Expression <Func <T, bool> > predicate)
        {
            // validate input param(s)
            predicate.EnsureNotNull(nameof(predicate));

            // use the documentdb client to generate the IOrderedQueryable<T> using it's linq provider
            var documentQuery = CreateDocumentQuery(predicate);

            // extract just the query from the CosmosDB IQueryable<T>
            var dynamicQuery = JsonConvert.DeserializeObject <dynamic>(documentQuery.ToString());
            var queryText    = (string)dynamicQuery.query;

            // if any of the predicate conditions contain the "Id" property we need to change the case to "id" so documentdb will work properly
            queryText = CorrectCasingOfDocumentQuery(queryText);

            // inject the namespace predicate to prevent us from reading other microservice's documents
            queryText = $"{queryText} AND root[\"EntityType\"] = '{_namespace}{typeof(T).Name}'";

            // execute the query without using generics so that we can just get a JObject back
            var jObject = Enumerable.AsEnumerable(_documentClient.CreateDocumentQuery <JObject>(_collectionUri, queryText))
                          .FirstOrDefault();

            return(null == jObject ? default(T) : jObject.ToObject <T>(_jsonSerializer));
        }
Beispiel #25
0
 public static IEnumerable <TSource> AsEnumerable <TSource>(this Set <TSource> source) =>
 Enumerable.AsEnumerable(source.AsEnumerable());
    public void SetQuest(int questID)
    {
        this.m_expiringSoon.get_gameObject().SetActive(false);
        this.m_questID = questID;
        Transform[] componentsInChildren = this.m_worldQuestObjectiveRoot.GetComponentsInChildren <Transform>(true);
        Transform[] array = componentsInChildren;
        for (int i = 0; i < array.Length; i++)
        {
            Transform transform = array[i];
            if (transform != null && transform != this.m_worldQuestObjectiveRoot.get_transform())
            {
                Object.DestroyImmediate(transform.get_gameObject());
            }
        }
        MobileWorldQuest mobileWorldQuest = (MobileWorldQuest)WorldQuestData.worldQuestDictionary.get_Item(this.m_questID);

        this.m_worldQuestNameText.set_text(mobileWorldQuest.QuestTitle);
        using (IEnumerator <MobileWorldQuestObjective> enumerator = Enumerable.AsEnumerable <MobileWorldQuestObjective>(mobileWorldQuest.Objective).GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                MobileWorldQuestObjective current = enumerator.get_Current();
                GameObject gameObject             = Object.Instantiate <GameObject>(this.m_worldQuestObjectiveDisplayPrefab);
                gameObject.get_transform().SetParent(this.m_worldQuestObjectiveRoot.get_transform(), false);
                Text component = gameObject.GetComponent <Text>();
                component.set_text("-" + current.Text);
            }
        }
        this.InitRewardInfoDisplay(mobileWorldQuest);
        this.m_endTime = (long)(mobileWorldQuest.EndTime - 900);
        QuestInfoRec record = StaticDB.questInfoDB.GetRecord(mobileWorldQuest.QuestInfoID);

        if (record == null)
        {
            return;
        }
        bool active = (record.Modifiers & 2) != 0;

        this.m_dragonFrame.get_gameObject().SetActive(active);
        this.m_background.set_sprite(Resources.Load <Sprite>("NewWorldQuest/Mobile-NormalQuest"));
        bool flag = (record.Modifiers & 1) != 0;

        if (flag && record.Type != 3)
        {
            this.m_background.set_sprite(Resources.Load <Sprite>("NewWorldQuest/Mobile-RareQuest"));
        }
        bool flag2 = (record.Modifiers & 4) != 0;

        if (flag2 && record.Type != 3)
        {
            this.m_background.set_sprite(Resources.Load <Sprite>("NewWorldQuest/Mobile-EpicQuest"));
        }
        int    uITextureAtlasMemberID;
        string text;

        switch (record.Type)
        {
        case 1:
        {
            int profession = record.Profession;
            switch (profession)
            {
            case 182:
                uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-herbalism");
                text = "Mobile-Herbalism";
                goto IL_46E;

            case 183:
            case 184:
IL_259:
                if (profession == 164)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-blacksmithing");
                    text = "Mobile-Blacksmithing";
                    goto IL_46E;
                }
                if (profession == 165)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-leatherworking");
                    text = "Mobile-Leatherworking";
                    goto IL_46E;
                }
                if (profession == 129)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-firstaid");
                    text = "Mobile-FirstAid";
                    goto IL_46E;
                }
                if (profession == 171)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-alchemy");
                    text = "Mobile-Alchemy";
                    goto IL_46E;
                }
                if (profession == 197)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-tailoring");
                    text = "Mobile-Tailoring";
                    goto IL_46E;
                }
                if (profession == 202)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-engineering");
                    text = "Mobile-Engineering";
                    goto IL_46E;
                }
                if (profession == 333)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-enchanting");
                    text = "Mobile-Enchanting";
                    goto IL_46E;
                }
                if (profession == 356)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-fishing");
                    text = "Mobile-Fishing";
                    goto IL_46E;
                }
                if (profession == 393)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-skinning");
                    text = "Mobile-Skinning";
                    goto IL_46E;
                }
                if (profession == 755)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-jewelcrafting");
                    text = "Mobile-Jewelcrafting";
                    goto IL_46E;
                }
                if (profession == 773)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-inscription");
                    text = "Mobile-Inscription";
                    goto IL_46E;
                }
                if (profession != 794)
                {
                    uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-questmarker-questbang");
                    text = "Mobile-QuestExclamationIcon";
                    goto IL_46E;
                }
                uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-archaeology");
                text = "Mobile-Archaeology";
                goto IL_46E;

            case 185:
                uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-cooking");
                text = "Mobile-Cooking";
                goto IL_46E;

            case 186:
                uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-mining");
                text = "Mobile-Mining";
                goto IL_46E;
            }
            goto IL_259;
IL_46E:
            goto IL_4BB;
        }

        case 3:
            uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-pvp-ffa");
            text = "Mobile-PVP";
            goto IL_4BB;

        case 4:
            uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-petbattle");
            text = "Mobile-Pets";
            goto IL_4BB;
        }
        uITextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-questmarker-questbang");
        text = "Mobile-QuestExclamationIcon";
IL_4BB:
        if (text != null)
        {
            this.m_main.set_sprite(Resources.Load <Sprite>("NewWorldQuest/" + text));
        }
        else if (uITextureAtlasMemberID > 0)
        {
            this.m_main.set_sprite(TextureAtlas.instance.GetAtlasSprite(uITextureAtlasMemberID));
            this.m_main.SetNativeSize();
        }
        this.UpdateTimeRemaining();
    }
        public ActionResult GetTag()
        {
            var list = Enumerable.AsEnumerable(PostService.GetQuery(p => !string.IsNullOrEmpty(p.Label)).Select(p => p.Label).Distinct().Cacheable()).SelectMany(s => s.Split(',', ',')).OrderBy(s => s).ToHashSet();

            return(ResultData(list));
        }
Beispiel #28
0
 public IDbAsyncEnumerator <T> GetAsyncEnumerator()
 {
     return((IDbAsyncEnumerator <T>) new InMemoryDbAsyncEnumerator <T>(Enumerable.AsEnumerable <T>((IEnumerable <T>) this).GetEnumerator()));
 }
Beispiel #29
0
 public static Expression ApplyExpression(this LambdaExpression lambda, params Expression[] arguments)
 {
     return(ExpressionExtensions.Apply(lambda, Enumerable.AsEnumerable <Expression>((IEnumerable <Expression>)arguments)));
 }
Beispiel #30
0
 public virtual void TxBufferAdd(byte[] data)
 {
     txBuffer.AddRange(Enumerable.AsEnumerable <byte>(data));
 }