/// <summary> /// Appends the comment. /// </summary> /// <param name = "entity">The entity.</param> /// <param name = "node">The node.</param> /// <param name = "comments">The comments.</param> protected static void AppendComment(BaseEntity entity, IEnumerable<Comment> comments) { foreach (Comment comment in comments) { String c = comment.CommentText.Trim (); if (CommentHelper.IsSummary (c)) { continue; } if (CommentHelper.IsAvailability (c)) { String str = c; foreach (String s in new[] {"<para>", "</para>", "<para>", "</para>"}) { str = str.Replace (s, String.Empty); } entity.MinAvailability = CommentHelper.ExtractAvailability (str.Trim ()); } else if (CommentHelper.IsParameter (c) || CommentHelper.IsReturn (c) || CommentHelper.IsSignature (c)) { // Do nothing } else if (CommentHelper.IsParagraph (c)) { String str = c; foreach (String s in new[] {"<para>", "</para>", "<para>", "</para>"}) { str = str.Replace (s, String.Empty); } entity.Summary.Add (str.Trim ()); } else if (CommentHelper.IsRemarks (c)) { String str = c; foreach (String s in new[] {"<remarks>", "</remarks>", "<remarks>", "</remarks>"}) { str = str.Replace (s, String.Empty); } entity.Summary.Add (str.Trim ()); } else { entity.Summary.Add (c); } } }
public override void SaveLinkedEntities(BaseEntity entity) { if (EnableSaveLinkedEntities) base.SaveLinkedEntities (entity); else Console.WriteLine ("Bypassed DataLinker.SaveLinkedEntities for unit testing purposes."); }
public ItemPickupEvent(CollectibleEntity ce, BaseEntity.RPCMessage msg, Item i) { _entity = ce; _msg = msg; _player = Server.GetPlayer(msg.player); _item = new InvItem(i); }
public static IEntity createShip(EntitiesManager manager) { IEntity ship = new BaseEntity(manager); Vector2 Pos = new Vector2(); Pos.X = manager.game.GraphicsDevice.Adapter.CurrentDisplayMode.Height / 8; Pos.Y = manager.game.GraphicsDevice.Adapter.CurrentDisplayMode.Width / 8; // for controlling behaviour ship.addAttribute("position", Pos); ship.addAttribute("velocity", new Vector2()); ship.addAttribute("weight", 0.0076f); ship.addAttribute("direction", 0.0f); ship.addAttribute("scale", 1f); //for drawing Texture2D texture = manager.game.Content.Load<Texture2D>("ship"); ship.addAttribute("texture", texture); //behaviours ship.addBehaviour(GameLoopPhase.Update, new GameControllingBehavior()); ship.addBehaviour(GameLoopPhase.Update, new TemporaryGravityBehaviour()); ship.addBehaviour(GameLoopPhase.Draw, new DrawTexture2DBehaviour()); return ship; }
public virtual void FindAndFixDifferences(BaseEntity previousEntity, BaseEntity updatedEntity, PropertyInfo property) { if (Settings.IsVerbose) Console.WriteLine (" Finding and fixing all differences between previous and updated '" + updatedEntity.GetType().Name + "' entity on '" + property.Name + "' property."); var previousLinks = new BaseEntity[]{ }; if (previousEntity != null) previousLinks = Linker.GetLinkedEntities (previousEntity, property); var updatedLinks = Linker.GetLinkedEntities (updatedEntity, property); var linksToAdd = IdentifyEntityLinksToAdd (previousLinks, updatedLinks); var linksToRemove = IdentifyEntityLinksToRemove (previousLinks, updatedLinks); if (Settings.IsVerbose) { Console.WriteLine (" Links to add: " + linksToAdd.Length); Console.WriteLine (" Links to remove: " + linksToRemove.Length); } if (linksToAdd.Length > 0) CommitNewReverseLinks (updatedEntity, property, linksToAdd); if (linksToRemove.Length > 0) RemoveOldReverseLinks (updatedEntity, property, linksToRemove); }
private void JumpToNextEnemy(BaseEntity enemy) { List<BaseEntity> enemies = OGE.CurrentWorld.GetCollisionEntitiesType(Collision.CollisionType.Enemy); List<BaseEntity> bosses = OGE.CurrentWorld.GetCollisionEntitiesType(Collision.CollisionType.Boss); enemies.AddRange(bosses); BaseEntity nextEnemy = null; foreach (BaseEntity temp in enemies) { float enemyAngle = OGE.GetAngle(Position, temp.Position); float diffAngle = Math.Abs(direction - enemyAngle) % 360; if (temp == enemy) { continue; } if (nextEnemy == null) { nextEnemy = temp; } else if (OGE.GetDistance(Position, temp.Position) < OGE.GetDistance(Position, nextEnemy.Position)) { nextEnemy = temp; } } if (nextEnemy != null) { direction = OGE.GetAngle(Position, nextEnemy.Position); } }
public RocketShootEvent(BaseLauncher baseLauncher, BaseEntity.RPCMessage msg, BaseEntity baseEntity) { _entity = new Entity(baseEntity); _player = Server.GetPlayer(msg.player); _msg = msg; _launch = baseLauncher; }
public static IEntity createGameExit(EntitiesManager manager) { IEntity exit = new BaseEntity(manager); exit.addBehaviour(GameLoopPhase.Update, new ExitGameBehaviour()); return exit; }
public override void CommitLinks(BaseEntity entity) { if (EnableCommitLinks) base.CommitLinks (entity); else Console.WriteLine ("Bypassed DataLinker.CommitLinks for unit testing purposes."); }
public void TestEntityToXml(BaseEntity e) { XmlDocument xml = e.ToXmlDocument(); Assert.IsNotNull(xml); Assert.IsNotNullOrEmpty(xml.InnerXml); Trace.WriteLine(xml.InnerXml); }
public ItemRepairEvent(RepairBench repairBench, BaseEntity.RPCMessage msg) { _repairBench = repairBench; _player = Server.GetPlayer(msg.player); _item = new InvItem(repairBench.inventory.GetSlot(0)); _msg = msg; }
public static int getAmmo(BaseEntity pro) { var pro1 = pro as BaseProjectile; if (pro1 == null) return 0; return pro1.primaryMagazine.contents; }
public static DataRow AddImage(BaseEntity sellingImage) { using (DbCommand cmd = DB.Gt.GetStoredProcCommand(ProcNames.AddImage)) { DB.Gt.AddInParameter(cmd, "@SellingImage", DbType.Xml, sellingImage.ToXmlString()); return DB.Gt.ExecuteDataRow(cmd); } }
public static ItemDefinition getAmmoType(BaseEntity pro) { var pro1 = pro as BaseProjectile; if (pro1 == null) return null; //ConsoleSystem.Broadcast("chat.add", new object[] { 0, pro1.primaryMagazine.ammoType.ToString() }); return pro1.primaryMagazine.ammoType; }
public static DataRow Add(BaseEntity news) { using (DbCommand cmd = DB.Gt.GetStoredProcCommand(AddProcName)) { DB.Gt.AddInParameter(cmd, "@News", DbType.Xml, news.ToXmlString()); return DB.Gt.ExecuteDataRow(cmd); } }
public BaseEntity PrepareForStorage(BaseEntity entity) { var validatedEntity = entity.Clone (); // TODO: Add validation return validatedEntity; }
public static DataRow AddFeedback(BaseEntity feedback) { using (DbCommand cmd = DB.Gt.GetStoredProcCommand(ProcNames.AddFeedback)) { DB.Gt.AddInParameter(cmd, "@Feedback", DbType.Xml, feedback.ToXmlString()); return DB.Gt.ExecuteDataRow(cmd); } }
public static DataRow Add(BaseEntity wm) { using (DbCommand cmd = DB.Gt.GetStoredProcCommand(AddProcName)) { DB.Gt.AddInParameter(cmd, "@wm", DbType.Xml, wm.ToXmlString()); DataRow dr = DB.Gt.ExecuteDataRow(cmd); return dr; } }
public TweenPositionTo(BaseEntity entity, Vector2 to, float duration, TweeningFunction tween) { this.entity = entity; this.to = to; this.duration = duration; this.tween = tween; isComplete = false; }
public virtual void CommitLinks(BaseEntity entity) { if (Settings.IsVerbose) Console.WriteLine (" Committing all links for '" + entity.GetType().Name + "'."); var previousEntity = Reader.Read(entity.GetType(), entity.Id); FindAndFixDifferences (previousEntity, entity); }
Dictionary<int, List<BaseEntity>> mDicBaseEntity = new Dictionary<int, List<BaseEntity>>(); // key=Generator Id #endregion Fields #region Methods //--------------------------------------------------------------------- public void addBaseEntity(int generator_id, BaseEntity entity) { if (!mDicBaseEntity.ContainsKey(generator_id)) { mDicBaseEntity.Add(generator_id, new List<BaseEntity>()); } mDicBaseEntity[generator_id].Add(entity); }
public override void DestroyBulletCollision(BaseEntity entity) { base.DestroyBulletCollision(entity); if (followingEnemy != null && followingEnemy is BaseEnemy) { (followingEnemy as BaseEnemy).IsFollowed = false; } }
public static DataRow Read(BaseEntity message) { using (DbCommand cmd = DB.Gt.GetStoredProcCommand(ReadProcName)) { DB.Gt.AddInParameter(cmd, "@Message", DbType.Xml, message.ToXmlString()); DataSet ds = DB.Gt.ExecuteDataSet(cmd); return ds.Tables[0].Rows[0]; } }
public override bool Validate(BaseEntity businessObject) { var data = GetPropertyValue(businessObject) as string; if (string.IsNullOrEmpty(data)) { return false; } return data.Length > minimalLength && data.Length < maximalLength; }
public GatherEvent(ResourceDispenser dispenser, BaseEntity from, BaseEntity to, ItemAmount itemAmt, int amount) { if (to is BasePlayer) { _gatherer = Server.GetPlayer((BasePlayer) to); _resource = new Entity(from); _resourceDispenser = dispenser; _itemAmount = itemAmt; _amount = (int)(amount * World.GetInstance().ResourceGatherMultiplier); } }
/// <summary> /// Increase gather rates from trees, ores, animals, etc /// </summary> private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item) { var player = entity.ToPlayer(); if (player == null) return; if (this.IsInBadlands(player)) { item.amount = Convert.ToInt32(item.amount * 3); } }
public override void DestroyBulletCollision(BaseEntity entity) { BaseExplosion baseExplosion = new BaseExplosion(Position, ExplosionColor, ExplosionRadius); baseExplosion.FriendlyExplosion = true; baseExplosion.Damage = damage; baseExplosion.DamagePercentage = ExplosionPower; OGE.CurrentWorld.AddEntity(baseExplosion); base.DestroyBulletCollision(entity); }
public override void DestroyBulletCollision(BaseEntity entity) { if (entity is BaseBoss) { if (!(entity is VirusBoss)) { base.DestroyBulletCollision(entity); } } }
public TweenPositionToEntity(BaseEntity entity, BaseEntity to, Point offset, float duration, TweeningFunction tween) { this.entity = entity; this.to = to; this.offset = offset; this.duration = duration; this.tween = tween; isComplete = false; }
public BaseEntity AttachToEntity(BaseEntity e, String whatthing, String towhere, Boolean Spawn01) { BaseEntity parachute = GameManager.server.CreateEntity(whatthing, default(Vector3), default(Quaternion)); if (parachute) { parachute.SetParent(e, towhere); parachute.Spawn(Spawn01); } return parachute; }
public DataTable List_Company_GetAllV1(ref BaseEntity Entity, Int32 user) { return(clsCompanyDAO.Instance.GetAll_ListCompanyV1(ref Entity, user)); }
public DataTable Type_Employer_ListAll(ref BaseEntity Entity) { return(clsTypeEmployerDAO.Instance.Type_Employer_ListAll(ref Entity)); }
public DataTable Company_Dedicated_ListAll(ref BaseEntity Entity) { return(clsCompanyDedicatedDAO.Instance.Company_Dedicated_ListAll(ref Entity)); }
public void Delete(BaseEntity entity) { }
/// <summary> /// 获取一个实体属性 /// </summary> /// <typeparam name="TPropType">属性类型</typeparam> /// <param name="entity">实体</param> /// <param name="key">键</param> /// <param name="SiteId">站点ID,0加载全部</param> /// <returns>属性</returns> public static TPropType GetAttribute <TPropType>(this BaseEntity entity, string key, Guid SiteId) { var genericAttributeService = EngineContext.Current.Resolve <IGenericAttributeService>(); return(GetAttribute <TPropType>(entity, key, genericAttributeService, SiteId)); }
public Boolean Realizar_Registro_Vacaciones(ref BaseEntity Base) { return(clsTareoDAO.Instance.Realizar_Registro_Vacaciones(ref Base)); }
public override bool HandleCommand(ulong userId, string[] words) { if (!PluginSettings.Instance.DockingEnabled) { return(false); } if (words.Length < 1) { Communication.SendPrivateInformation(userId, GetHelp()); return(true); } if (m_undocking) { Communication.SendPrivateInformation(userId, string.Format("Server is busy, try again")); return(true); } m_undocking = true; try { String pylonName = String.Join(" ", words); if (PlayerMap.Instance.GetPlayerIdsFromSteamId(userId).Count < 1) { Communication.SendPrivateInformation(userId, string.Format("Unable to find player Id: {0}", userId)); return(true); } long playerId = PlayerMap.Instance.GetPlayerIdsFromSteamId(userId).First( ); Dictionary <String, List <IMyCubeBlock> > testList; List <IMyCubeBlock> beaconList; DockingZone.FindByName(pylonName, out testList, out beaconList, playerId); if (beaconList.Count == 4) { foreach (IMyCubeBlock entity in beaconList) { if (!Entity.CheckOwnership(entity, playerId)) { Communication.SendPrivateInformation(userId, string.Format("You do not have permission to use '{0}'. You must either own all the beacons or they must be shared with faction.", pylonName)); return(true); } } IMyCubeBlock e = beaconList.First( ); IMyCubeGrid parent = (IMyCubeGrid)e.Parent; long[] beaconListIds = beaconList.Select(p => p.EntityId).ToArray( ); long ownerId = beaconList.First( ).OwnerId; List <DockingItem> dockingItems = Docking.Instance.Find(d => d.PlayerId == ownerId && d.TargetEntityId == parent.EntityId && d.DockingBeaconIds.Intersect(beaconListIds).Count( ) == 4); if (dockingItems.Count < 1) { Communication.SendPrivateInformation(userId, string.Format("You have no ships docked in docking zone '{0}'.", pylonName)); return(true); } DockingItem dockingItem = dockingItems.First( ); // Figure out center of docking area, and other distance information double maxDistance = 99; Vector3D vPos = new Vector3D(0, 0, 0); foreach (IMyCubeBlock b in beaconList) { Vector3D beaconPos = Entity.GetBlockEntityPosition(b); vPos += beaconPos; } vPos = vPos / 4; foreach (IMyCubeBlock b in beaconList) { Vector3D beaconPos = Entity.GetBlockEntityPosition(b); maxDistance = Math.Min(maxDistance, Vector3D.Distance(vPos, beaconPos)); } List <IMySlimBlock> blocks = new List <IMySlimBlock>( ); parent.GetBlocks(blocks); foreach (IMySlimBlock slim_cbe in blocks) { if (slim_cbe is IMyCubeBlock) { IMyCubeBlock cbe = slim_cbe.FatBlock; if (cbe.GetObjectBuilderCubeBlock( ) is MyObjectBuilder_Cockpit) { MyObjectBuilder_Cockpit c = (MyObjectBuilder_Cockpit)cbe.GetObjectBuilderCubeBlock( ); if (c.Pilot != null) { Communication.SendPrivateInformation(userId, string.Format( "Carrier ship has a pilot. The carrier should be unpiloted and fully stopped before undocking. (Sometimes this can lag a bit. Wait 10 seconds and try again)", pylonName)); return(true); } } } } String dockedShipFileName = Essentials.PluginPath + String.Format("\\Docking\\docked_{0}_{1}_{2}.sbc", ownerId, dockingItem.TargetEntityId, dockingItem.DockedEntityId); // Load Entity From File and add to game FileInfo fileInfo = new FileInfo(dockedShipFileName); //CubeGridEntity cubeGrid = new CubeGridEntity(fileInfo); MyObjectBuilder_CubeGrid cubeGrid; MyObjectBuilderSerializer.DeserializeXML(dockedShipFileName, out cubeGrid); // Rotate our ship relative to our saved rotation and the new carrier rotation cubeGrid.PositionAndOrientation = new MyPositionAndOrientation(Matrix.CreateFromQuaternion(Quaternion.CreateFromRotationMatrix(parent.Physics.GetWorldMatrix( ).GetOrientation( )) * dockingItem.SaveQuat).GetOrientation( )); // Move our ship relative to the new carrier position and orientation Quaternion newQuat = Quaternion.CreateFromRotationMatrix(parent.Physics.GetWorldMatrix( ).GetOrientation( )); Vector3D rotatedPos = Vector3D.Transform(dockingItem.SavePos, newQuat); //cubeGrid.Position = rotatedPos + parent.GetPosition(); cubeGrid.PositionAndOrientation = new MyPositionAndOrientation(rotatedPos + parent.GetPosition( ), cubeGrid.PositionAndOrientation.Value.Forward, cubeGrid.PositionAndOrientation.Value.Up); // Add object to world cubeGrid.EntityId = BaseEntity.GenerateEntityId( ); cubeGrid.LinearVelocity = Vector3.Zero; cubeGrid.AngularVelocity = Vector3.Zero; bool undock = false; Wrapper.GameAction(() => { try { IMyEntity entitiy = MyAPIGateway.Entities.CreateFromObjectBuilderAndAdd(cubeGrid); MyMultiplayer.ReplicateImmediatelly(MyExternalReplicable.FindByObject(entitiy)); undock = true; } catch (Exception Ex) { Log.Info(string.Format("Error undocking ship: {0}", Ex.ToString( ))); Communication.SendPrivateInformation(userId, string.Format("Unable to undock ship due to error.")); } }); if (!undock) { return(true); } //SectorObjectManager.Instance.AddEntity(cubeGrid); // Remove the docking file File.Delete(dockedShipFileName); Docking.Instance.Remove(dockingItem); Communication.SendPrivateInformation(userId, string.Format("The ship '{0}' has been undocked from docking zone '{1}'", dockingItem.DockedName, pylonName)); /* * // Queue for cooldown * DockingCooldownItem cItem = new DockingCooldownItem(); * cItem.Name = pylonName; * cItem.startTime = DateTime.Now; * * lock (m_cooldownList) * m_cooldownList.Add(cItem); * * IMyEntity gridEntity = MyAPIGateway.Entities.GetEntityById(dockingItem.DockedEntityId); * IMyCubeGrid cubeGrid = (IMyCubeGrid)gridEntity; * * Quaternion q = Quaternion.CreateFromRotationMatrix(parent.WorldMatrix.GetOrientation()) * dockingItem.SaveQuat; * Quaternion newQuat = Quaternion.CreateFromRotationMatrix(parent.WorldMatrix.GetOrientation()); * Vector3 parentPosition = parent.GetPosition(); * Vector3 rotatedPos = Vector3.Transform(dockingItem.savePos, newQuat); * Vector3 position = rotatedPos + parentPosition; * Matrix positionMatrix = Matrix.CreateFromQuaternion(q); * * cubeGrid.ChangeGridOwnership(playerId, MyOwnershipShareModeEnum.None); * gridEntity.SetPosition(dockingItem.savePos); * * gridEntity.WorldMatrix = positionMatrix; * gridEntity.SetPosition(position); * * // We need to update again, as this doesn't seem to sync properly? I set world matrix, and setposition, and it doesn't go where it should, and I * // have to bump into it for it to show up, it's mega weird. * * if (PluginDocking.Settings.DockingItems == null) * throw new Exception("DockingItems is null"); * * // Remove from docked items * PluginDocking.Settings.DockingItems.Remove(dockingItem); * * // Notify user * Communication.SendPrivateInformation(userId, string.Format("The ship '{0}' has been undocked from docking zone '{1}'", gridEntity.DisplayName, pylonName)); */ // Queue for cooldown /* * DockingCooldownItem cItem = new DockingCooldownItem(); * cItem.name = pylonName; * cItem.startTime = DateTime.Now; * PluginDocking.CooldownList.Add(cItem); */ } else if (beaconList.Count > 4) // Too many beacons, must be 4 { Communication.SendPrivateInformation(userId, string.Format("Too many beacons with the name or another zone with the name '{0}'. Place only 4 beacons to create a zone or try a different zone name.", pylonName)); } else // Can't find docking zone { Communication.SendPrivateInformation(userId, string.Format("Can not locate docking zone '{0}'. There must be 4 beacons with the name '{0}' to create a docking zone. Beacons must be fully built!", pylonName)); } } catch (NullReferenceException ex) { Log.Error(ex); } finally { m_undocking = false; } return(true); }
public Boolean DeleteMemorandum(ref BaseEntity Base, List <clsMemorandums> lstIds) { return(clsMemorandumDAO.Instance.DeleteMemorandum(ref Base, lstIds)); }
public Boolean Validar_Feriado(ref BaseEntity Base, DateTime fecha, int empresaid) { return(clsTareoDAO.Instance.Validar_Feriado(ref Base, fecha, empresaid)); }
public SqlOperation GetDeleteStatement(BaseEntity entity) { throw new NotImplementedException(); }
protected override bool ExeOnTarget(BaseEntity tar) { tar.AttackTarget(); return(true); }
public SqlOperation GetUpdateStatement(BaseEntity entity) { throw new System.NotImplementedException(); }
public DataTable Province_List(ref BaseEntity Entity, Int32 id) { return(clsProvinceDAO.Instance.ListProvinceByDepartament(ref Entity, id)); }
public SqlOperation GetRetriveByName(BaseEntity entity) { throw new NotImplementedException(); }
/// <summary> /// 获取实体unproxied类型 /// </summary> /// <remarks> /// 如果您的实体框架上下文是代理启用的, /// 运行时将创建实体的代理实例, /// 即一个动态生成的类,它从实体类继承并通过插入特定的代码来重写其虚拟属性,例如用于跟踪更改和延迟加载。 /// </remarks> public static Type GetUnproxiedEntityType(this BaseEntity entity) { var userType = ObjectContext.GetObjectType(entity.GetType()); return(userType); }
public static bool IsEntitySpawned(BaseEntity entity) => entity.IsValid() && entity.gameObject.activeInHierarchy && !entity.IsDestroyed;
public clsEmployee Buscar_Empleado_Id(ref BaseEntity Entity, Int32 id, Int32 idempresa) { return(clsEmployeeDAO.Instance.Buscar_Empleado_Id(ref Entity, id, idempresa)); }
/// <summary> /// Invoke the widget view component /// </summary> /// <param name="widgetZone">Widget zone</param> /// <param name="additionalData">Additional parameters</param> /// <returns>View component result</returns> public async Task <IViewComponentResult> InvokeAsync(string widgetZone, object additionalData) { //ensure that model is passed if (additionalData is not BaseNopEntityModel entityModel) { return(Content(string.Empty)); } //ensure that Avalara tax provider is active if (!await _taxPluginManager.IsPluginActiveAsync(AvalaraTaxDefaults.SystemName)) { return(Content(string.Empty)); } if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageTaxSettings)) { return(Content(string.Empty)); } //ensure that it's a proper widget zone if (!widgetZone.Equals(AdminWidgetZones.CustomerDetailsBlock) && !widgetZone.Equals(AdminWidgetZones.CustomerRoleDetailsTop) && !widgetZone.Equals(AdminWidgetZones.ProductDetailsBlock) && !widgetZone.Equals(AdminWidgetZones.CheckoutAttributeDetailsBlock)) { return(Content(string.Empty)); } //get Avalara pre-defined entity use codes var cacheKey = _staticCacheManager.PrepareKeyForDefaultCache(AvalaraTaxDefaults.EntityUseCodesCacheKey); var cachedEntityUseCodes = await _staticCacheManager.GetAsync(cacheKey, async() => await _avalaraTaxManager.GetEntityUseCodesAsync()); var entityUseCodes = cachedEntityUseCodes?.Select(useCode => new SelectListItem { Value = useCode.code, Text = $"{useCode.name} ({string.Join(", ", useCode.validCountries)})" }).ToList() ?? new List <SelectListItem>(); //add the special item for 'undefined' with empty guid value var defaultValue = Guid.Empty.ToString(); entityUseCodes.Insert(0, new SelectListItem { Value = defaultValue, Text = await _localizationService.GetResourceAsync("Plugins.Tax.Avalara.Fields.EntityUseCode.None") }); //prepare model var model = new EntityUseCodeModel { Id = entityModel.Id, EntityUseCodes = entityUseCodes }; //get entity by the model identifier BaseEntity entity = null; if (widgetZone.Equals(AdminWidgetZones.CustomerDetailsBlock)) { model.PrecedingElementId = nameof(CustomerModel.IsTaxExempt); entity = await _customerService.GetCustomerByIdAsync(entityModel.Id); } if (widgetZone.Equals(AdminWidgetZones.CustomerRoleDetailsTop)) { model.PrecedingElementId = nameof(CustomerRoleModel.TaxExempt); entity = await _customerService.GetCustomerRoleByIdAsync(entityModel.Id); } if (widgetZone.Equals(AdminWidgetZones.ProductDetailsBlock)) { model.PrecedingElementId = nameof(ProductModel.IsTaxExempt); entity = await _productService.GetProductByIdAsync(entityModel.Id); } if (widgetZone.Equals(AdminWidgetZones.CheckoutAttributeDetailsBlock)) { model.PrecedingElementId = nameof(CheckoutAttributeModel.IsTaxExempt); entity = await _checkoutAttributeService.GetCheckoutAttributeByIdAsync(entityModel.Id); } //try to get previously saved entity use code model.AvalaraEntityUseCode = entity == null ? defaultValue : await _genericAttributeService.GetAttributeAsync <string>(entity, AvalaraTaxDefaults.EntityUseCodeAttribute); return(View("~/Plugins/Tax.Avalara/Views/EntityUseCode/EntityUseCode.cshtml", model)); }
protected bool RunEntityReflectionUnitTests() { bool result = true; if (!BaseObject.ReflectionUnitTest()) { result = false; BaseLog.Warn("BaseObject reflection validation failed!"); } if (!BaseEntity.ReflectionUnitTest()) { result = false; BaseLog.Warn("BaseEntity reflection validation failed!"); } if (!BaseEntityNetworkManager.ReflectionUnitTest()) { result = false; BaseLog.Warn("BaseEntityNetworkManager reflection validation failed!"); } if (!CubeGridEntity.ReflectionUnitTest()) { result = false; BaseLog.Warn("CubeGridEntity reflection validation failed!"); } //if (!CubeGridManagerManager.ReflectionUnitTest()) //{ // result = false; // BaseLog.Warn("CubeGridManagerManager reflection validation failed!"); //} if (!CubeGridNetworkManager.ReflectionUnitTest()) { result = false; BaseLog.Warn("CubeGridNetworkManager reflection validation failed!"); } if (!CubeGridThrusterManager.ReflectionUnitTest()) { result = false; BaseLog.Warn("CubeGridThrusterManager reflection validation failed!"); } if (!SectorObjectManager.ReflectionUnitTest()) { result = false; BaseLog.Warn("SectorObjectManager reflection validation failed!"); } if (!CharacterEntity.ReflectionUnitTest()) { result = false; BaseLog.Warn("CharacterEntity reflection validation failed!"); } if (!CharacterEntityNetworkManager.ReflectionUnitTest()) { result = false; BaseLog.Warn("CharacterEntityNetworkManager reflection validation failed!"); } if (!FloatingObject.ReflectionUnitTest()) { result = false; BaseLog.Warn("FloatingObject reflection validation failed!"); } if (!FloatingObjectManager.ReflectionUnitTest()) { result = false; BaseLog.Warn("FloatingObjectManager reflection validation failed!"); } if (!InventoryEntity.ReflectionUnitTest()) { result = false; BaseLog.Warn("InventoryEntity reflection validation failed!"); } if (!InventoryItemEntity.ReflectionUnitTest()) { result = false; BaseLog.Warn("InventoryItemEntity reflection validation failed!"); } if (!VoxelMap.ReflectionUnitTest()) { result = false; BaseLog.Warn("VoxelMap reflection validation failed!"); } if (!VoxelMapMaterialManager.ReflectionUnitTest()) { result = false; BaseLog.Warn("VoxelMapMaterialManager reflection validation failed!"); } if (result) { BaseLog.Info("All entity types passed reflection unit tests!"); } return(result); }
public override List <T> RetrieveByIdUser <T>(BaseEntity entity) { throw new NotImplementedException(); }
/// <summary> /// 检查将要操作的数据是否符合业务规则 /// </summary> /// <param name="p_BE"></param> private void CheckCorrect(BaseEntity p_BE) { CWInvoiceDts entity = (CWInvoiceDts)p_BE; }
public void Update(BaseEntity entity) { throw new NotImplementedException(); }
static void Main(string[] args) { BaseEntity.Initialization(new FreeSql.FreeSqlBuilder() .UseAutoSyncStructure(true) .UseConnectionString(FreeSql.DataType.Sqlite, "data source=test.db;max pool size=5") .Build()); Task.Run(async() => { using (var uow = BaseEntity.Begin()) { var id = (await new User1().SaveAsync()).Id; uow.Commit(); } var ug1 = new UserGroup(); ug1.GroupName = "分组一"; await ug1.InsertAsync(); var ug2 = new UserGroup(); ug2.GroupName = "分组二"; await ug2.InsertAsync(); var u1 = new User1(); u1.GroupId = ug1.Id; await u1.SaveAsync(); await u1.DeleteAsync(); await u1.RestoreAsync(); u1.Nickname = "x1"; await u1.UpdateAsync(); var u11 = await User1.FindAsync(u1.Id); u11.Description = "备注"; await u11.SaveAsync(); await u11.DeleteAsync(); var slslsl = Newtonsoft.Json.JsonConvert.SerializeObject(u1); var u11null = User1.Find(u1.Id); var u11s = User1.Where(a => a.Group.Id == ug1.Id).Limit(10).ToList(); var u11s2 = User1.Select.LeftJoin <UserGroup>((a, b) => a.GroupId == b.Id).Limit(10).ToList(); var ug1s = UserGroup.Select .IncludeMany(a => a.User1s) .Limit(10).ToList(); var ug1s2 = UserGroup.Select.Where(a => a.User1s.AsSelect().Any(b => b.Nickname == "x1")).Limit(10).ToList(); var r1 = new Role(); r1.Id = "管理员"; await r1.SaveAsync(); var r2 = new Role(); r2.Id = "超级会员"; await r2.SaveAsync(); var ru1 = new RoleUser1(); ru1.User1Id = u1.Id; ru1.RoleId = r1.Id; await ru1.SaveAsync(); ru1.RoleId = r2.Id; await ru1.SaveAsync(); var u1roles = User1.Select.IncludeMany(a => a.Roles).ToList(); var u1roles2 = User1.Select.Where(a => a.Roles.AsSelect().Any(b => b.Id == "xx")).ToList(); }).Wait(); Console.WriteLine("按任意键结束。。。"); Console.ReadKey(); }
public int GetSelectedRowIndex(BaseEntity row) { return(_selectedRow.IndexOf(row)); }
public DataTable ListTemplateJustidication(ref BaseEntity Entity, Int32 id) { return(clsTemplateJustificationDao.Instance.ListTemplateJustidication(ref Entity, id)); }
public void Include_ManyToMany() { g.sqlite.Delete <userinfo>().Where("1=1").ExecuteAffrows(); g.sqlite.Delete <DEPARTMENTS>().Where("1=1").ExecuteAffrows(); g.sqlite.Delete <dept_user>().Where("1=1").ExecuteAffrows(); BaseEntity.Initialization(g.sqlite); userinfo user = new userinfo { userid = 1 }; user.Insert(); user.depts = new List <DEPARTMENTS>( new[] { new DEPARTMENTS { deptid = 1, deptcode = "01" }, new DEPARTMENTS { deptid = 2, deptcode = "02" }, new DEPARTMENTS { deptid = 3, deptcode = "03" }, }); user.SaveMany("depts"); user.depts = new List <DEPARTMENTS>( new[] { new DEPARTMENTS { deptid = 1, deptcode = "01" }, new DEPARTMENTS { deptid = 2, deptcode = "02" }, new DEPARTMENTS { deptid = 4, deptcode = "04" }, }); user.SaveMany("depts"); user.depts = new List <DEPARTMENTS>( new[] { new DEPARTMENTS { deptid = 2, deptcode = "02" }, }); user.SaveMany("depts"); g.sqlite.CodeFirst.SyncStructure <Song_tag>(); g.sqlite.CodeFirst.SyncStructure <Tag>(); g.sqlite.CodeFirst.SyncStructure <Song>(); var test150_01 = g.sqlite.GetRepository <Tag>() .Select.From <Tag>((s, b) => s.InnerJoin(a => a.Id == b.Id)) .ToList((a, b) => new { a.Id, a.Name, id2 = b.Id, name2 = b.Name }); using (var ctx = g.sqlite.CreateDbContext()) { var test150_02 = ctx.Set <Tag>() .Select.From <Tag>((s, b) => s.InnerJoin(a => a.Id == b.Id)) .ToList((a, b) => new { a.Id, a.Name, id2 = b.Id, name2 = b.Name }); var songs = ctx.Set <Song>().Select .IncludeMany(a => a.Tags) .ToList(); var tag1 = new Tag { Ddd = DateTime.Now.Second, Name = "test_manytoMany_01_中国" }; var tag2 = new Tag { Ddd = DateTime.Now.Second, Name = "test_manytoMany_02_美国" }; var tag3 = new Tag { Ddd = DateTime.Now.Second, Name = "test_manytoMany_03_日本" }; ctx.AddRange(new[] { tag1, tag2, tag3 }); var song1 = new Song { Create_time = DateTime.Now, Title = "test_manytoMany_01_我是中国人.mp3", Url = "http://ww.baidu.com/" }; var song2 = new Song { Create_time = DateTime.Now, Title = "test_manytoMany_02_爱你一万年.mp3", Url = "http://ww.163.com/" }; var song3 = new Song { Create_time = DateTime.Now, Title = "test_manytoMany_03_千年等一回.mp3", Url = "http://ww.sina.com/" }; ctx.AddRange(new[] { song1, song2, song3 }); ctx.AddRange( new[] { new Song_tag { Song_id = song1.Id, Tag_id = tag1.Id }, new Song_tag { Song_id = song2.Id, Tag_id = tag1.Id }, new Song_tag { Song_id = song3.Id, Tag_id = tag1.Id }, new Song_tag { Song_id = song1.Id, Tag_id = tag2.Id }, new Song_tag { Song_id = song3.Id, Tag_id = tag2.Id }, new Song_tag { Song_id = song3.Id, Tag_id = tag3.Id }, } ); ctx.SaveChanges(); } }
/*Actualizar Vacaciones a Truncas*/ public Boolean Realizar_UpdateVacacionesTruncas(ref BaseEntity Base) { return(clsTareoDAO.Instance.Realizar_UpdateVacacionesTruncas(ref Base)); }
public DataTable Document_Type_ListAll(ref BaseEntity Entity) { return(clsDocumentTypeDAO.Instance.Document_Type_ListAll(ref Entity)); }
public override void Generate(BaseEntity entity) { throw new NotImplementedException(); }
public override void Delete(BaseEntity entity) { var word = (Word)entity; dao.ExecuteProcedure(mapper.GetDeleteStatement(word)); }