Exemplo n.º 1
0
        private static bool Validate(bool isShowAlert = true)
        {
            if (_data == null || !_data.Any()) //C# 6.0 → if(data?.Any() != true)return;
            {
                if (isShowAlert)
                {
                    UnityEditor.EditorUtility.DisplayDialog("Notice", "なにもコピーされていないようです", "OK");
                }
                return(false);
            }

            if (Selection.gameObjects.Length >= 2)
            {
                if (isShowAlert)
                {
                    UnityEditor.EditorUtility.DisplayDialog("Notice", "複数GameObjectへの同時ペーストは出来ません", "OK");
                }
                return(false);
            }

            if (Selection.gameObjects.Any() == false)
            {
                if (isShowAlert)
                {
                    UnityEditor.EditorUtility.DisplayDialog("Notice", "GameObjectが選択されていません", "OK");
                }
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        void getSelectedItems()
        {
            ArrayList r = null;

            if (this.SelectedCells != null)
            {
                var addList = new System.Collections.Generic.List <object>();

                System.Collections.Generic.List <int> hashCodeList = new System.Collections.Generic.List <int>();

                for (int i = 0; i < this.SelectedCells.Count; i++)
                {
                    int hashCode = this.SelectedCells[i].Item.GetHashCode();
                    if (hashCodeList.Any(q => q == hashCode) == false)
                    {
                        hashCodeList.Add(hashCode);
                        addList.Add(this.SelectedCells[i].Item);
                    }
                }

                if (hashCodeList.Count > 0)
                {
                    r = new ArrayList();
                    foreach (var item in addList)
                    {
                        r.Add(item);
                    }
                }
            }

            this.SelectedItems = r;
        }
Exemplo n.º 3
0
 /// <summary>
 /// 是不是所有店铺app都支持“货到付款”。
 /// </summary>
 /// <param name="appIds">店铺appId</param>
 /// <returns>是不是所有店铺app都支持“货到付款”</returns>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <bool> IsAllAppSupportCODExt(System.Collections.Generic.List <System.Guid> appIds)
 {
     Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO <bool> result = new ResultDTO <bool>();
     result.Data = false;
     try
     {
         if (appIds == null || (!appIds.Any()))
         {
             result.ResultCode = 1;
             result.Message    = "参数错误,参数不能为空!";
             return(result);
         }
         //“货到付款” 支付方式Id => 79016C71-4785-4D79-85EB-4AE0096F0969
         var codPaymentId = new Guid("79016C71-4785-4D79-85EB-4AE0096F0969");
         var count        = (from p in Payments.ObjectSet()
                             where appIds.Contains(p.AppId.HasValue ? p.AppId.Value : Guid.Empty) &&
                             p.PaymentId == codPaymentId && p.IsOnuse
                             select p.AppId).Distinct().Count();
         if (count == appIds.Count)
         {
             result.Data = true;
         }
     }
     catch (Exception ex)
     {
         LogHelper.Error("IsAllAppSupportCODExt异常,异常信息:", ex);
         result.Message    = "服务异常";
         result.ResultCode = -1;
     }
     return(result);
 }
Exemplo n.º 4
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper> GetVolumePerLSPImplementation(string Name)
 {
     System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper> ChartElement = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper>();
     foreach (var i in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>((a) => a.Shipper == Name) ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>())
     {
         zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "API", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, i?.Carrier != "");
         if ((i?.Carrier != ""))
         {
             decimal?OrderVolume = (i?.Get_AggregateVolume() ?? 0);
             var     _var0       = i?.Carrier;
             if ((ChartElement?.Any((a) => a.Description == _var0) ?? false))
             {
                 var _var1 = i?.Carrier;
                 ChartElement.FirstOrDefault((a) => a.Description == i.Carrier).Volume = (ChartElement?.FirstOrDefault((a) => a.Description == _var1)?.Volume ?? 0) + OrderVolume.GetValueOrDefault(0);
             }
             else
             {
                 DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper GraphElement = new DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper();
                 GraphElement.Description = (i?.Carrier ?? "");
                 GraphElement.Volume      = OrderVolume;
                 ChartElement?.Add(GraphElement);
             }
         }
     }
     return(ChartElement);
 }
Exemplo n.º 5
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper> GetVolumePerUnitImplementation(string Name)
 {
     System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper> VolumeSpreadChart = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper>();
     foreach (var i in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>((a) => a.Shipper == Name) ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>())
     {
         foreach (var j in i?.PlannedVolume ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.CustomVolume>())
         {
             foreach (var k in j?.VolumeComposition ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumeComposition>())
             {
                 var _var2 = k?.VolumeComponent?.Name;
                 if ((VolumeSpreadChart?.Any((a) => a.Description == _var2) ?? false))
                 {
                     var _var3 = k?.VolumeComponent?.Name;
                     VolumeSpreadChart.FirstOrDefault((a) => a.Description == k.VolumeComponent.Name).Volume = (VolumeSpreadChart?.FirstOrDefault((a) => a.Description == _var3)?.Volume ?? 0) + 1;
                 }
                 else
                 {
                     DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper GraphElement = new DSS3_LogisticsPoolingForUrbanDistribution.BO.VolumePerShipper();
                     GraphElement.Description = (k?.VolumeComponent?.Name ?? "");
                     GraphElement.Volume      = 1;
                     VolumeSpreadChart?.Add(GraphElement);
                 }
             }
         }
     }
     return(VolumeSpreadChart);
 }
Exemplo n.º 6
0
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.CO2PerCarrier> CO2PerCarrierImplementation(string Name)
 {
     System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.CO2PerCarrier> ChartElement = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.CO2PerCarrier>();
     foreach (var i in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>((a) => a.Shipper == Name) ?? Enumerable.Empty <DSS3_LogisticsPoolingForUrbanDistribution.BO.ShippingOrder>())
     {
         if ((i?.Carrier != ""))
         {
             decimal?OrderVolume = (i?.Get_AggregateVolume() ?? 0);
             var     _var4       = i?.Carrier;
             if ((ChartElement?.Any((a) => a.Description == _var4) ?? false))
             {
                 var _var5 = i?.Carrier;
                 ChartElement.FirstOrDefault((a) => a.Description == i.Carrier).KgCO2 = (ChartElement?.FirstOrDefault((a) => a.Description == _var5)?.KgCO2 ?? 0) + OrderVolume.GetValueOrDefault(0);
             }
             else
             {
                 DSS3_LogisticsPoolingForUrbanDistribution.BO.CO2PerCarrier GraphElement = new DSS3_LogisticsPoolingForUrbanDistribution.BO.CO2PerCarrier();
                 GraphElement.Description = (i?.Carrier ?? "");
                 GraphElement.KgCO2       = OrderVolume.GetValueOrDefault(0) * 5.8m;
                 ChartElement?.Add(GraphElement);
             }
         }
     }
     return(ChartElement);
 }
#pragma warning disable EF1001 // Internal EF Core API usage.
        /// <summary>
        /// Checks all the ValueObject properties and configures it as Owned
        /// </summary>
        /// <param name="modelBuilder"></param>
        protected virtual void ConfigureAllValueObjectAsOwned(ModelBuilder modelBuilder)
        {
            //var navigationToValueObjects = modelBuilder.Model.GetEntityTypes()
            //    .SelectMany(et => et.GetNavigations()
            //        .Where(n => typeof(ValueObject).IsAssignableFrom(n.GetTargetType().ClrType)))
            //    .Select(n => n.ClrType)
            //    .Distinct()
            //    .ToList();

            //if (navigationToValueObjects.Any())
            //{
            //    foreach (Type valueObject in navigationToValueObjects)
            //    {
            //        modelBuilder.Owned(valueObject);
            //    }
            //}

            // Versión Entity Framework Core 3.x
            foreach (IMutableEntityType e in modelBuilder.Model.GetEntityTypes())
            {
                System.Collections.Generic.List <IMutableNavigation> navigationToValueObjects = e.GetNavigations().Where(n => typeof(ValueObject).IsAssignableFrom(n.GetTargetType().ClrType)).ToList();
                if (navigationToValueObjects.Any())
                {
                    EntityTypeBuilder builder = new EntityTypeBuilder(e);
                    foreach (IMutableNavigation ownedNavigation in navigationToValueObjects)
                    {
                        builder.OwnsOne(ownedNavigation.GetTargetType().ClrType, ownedNavigation.Name);
                        Console.WriteLine();
                    }
                }
            }
        }
Exemplo n.º 8
0
        void DrawInputSlots(Rect dotRect)
        {
            foreach (var slots in Inputs)
            {
            }

            return;

            ParentDotRect.Set(
                dotRect.xMin - ConnectorSize.x * 0.5f,
                dotRect.center.y - ConnectorSize.y * 0.5f,
                ConnectorSize.x,
                ConnectorSize.y
                );

            GUI.Box
            (
                ParentDotRect,
                GUIContent.none, SpaceEditorStyles.DotFlowTarget
            );

            if (Parents.Any())
            {
                GUI.color = GetParentConnectColor(Parents.FirstOrDefault(p => p.From.Owner.Selected)?.From.Owner);
                GUI.Box
                (
                    ParentDotRect,
                    GUIContent.none, SpaceEditorStyles.DotFlowTargetFill
                );
            }
        }
Exemplo n.º 9
0
        public void GetLocalNetworkInterfaces_Succeeds()
        {
            System.Collections.Generic.List <MultiMiner.Utility.Net.LocalNetwork.NetworkInterfaceInfo> localNetworkInterfaces = null;

            localNetworkInterfaces = Utility.Net.LocalNetwork.GetLocalNetworkInterfaces();

            Assert.IsTrue(localNetworkInterfaces.Any());
        }
Exemplo n.º 10
0
        public static System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints> InitMapPoints(bool allOrders, string raCode, bool allRAs){using (new zAppDev.DotNet.Framework.Profiling.Profiler("MapPoints", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "InitMapPoints")) {
System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints> mapPoints = new System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints>();
try {
System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS> or = new System.Collections.Generic.List<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>();
if ((allOrders)) {
var _count0 = 0;or = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>(1, 30,out _count0).ToList();}
else {
if ((raCode != null)) {
or?.AddRange(new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().Get<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>((ord) => ord.OrdAgencyCode == raCode));
}
}
foreach (var order in or ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.OrderWMS>()) {
var _var0 = order?.Warehouse;DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse warehouse = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable<DSS3_LogisticsPoolingForUrbanDistribution.BO.Warehouse>((wr) => wr.Title == _var0)?.FirstOrDefault();
if ((warehouse?.GeoCoordinates != null)) {
float? originLat = (warehouse?.GeoCoordinates?.Latitude ?? 0);
float? originLong = (warehouse?.GeoCoordinates?.Longitude ?? 0);
if ((((((mapPoints?.Any((mp) => mp.Lat == originLat && mp.Long == originLong) ?? false))) == false))) {
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints warehouseMapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
warehouseMapPoint.Lat = originLat;warehouseMapPoint.Long = originLong;warehouseMapPoint.Title = (warehouse?.Title ?? "");warehouseMapPoint.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/industries.png";mapPoints?.Add(warehouseMapPoint);
}
}
}
if ((allRAs)) {
foreach (var regionalAgent in new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAll<DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>() ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>()) {
foreach (var truck in regionalAgent?.Trucks ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>()) {
if ((truck?.CurrentLocation == null)) {
continue;}
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPointTruck = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPointTruck.Lat = (truck?.CurrentLocation?.Latitude ?? 0);mapPointTruck.Long = (truck?.CurrentLocation?.Longitude ?? 0);mapPointTruck.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/transport.png";mapPointTruck.Type = "Truck";mapPointTruck.Title = (truck?.PlateNumber ?? "");mapPoints?.Add(mapPointTruck);
}
if ((regionalAgent?.AddressCoordinates == null)) {
continue;}
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPoint.Lat = (regionalAgent?.AddressCoordinates?.Latitude ?? 0);mapPoint.Long = (regionalAgent?.AddressCoordinates?.Longitude ?? 0);mapPoint.Title = (regionalAgent?.AgencyDescription ?? "");mapPoint.Type = "RegionalAgent";mapPoint.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/industries.png";mapPoints?.Add(mapPoint);
}
}
else {
if (((((raCode == null || raCode == "")) == false))) {
DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent regionalAgent = new DSS3_LogisticsPoolingForUrbanDistribution.DAL.Repository().GetAsQueryable<DSS3_LogisticsPoolingForUrbanDistribution.BO.RegionalAgent>((rag) => rag.AgencyCode == raCode)?.FirstOrDefault();
if ((regionalAgent?.AddressCoordinates != null)) {
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPoint = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPoint.Lat = (regionalAgent?.AddressCoordinates?.Latitude ?? 0);mapPoint.Long = (regionalAgent?.AddressCoordinates?.Longitude ?? 0);mapPoint.Title = (regionalAgent?.AgencyDescription ?? "");mapPoint.Type = "RegionalAgent";mapPoint.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/industries.png";mapPoints?.Add(mapPoint);
foreach (var truck in regionalAgent?.Trucks ?? Enumerable.Empty<DSS3_LogisticsPoolingForUrbanDistribution.BO.Truck>()) {
if ((truck?.CurrentLocation == null)) {
continue;}
DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints mapPointTruck = new DSS3_LogisticsPoolingForUrbanDistribution.BO.MapPoints();
mapPointTruck.Lat = (truck?.CurrentLocation?.Latitude ?? 0);mapPointTruck.Long = (truck?.CurrentLocation?.Longitude ?? 0);mapPointTruck.Icon = "http://apps.zappdev.com/SARMEDAgentPortal_1215_vvasilopoulos/Resources/Images/transport.png";mapPointTruck.Type = "Truck";mapPointTruck.Title = (truck?.PlateNumber ?? "");mapPoints?.Add(mapPointTruck);
}
}
}
}
}
catch (System.Exception x) {
zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Error, "MapPoints",  DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, x);
}
return mapPoints;
}
}
Exemplo n.º 11
0
        public void SplitEmptyString()
        {
            TaggedText t = new TaggedText("");

            System.Collections.Generic.List <string> result = t.SplitByClicks();

            Assert.IsNotNull(result, "Returned a null list.");
            Assert.IsFalse(result.Any(), "List contained results.");
        }
Exemplo n.º 12
0
        public bool CierraEstudiosPersonalidad(System.Collections.Generic.List <PERSONALIDAD> lstEstudiosCerrar)
        {
            try
            {
                if (lstEstudiosCerrar == null)
                {
                    return(false);
                }

                if (lstEstudiosCerrar.Any())
                {
                    using (System.Transactions.TransactionScope transaccion = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.RequiresNew, new System.Transactions.TransactionOptions()
                    {
                        IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted
                    }))
                    {
                        foreach (var item in lstEstudiosCerrar)
                        {
                            var _EstudioActual = Context.PERSONALIDAD.FirstOrDefault(x => x.ID_ANIO == item.ID_ANIO && x.ID_CENTRO == item.ID_CENTRO && x.ID_INGRESO == item.ID_INGRESO && x.ID_IMPUTADO == item.ID_IMPUTADO && x.ID_ESTUDIO == item.ID_ESTUDIO);

                            if (_EstudioActual != null)
                            {
                                _EstudioActual.ID_ANIO              = item.ID_ANIO;
                                _EstudioActual.ID_CENTRO            = item.ID_CENTRO;
                                _EstudioActual.ID_ESTUDIO           = item.ID_ESTUDIO;
                                _EstudioActual.ID_IMPUTADO          = item.ID_IMPUTADO;
                                _EstudioActual.ID_INGRESO           = item.ID_INGRESO;
                                _EstudioActual.ID_MOTIVO            = item.ID_MOTIVO;
                                _EstudioActual.ID_SITUACION         = item.RESULT_ESTUDIO == "True" ? short.Parse((3).ToString()) : short.Parse((5).ToString());
                                _EstudioActual.INICIO_FEC           = item.INICIO_FEC;
                                _EstudioActual.SOLICITADO           = item.SOLICITADO;
                                _EstudioActual.SOLICITUD_FEC        = item.SOLICITUD_FEC;
                                _EstudioActual.TERMINO_FEC          = item.TERMINO_FEC;
                                _EstudioActual.PROG_NOMBRE          = item.PROG_NOMBRE;
                                _EstudioActual.NUM_OFICIO           = item.NUM_OFICIO;
                                _EstudioActual.ID_AREA              = item.ID_AREA;
                                Context.Entry(_EstudioActual).State = System.Data.EntityState.Modified;
                            }
                        }
                        ;

                        Context.SaveChanges();
                        transaccion.Complete();
                        return(true);
                    }
                }
            }
            catch (System.Exception)
            {
                return(false);
            }

            return(false);
        }
Exemplo n.º 13
0
        public Query AsCount(params string[] columns)
        {
            System.Collections.Generic.List <string> cols = columns.ToList();

            if (!cols.Any())
            {
                cols.Add("*");
            }

            return(AsAggregate("count", cols.ToArray()));
        }
Exemplo n.º 14
0
        private PermisosCRUD Permisos(string modulo)
        {
            PermisosCRUD permiso = new PermisosCRUD();

            System.Collections.Generic.List <System.Security.Claims.Claim> permisos = User.Claims
                                                                                      .Where(w => w.Type.Equals(modulo) && w.Value.Contains("Maestro Administrativo")).ToList();
            permiso.PSMAPB = permisos.Where(w => w.Value.Contains("Contratacion")).Any();
            permiso.PMMAPB = permisos.Any();
            permiso.PMMAPL = permisos;
            return(permiso);
        }
Exemplo n.º 15
0
 public void TestDungeonWithWater()
 {
     //MpqManager.Initialize("S:\\World of Warcraft");
     var wdt = new WDT("world\\maps\\orgrimmarinstance\\orgrimmarinstance.wdt");
     Assert.IsTrue(wdt.IsValid && wdt.IsGlobalModel);
     var file = wdt.ModelFile;
     var model = new WorldModelRoot(file);
     var verts = new System.Collections.Generic.List<Vector3>();
     var tris = new System.Collections.Generic.List<Triangle<uint>>();
     WorldModelHandler.InsertModelGeometry(verts, tris, wdt.ModelDefinition, model);
     Assert.IsFalse(verts.Any(v => float.IsNaN(v.X) || float.IsNaN(v.Y) || float.IsNaN(v.Z)));
 }
Exemplo n.º 16
0
        // GET: api/Cards
        public IHttpActionResult GetAllCards()
        {
            System.Collections.Generic.List <CreditCardViewModel> cards = DbContext.CreditCards
                                                                          .Select(p => new CreditCardViewModel
            {
                Id = p.Id,
                IdentificationNumber = p.IdentificationNumber,
                Brand = p.Brand
            }).ToList();

            return(cards.Any() ? Ok(cards) : (IHttpActionResult)NotFound());
        }
Exemplo n.º 17
0
        public void VerifyCosmosClientOptionsHasNonePublicNonVirtualSetMethods()
        {
            // All of the public properties and methods should be virtual to allow users to
            // create unit tests by mocking the different types.
            Type type = typeof(CosmosClientOptions);


            System.Collections.Generic.List <PropertyInfo> publicProperties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance)
                                                                              .Where(x => x.GetSetMethod() != null && x.GetSetMethod().IsPublic&& (!x.GetMethod.IsVirtual || !x.SetMethod.IsVirtual)).ToList();

            Assert.IsFalse(publicProperties.Any(), $"CosmosClientOptions should be read only. These are public {string.Join(";", publicProperties.Select(x => x.Name))}");
        }
Exemplo n.º 18
0
 public void TestDungeonWithWater()
 {
     MpqManager.Initialize("S:\\World of Warcraft");
     var wdt = new WDT("world\\maps\\orgrimmarinstance\\orgrimmarinstance.wdt");
     Assert.IsTrue(wdt.IsValid && wdt.IsGlobalModel);
     var file = wdt.ModelFile;
     var model = new WorldModelRoot(file);
     var verts = new System.Collections.Generic.List<Vector3>();
     var tris = new System.Collections.Generic.List<Triangle<uint>>();
     WorldModelHandler.InsertModelGeometry(verts, tris, wdt.ModelDefinition, model);
     Assert.IsFalse(verts.Any(v => float.IsNaN(v.X) || float.IsNaN(v.Y) || float.IsNaN(v.Z)));
 }
Exemplo n.º 19
0
        public async System.Threading.Tasks.Task <SoftmakeAll.SDK.OperationResult> CopyAsync(System.String SourceBucketName, System.String[] SourceStorageFileNames, System.String TargetBucketName, System.String[] TargetStorageFileNames, System.Boolean Overwrite)
        {
            SoftmakeAll.SDK.CloudStorage.AWS.Environment.Validate();

            SoftmakeAll.SDK.OperationResult OperationResult = new SoftmakeAll.SDK.OperationResult();

            if ((System.String.IsNullOrWhiteSpace(SourceBucketName)) || (SourceStorageFileNames == null) || (SourceStorageFileNames.Length == 0) || (System.String.IsNullOrWhiteSpace(TargetBucketName)) || (TargetStorageFileNames == null) || (TargetStorageFileNames.Length == 0))
            {
                OperationResult.Message = "The SourceBucketName, SourceStorageFileNames, TargetBucketName and TargetStorageFileNames cannot be null.";
                return(OperationResult);
            }

            if (SourceStorageFileNames.Length != TargetStorageFileNames.Length)
            {
                OperationResult.Message = "The SourceStorageFileNames and TargetStorageFileNames must be the same length.";
                return(OperationResult);
            }

            try
            {
                using (System.Threading.SemaphoreSlim SemaphoreSlim = new System.Threading.SemaphoreSlim(SourceStorageFileNames.Length))
                {
                    System.Collections.Generic.List <System.Threading.Tasks.Task> CopyTasks = new System.Collections.Generic.List <System.Threading.Tasks.Task>();
                    for (System.Int32 i = 0; i < SourceStorageFileNames.Length; i++)
                    {
                        await SemaphoreSlim.WaitAsync();

                        CopyTasks.Add(System.Threading.Tasks.Task.Run(async() =>
                        {
                            await SoftmakeAll.SDK.CloudStorage.AWS.Environment._S3Client.CopyObjectAsync(new Amazon.S3.Model.CopyObjectRequest {
                                SourceBucket = SourceBucketName, SourceKey = SourceStorageFileNames[i], DestinationBucket = TargetBucketName, DestinationKey = TargetStorageFileNames[i]
                            });
                            SemaphoreSlim.Release();
                        }));
                    }

                    if (CopyTasks.Any())
                    {
                        await System.Threading.Tasks.Task.WhenAll(CopyTasks);
                    }
                }
            }
            catch (System.Exception ex)
            {
                OperationResult.Message = ex.Message;
                return(OperationResult);
            }

            OperationResult.ExitCode = 0;
            return(OperationResult);
        }
Exemplo n.º 20
0
        public ActionResult Save(int id)
        {
            Webpage webpage = _documentService.GetDocument <Webpage>(id);

            if (webpage.IsDeleted)
            {
                return(new EmptyResult());
            }
            System.Collections.Generic.List <string> saveFormData = _formPostingHandler.SaveFormData(webpage, Request);

            TempData["form-submitted"]         = true;
            TempData["form-submitted-message"] = saveFormData;
            // if any errors add form data to be renderered, otherwise form should be empty
            TempData["form-data"] = saveFormData.Any() ? Request.Form : null;

            string redirectUrl = Referrer.ToString();

            if (!string.IsNullOrEmpty(webpage.FormRedirectUrl) && !saveFormData.Any())
            {
                redirectUrl = webpage.FormRedirectUrl;
            }
            return(Redirect(redirectUrl));
        }
Exemplo n.º 21
0
        public void WriteParametersWithoutAccessModifierInMethodOrConstructor(System.Collections.Generic.List <Pattern.Model.Parameter> parameters)
        {
            if (parameters != null && parameters.Any())
            {
                for (int i = 0; i < parameters.Count; i++)
                {
        #line default
        #line hidden

        #line 57 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(parameters[i].ParameterType));


        #line default
        #line hidden

        #line 57 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    this.Write(" ");


        #line default
        #line hidden

        #line 57 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(parameters[i].ParameterName));


        #line default
        #line hidden

        #line 57 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    if (i != (parameters.Count - 1))
                    {
        #line default
        #line hidden

        #line 57 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                        this.Write(",\r\n   ");


        #line default
        #line hidden

        #line 58 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    }
                }
            }
        }
        public void AnalyzeInvocationForIgnoredReturnValue(SyntaxNodeAnalysisContext context, ImmutableArray <INamedTypeSymbol> immutableTypeSymbols)
        {
            SemanticModel model = context.SemanticModel;
            var           candidateInvocation = (InvocationExpressionSyntax)context.Node;

            //We're looking for invocations that are direct children of expression statements
            if (!(candidateInvocation.Parent.IsKind(SyntaxKind.ExpressionStatement)))
            {
                return;
            }

            //If we can't find the method symbol, quit
            var methodSymbol = model.GetSymbolInfo(candidateInvocation).Symbol as IMethodSymbol;

            if (methodSymbol == null)
            {
                return;
            }

            //If the method doesn't start with something like "With" or "Replace", quit
            string methodName = methodSymbol.Name;

            if (!s_immutableMethodNames.Any(n => methodName.StartsWith(n)))
            {
                return;
            }

            //If we're not in one of the known immutable types, quit
            var parentType = methodSymbol.ReceiverType as INamedTypeSymbol;

            if (parentType == null)
            {
                return;
            }

            System.Collections.Generic.List <INamedTypeSymbol> baseTypesAndSelf = methodSymbol.ReceiverType.GetBaseTypes().ToList();
            baseTypesAndSelf.Add(parentType);

            if (!baseTypesAndSelf.Any(n => immutableTypeSymbols.Contains(n)))
            {
                return;
            }

            Location   location   = candidateInvocation.GetLocation();
            Diagnostic diagnostic = Diagnostic.Create(DoNotIgnoreReturnValueDiagnosticRule, location, methodSymbol.ReceiverType.Name, methodSymbol.Name);

            context.ReportDiagnostic(diagnostic);
        }
Exemplo n.º 23
0
        public void AssignValuesFromParameters(System.Collections.Generic.List <Pattern.Model.Parameter> parameters)
        {
            if (parameters != null && parameters.Any())
            {
                for (int i = 0; i < parameters.Count; i++)
                {
        #line default
        #line hidden

        #line 87 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    this.Write("\tthis.");


        #line default
        #line hidden

        #line 88 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(parameters[i].ParameterName));


        #line default
        #line hidden

        #line 88 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    this.Write(" = ");


        #line default
        #line hidden

        #line 88 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    this.Write(this.ToStringHelper.ToStringWithCulture(parameters[i].ParameterName));


        #line default
        #line hidden

        #line 88 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                    this.Write(";\r\n   ");


        #line default
        #line hidden

        #line 89 "C:\Users\Admin\source\repos\Pattern\Pattern\Template\ClassTemplate.tt"
                }
            }
        }
Exemplo n.º 24
0
        public async System.Threading.Tasks.Task <SoftmakeAll.SDK.OperationResult> DeleteAsync(System.String ShareName, System.String[] StorageFileNames)
        {
            SoftmakeAll.SDK.CloudStorage.Azure.Environment.Validate();

            SoftmakeAll.SDK.OperationResult OperationResult = new SoftmakeAll.SDK.OperationResult();

            if ((System.String.IsNullOrWhiteSpace(ShareName)) || (StorageFileNames == null) || (StorageFileNames.Length == 0))
            {
                OperationResult.Message = "The ShareName and StorageFileName cannot be null.";
                return(OperationResult);
            }

            try
            {
                global::Azure.Storage.Files.Shares.ShareClient          ShareClient          = new global::Azure.Storage.Files.Shares.ShareClient(SoftmakeAll.SDK.CloudStorage.Azure.Environment._ConnectionString, ShareName);
                global::Azure.Storage.Files.Shares.ShareDirectoryClient ShareDirectoryClient = ShareClient.GetRootDirectoryClient();

                using (System.Threading.SemaphoreSlim SemaphoreSlim = new System.Threading.SemaphoreSlim(StorageFileNames.Length))
                {
                    System.Collections.Generic.List <System.Threading.Tasks.Task> DeleteTasks = new System.Collections.Generic.List <System.Threading.Tasks.Task>();
                    foreach (System.String StorageFileName in StorageFileNames)
                    {
                        global::Azure.Storage.Files.Shares.ShareFileClient ShareFileClient = ShareDirectoryClient.GetFileClient(StorageFileName);
                        if (!(await ShareFileClient.ExistsAsync()))
                        {
                            continue;
                        }

                        await SemaphoreSlim.WaitAsync();

                        DeleteTasks.Add(System.Threading.Tasks.Task.Run(async() => { await ShareFileClient.DeleteAsync(); SemaphoreSlim.Release(); }));
                    }

                    if (DeleteTasks.Any())
                    {
                        await System.Threading.Tasks.Task.WhenAll(DeleteTasks);
                    }
                }
            }
            catch (System.Exception ex)
            {
                OperationResult.Message = ex.Message;
                return(OperationResult);
            }

            OperationResult.ExitCode = 0;
            return(OperationResult);
        }
Exemplo n.º 25
0
        private static void PrintResult(System.Collections.Generic.List <Coordinate> result)
        {
            var origForeGroundColor = Console.ForegroundColor;

            Console.WriteLine("====================");
            if (result.Any())
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Way throuhg maze successfully found");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("No way through maze found");
            }

            Console.ForegroundColor = origForeGroundColor;
        }
Exemplo n.º 26
0
            public ConnectorObjects(System.String ConnectionString, System.String ProcedureNameOrCommandText, System.Collections.Generic.List <System.Data.Common.DbParameter> Parameters, System.Data.CommandType CommandType, System.Boolean ExecuteForJSON, System.Boolean ShowPlan, System.Boolean ReadSummaries) : base(ConnectionString, ref ProcedureNameOrCommandText, Parameters, CommandType, ExecuteForJSON, ShowPlan, ReadSummaries)
            {
                this.Connection = new MySql.Data.MySqlClient.MySqlConnection(ConnectionString);
                this.Command    = new MySql.Data.MySqlClient.MySqlCommand(ProcedureNameOrCommandText, this.Connection)
                {
                    CommandTimeout = SoftmakeAll.SDK.DataAccess.MySQL.Environment.CommandsTimeout,
                    CommandType    = CommandType,
                };

                if (ShowPlan)
                {
                    return;
                }

                if (ReadSummaries)
                {
                    this.Command.Parameters.Add(new MySql.Data.MySqlClient.MySqlParameter("$Count", MySql.Data.MySqlClient.MySqlDbType.Int32)
                    {
                        Direction = System.Data.ParameterDirection.Output
                    });
                    this.Command.Parameters.Add(new MySql.Data.MySqlClient.MySqlParameter("$ID", MySql.Data.MySqlClient.MySqlDbType.VarChar, 255)
                    {
                        Direction = System.Data.ParameterDirection.Output
                    });
                    this.Command.Parameters.Add(new MySql.Data.MySqlClient.MySqlParameter("$Message", MySql.Data.MySqlClient.MySqlDbType.VarString, -1)
                    {
                        Direction = System.Data.ParameterDirection.Output
                    });
                    this.Command.Parameters.Add(new MySql.Data.MySqlClient.MySqlParameter("$ExitCode", MySql.Data.MySqlClient.MySqlDbType.Int16)
                    {
                        Direction = System.Data.ParameterDirection.Output
                    });
                }

                if ((Parameters != null) && (Parameters.Any()))
                {
                    foreach (System.Data.Common.DbParameter Parameter in Parameters)
                    {
                        Parameter.Value = Parameter.Value ?? System.Convert.DBNull;
                        this.Command.Parameters.Add(Parameter);
                    }
                }
            }
Exemplo n.º 27
0
 public void SetupPorts()
 {
     _ports      = System.IO.Ports.SerialPort.GetPortNames().OrderBy(s => s).ToList();
     _portNumber = 0;
     if (_ports.Any())
     {
         SetupDataPath();
         TrialSerialPort(_portNumber);
     }
     else
     {
         if (Navigatedisplay.DeviceStarted)
         {
             return;
         }
         var device = new NmeaParser.NmeaFileDevice("20180628.txt");
         StartDevice(device);
         Navigatedisplay.DeviceStarted = true;
     }
 }
Exemplo n.º 28
0
        // https://gist.github.com/GeorgDangl/4a9982a3b520f056a9e890635b3695e0
        private static void ThrowExceptionIfCompilationFailure(Microsoft.CodeAnalysis.Emit.EmitResult result)
        {
            if (!result.Success)
            {
                System.Collections.Generic.List <Microsoft.CodeAnalysis.Diagnostic> compilationErrors =
                    result.Diagnostics.Where(diagnostic =>
                                             diagnostic.IsWarningAsError ||
                                             diagnostic.Severity == Microsoft.CodeAnalysis.DiagnosticSeverity.Error)
                    .ToList();

                if (compilationErrors.Any())
                {
                    Microsoft.CodeAnalysis.Diagnostic firstError = compilationErrors.First();
                    string errorNumber       = firstError.Id;
                    string errorDescription  = firstError.GetMessage();
                    string firstErrorMessage = $"{errorNumber}: {errorDescription};";
                    throw new System.Exception($"Compilation failed, first error is: {firstErrorMessage}");
                }
            }
        }
Exemplo n.º 29
0
            public ConnectorObjects(System.String ConnectionString, System.String ProcedureNameOrCommandText, System.Collections.Generic.List <System.Data.Common.DbParameter> Parameters, System.Data.CommandType CommandType, System.Boolean ExecuteForJSON, System.Boolean ShowPlan, System.Boolean ReadSummaries) : base(ConnectionString, ref ProcedureNameOrCommandText, Parameters, CommandType, ExecuteForJSON, ShowPlan, ReadSummaries)
            {
                this.Connection = new Npgsql.NpgsqlConnection(ConnectionString);
                this.Command    = new Npgsql.NpgsqlCommand(ProcedureNameOrCommandText, this.Connection)
                {
                    CommandTimeout = SoftmakeAll.SDK.DataAccess.PostgreSQL.Environment.CommandsTimeout,
                    CommandType    = CommandType,
                };

                System.Boolean HasShowResultsTableParameter = false;
                if ((Parameters != null) && (Parameters.Any()))
                {
                    foreach (System.Data.Common.DbParameter Parameter in Parameters)
                    {
                        if (Parameter.ParameterName == "ShowResultsTable")
                        {
                            HasShowResultsTableParameter = true;
                        }

                        Parameter.Value = Parameter.Value ?? System.Convert.DBNull;
                        this.Command.Parameters.Add(Parameter);
                    }
                }

                if (!(ReadSummaries))
                {
                    return;
                }

                if ((CommandType == System.Data.CommandType.StoredProcedure) && (!(HasShowResultsTableParameter)))
                {
                    this.Command.Parameters.Add(new Npgsql.NpgsqlParameter
                    {
                        Direction     = System.Data.ParameterDirection.Input,
                        ParameterName = "ShowResultsTable",
                        NpgsqlDbType  = NpgsqlTypes.NpgsqlDbType.Bit,
                        Size          = 0,
                        Value         = true
                    });
                }
            }
Exemplo n.º 30
0
        protected void Update()
        {
            if (State != NodeState.Running)
            {
                return;
            }

            bool isReturn = nodes.Count(x => x.State == NodeState.Succeed || x.State == NodeState.Disable) != nodes.Count;

            if (nodes.Any(x => x.State == NodeState.Failed))
            {
                FinishNode(NodeState.Failed, NodeState.Disable);
            }

            if (isReturn)
            {
                return;
            }

            FinishNode(NodeState.Succeed, NodeState.Succeed);
        }
Exemplo n.º 31
0
        public override HealthCheckResult PerformCheck()
        {
            System.Collections.Generic.IList <ScheduledTask> tasks        = _session.QueryOver <ScheduledTask>().List();
            System.Collections.Generic.List <ScheduledTask>  stalledTasks = tasks.Where(x => x.LastComplete <= CurrentRequestData.Now.AddSeconds(-(x.EveryXSeconds + 120)) || x.LastComplete == null).ToList();

            if (stalledTasks.Any())
            {
                System.Collections.Generic.List <string> messages = stalledTasks.Select(task =>
                {
                    DateTime?lastComplete = task.LastComplete;
                    return(lastComplete.HasValue
                        ? string.Format("{0} has not been ran since {1}", task.TypeName, lastComplete)
                        : string.Format("{0} has never been run", task.TypeName));
                }).ToList();
                return(new HealthCheckResult
                {
                    Messages = messages,
                    OK = false
                });
            }
            return(HealthCheckResult.Success);
        }
Exemplo n.º 32
0
        /// <summary>
        ///     Setup the "Samples" sub-menu with contents of samples directory.
        /// </summary>
        private void LoadSamplesMenu()
        {
            var samplesDirectory = dynamoViewModel.Model.PathManager.SamplesDirectory;
            if (Directory.Exists(samplesDirectory))
            {
                var sampleFiles = new System.Collections.Generic.List<string>();
                string[] dirPaths = Directory.GetDirectories(samplesDirectory);
                string[] filePaths = Directory.GetFiles(samplesDirectory, "*.dyn");

                // handle top-level files
                if (filePaths.Any())
                {
                    foreach (string path in filePaths)
                    {
                        var item = new MenuItem
                        {
                            Header = Path.GetFileNameWithoutExtension(path),
                            Tag = path
                        };
                        item.Click += OpenSample_Click;
                        SamplesMenu.Items.Add(item);
                        sampleFiles.Add(path);
                    }
                }

                // handle top-level dirs, TODO - factor out to a seperate function, make recusive
                if (dirPaths.Any())
                {
                    foreach (string dirPath in dirPaths)
                    {
                        var dirItem = new MenuItem
                        {
                            Header = Path.GetFileName(dirPath),
                            Tag = Path.GetFileName(dirPath)
                        };

                        filePaths = Directory.GetFiles(dirPath, "*.dyn");
                        if (filePaths.Any())
                        {
                            foreach (string path in filePaths)
                            {
                                var item = new MenuItem
                                {
                                    Header = Path.GetFileNameWithoutExtension(path),
                                    Tag = path
                                };
                                item.Click += OpenSample_Click;
                                dirItem.Items.Add(item);
                                sampleFiles.Add(path);
                            }
                        }
                        SamplesMenu.Items.Add(dirItem);
                    }
                }

                if (dirPaths.Any())
                {
                    var showInFolder = new MenuItem
                    {
                        Header = Wpf.Properties.Resources.DynamoViewHelpMenuShowInFolder,
                        Tag = dirPaths[0]
                    };
                    showInFolder.Click += OnShowInFolder;
                    SamplesMenu.Items.Add(new Separator());
                    SamplesMenu.Items.Add(showInFolder);
                }

                if (sampleFiles.Any() && startPage != null)
                {
                    var firstFilePath = Path.GetDirectoryName(sampleFiles.ToArray()[0]);
                    var rootPath = Path.GetDirectoryName(firstFilePath);
                    var root = new DirectoryInfo(rootPath);
                    var rootProperty = new SampleFileEntry("Samples", "Path");
                    startPage.WalkDirectoryTree(root, rootProperty);
                    startPage.SampleFiles.Add(rootProperty);
                }
            }
        }
        private void additionalValidationButton_Click(object sender, RoutedEventArgs e)
		{
			bool isClearButton = ((System.Windows.Controls.Control)sender).Name.Contains("clear", StringComparison.OrdinalIgnoreCase);
			System.Collections.Generic.List<string> selectedItems = new System.Collections.Generic.List<string>();
			string selectedItemsCombined = string.Empty;
			var messageBox = MessageBoxResult.None;
			var varItemsCount = this.validationDirListView.Items.Count > 0;
			switch(isClearButton)
			{
				case false:
					if (this.validationDirListView.SelectedItems.Count > 0 && varItemsCount)
					{
						for (int position = 0, maxItemsCount = this.validationDirListView.SelectedItems.Count; position < maxItemsCount; position++)
						{
							var currentItem = this.validationDirListView.SelectedItems[position];
							selectedItems.Add(currentItem.ToString());
							selectedItemsCombined += string.Format(CultureInfo.InvariantCulture, "'{0}'{1}", currentItem, position < maxItemsCount - 1 ? ", " : string.Empty);
						}
						messageBox = Xceed.Wpf.Toolkit.MessageBox.Show(string.Format(CultureInfo.CurrentCulture, "Are you sure you want to remove the following directories: {0}?", selectedItemsCombined), "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
					}
					else if (this.validationDirListView.Items.Count <= 0)
					{
						Xceed.Wpf.Toolkit.MessageBox.Show("You cannot remove items from an empty list.", "Generic Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
					}
					else
					{
						Xceed.Wpf.Toolkit.MessageBox.Show("There must be an item selected to remove it from the list.", "Generic Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
					}
					break;
				case true:
					messageBox = varItemsCount ? Xceed.Wpf.Toolkit.MessageBox.Show("Are you sure you want to clear the list of validation directories?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) : Xceed.Wpf.Toolkit.MessageBox.Show("You cannot clear an empty list.", "Generic Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
					break;
			}
			
			if (messageBox == MessageBoxResult.Yes)
			{
				this.savedSettings.ValidationLocations = isClearButton ? new ObservableCollection<string>() : new ObservableCollection<string>(this.savedSettings.ValidationLocations.Where(dir => !selectedItems.Any(item => dir.Contains(item, StringComparison.OrdinalIgnoreCase))));
			}
		}