protected override void ProcessEntities(Dictionary<int, Entity> entities)
        {
            float simultaneous = Environment.ProcessorCount * 2;
            int perThread = (int)Math.Ceiling(((float)entities.Values.Count) / simultaneous);
            Entity[] ents = new Entity[entities.Values.Count];
            entities.Values.CopyTo(ents, 0);
            int num = entities.Values.Count - 1;
            List<Task> tasks = new List<Task>();

            for (int j = 0; j < simultaneous; j++)
            {
                int initial = num;
                tasks.Add(factory.StartNew(
                    () =>
                    {
                        for (int i = initial; i > initial - perThread && i >= 0; i--)
                        {
                            Process(ents[i]);
                        }
                    }
                ));
                num -= perThread;
            }
            Task.WaitAll(tasks.ToArray());
        }
        private void TestAddRemoveListenerImpl(Game game)
        {
            var audio = game.Audio;
            var notAddedToEntityListener = new AudioListenerComponent();
            var addedToEntityListener = new AudioListenerComponent();

            // Add a listenerComponent not present in the entity system yet and check that it is correctly added to the AudioSystem internal data structures
            Assert.DoesNotThrow(() => audio.AddListener(notAddedToEntityListener), "Adding a listener not present in the entity system failed");
            Assert.IsTrue(audio.Listeners.ContainsKey(notAddedToEntityListener), "The list of listeners of AudioSystem does not contains the notAddedToEntityListener.");

            // Add a listenerComponent already present in the entity system and check that it is correctly added to the AudioSystem internal data structures
            var entity = new Entity("Test");
            entity.Add(addedToEntityListener);
            throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
            //game.Entities.Add(entity);
            Assert.DoesNotThrow(() => audio.AddListener(addedToEntityListener), "Adding a listener present in the entity system failed");
            Assert.IsTrue(audio.Listeners.ContainsKey(addedToEntityListener), "The list of listeners of AudioSystem does not contains the addedToEntityListener.");

            // Add a listenerComponent already added to audio System and check that it does not crash
            Assert.DoesNotThrow(()=>audio.AddListener(addedToEntityListener), "Adding a listener already added to the audio system failed.");

            // Remove the listeners from the AudioSystem and check that they are removed from internal data structures.
            Assert.DoesNotThrow(() => audio.RemoveListener(notAddedToEntityListener), "Removing an listener not present in the entity system failed.");
            Assert.IsFalse(audio.Listeners.ContainsKey(notAddedToEntityListener), "The list of listeners of AudioSystem still contains the notAddedToEntityListener.");
            Assert.DoesNotThrow(() => audio.RemoveListener(addedToEntityListener), "Removing an listener present in the entity system fails");
            Assert.IsFalse(audio.Listeners.ContainsKey(addedToEntityListener), "The list of listeners of AudioSystem still contains the addedToEntityListener.");

            // Remove a listener not present in the AudioSystem anymore and check the thrown exception
            Assert.Throws<ArgumentException>(() => audio.RemoveListener(addedToEntityListener), "Removing the a non-existing listener did not throw ArgumentException.");
        }
Exemple #3
1
 // Some functions below - Might move to seperate file? (functions.cs)
 public void KickPlayer(Entity player)
 {
     player.AfterDelay(100, entity =>
     {
         Call("kick", player.Call<int>("getentitynumber"));
     });
 }
        private PagedRecords GetRecords(
            Entity entity,
            NameValueCollection request,
            TableInfo tableInfo,
            Action<IList<BaseFilter>> filtersMutator)
        {
            var filterRecord = create_filter_record(entity, request);
            var filters = _filterFactory.BuildFilters(filterRecord).ToList();
            if (filtersMutator != null)
            {
                filtersMutator(filters);
            }
            var pagedRecords = _entitiesSource.GetRecords(
                entity,
                filters,
                tableInfo.SearchQuery,
                tableInfo.Order,
                tableInfo.OrderDirection,
                false,
                tableInfo.Page,
                tableInfo.PerPage);
            pagedRecords.Filters = filters;

            return pagedRecords;
        }
        private void OnUpdateSystem(ParticleEmitterComponent particleEmitterComponent)
        {
            if (dragonHead == null)
                dragonHead = EntitySystem.Entities.FirstOrDefault(x => x.Name == "English DragonPelvis");

            var desc = Description;

            if (dragonHead != null)
            {
                var dragonTransform = dragonHead.Transformation;
                if (dragonTransform != null)
                {
                    desc.TargetOld = desc.Target;
                    desc.Target = (Vector3)dragonTransform.WorldMatrix.Row4;
                }
            }

            var animationComponent = RootAnimation.GetOrCreate(AnimationComponent.Key);
            if (animationComponent != null)
            {
                desc.AnimationTime = (float)animationComponent.CurrentTime.TotalSeconds;
                // If we reset, reupload the particle buffer
                if ((animationComponent.CurrentTime.Ticks - lastTime.Ticks) < 0) 
                    particleEmitterComponent.UpdateNextBuffer = true;

                lastTime = animationComponent.CurrentTime;
            }

            Description = desc;
        }
 /// <summary>
 /// 删除一个用户 业务角度来说 其实是不需要的
 /// </summary>
 /// <param name="entity">memberiship用户</param>
 /// <returns>领域处理结果</returns>
 public DomainResult DeleteUser(Entity.MemberShip.Membership entity)
 {
     if (IsExistUser(entity.Users.UserName).isSuccess)
     {
         var result = DomainResult.GetDefault();
         try
         {
             Membership.DeleteUser(entity.Users.UserName);
             using (var content = new SiteContext())
             {
                 var other = content.OtherInformations
                     .Where(r => r.Email == entity.Users.UserName).FirstOrDefault();
                 if (other != null)
                 {
                     content.OtherInformations.Remove(other);
                     content.SaveChanges();
                 }
             }
         }
         catch (Exception ex)
         {
             result.isSuccess = false;
             result.error = ex;
             result.ResultMsg = ex.Message;
         }
         return result;
     }
     else
     {
         return new DomainResult(false) { ResultMsg = "用户不存在" };
     }
 }
        /// <summary>
        /// Deletes the meta tag value from the specified gallery items.
        /// </summary>
        /// <param name="galleryItemMeta">An instance of <see cref="Entity.GalleryItemMeta" /> that defines
        /// the tag value to be added and the gallery items it is to be added to.</param>
        /// <exception cref="System.Web.Http.HttpResponseException"></exception>
        public HttpResponseMessage DeleteGalleryItemMeta(Entity.GalleryItemMeta galleryItemMeta)
        {
            // /api/galleryitemmeta
            try
            {
                var mType = (MetadataItemName)galleryItemMeta.MetaItem.MTypeId;
                if (mType == MetadataItemName.Tags || mType == MetadataItemName.People)
                {
                    MetadataController.DeleteTag(galleryItemMeta);
                }
                else
                {
                    MetadataController.Delete(galleryItemMeta);
                }

                return new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new StringContent("Meta item deleted...")
                };
            }
            catch (GallerySecurityException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (Exception ex)
            {
                AppEventController.LogError(ex);

                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = Utils.GetExStringContent(ex),
                    ReasonPhrase = "Server Error"
                });
            }
        }
 public SpriteRenderer(Entity parent)
     : base(parent)
 {
     this.Color = Color.White;
     this.Scale = 1;
     this.SpriteEffects = SpriteEffects.None;
 }
 /// <summary>Método que representa la llamada al procedure 'Partida_Listar'</summary>
 public static List<Entity.Partida.Listar> Listar(Entity.Partida Item, Cursor oCursor)
 {
     var ResultSet = new List<Entity.Partida.Listar>();
     SqlCommand oComando = oCursor.ObtenerComando(Contexto.CnControlPresupuesto);
     string Esquema = Galeria.Conexiones[(int)Contexto.CnControlPresupuesto].EsquemaDefecto;
     oComando.CommandText = Esquema + "Partida_Listar";
     try
     {
         using (SqlDataReader oLector = oComando.ExecuteReader())
         {
             while (oLector.Read())
             {
                 var LItem = new Entity.Partida.Listar();
                 LItem.idPartida = (string)oLector["idPartida"];
                 LItem.Partida = (string)oLector["Partida"];
                 LItem.Estado = (string)oLector["Estado"];
                 ResultSet.Add(LItem);
             }
         }
         return ResultSet;
     }
     catch (System.Exception)
     {
         throw;
     }
 }
        public RandomMoveBehaviour(Entity entity)
        {
            _currentDirection = Vector3.up;
            _distanceTraveledInThisDirection = 0;

            _entity = entity;
        }
        public OrganizationResponse Execute(OrganizationRequest request, XrmFakedContext ctx)
        {
            var assignRequest = (AssignRequest)request;

            var target = assignRequest.Target;
            var assignee = assignRequest.Assignee;

            if (target == null)
            {
                throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), "Can not assign without target");
            }

            if (assignee == null)
            {
                throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), "Can not assign without assignee");
            }

            var service = ctx.GetFakedOrganizationService();

            var assignment = new Entity
            {
                LogicalName = target.LogicalName,
                Id = target.Id,
                Attributes = new AttributeCollection
                {
                    { "ownerid", assignee }
                }
            };

            service.Update(assignment);

            return new AssignResponse();
        }
		public void Can_load_entity()
		{
			var specialId = "SHA1-UdVhzPmv0o+wUez+Jirt0OFBcUY=";

			using (base.GetNewServer())
			{
				IDocumentStore documentStore = new DocumentStore
				{
					Url = "http://localhost:8080"
				}.Initialize();

				using(var store = documentStore)
				{
					store.Initialize();

					using (var session = store.OpenSession())
					{
						var entity = new Entity() { Id = specialId };
						session.Store(entity);
						session.SaveChanges();
					}

					using (var session = store.OpenSession())
					{
						var entity1 = session.Load<object>(specialId);
						Assert.NotNull(entity1);
					}
				}
			}
		}
        public static void WithSeries(this IEnumerable<CFindResponse> cFinds, DICOMSCU scu, Entity daemon)
        {
            var iods = cFinds.Where(r => r.Status == (ushort)Status.PENDING)
            .Where(r => r.HasData)
            .Where(r => r.Data.Elements.Any(e => e.Tag == TagHelper.STUDY_INSTANCE_UID))
            .Where(r => !string.IsNullOrEmpty(r.Data.Elements.First(e => e.Tag == TagHelper.STUDY_INSTANCE_UID).DData as string))
            .Select(r => r.GetIOD())
            .ToList();
            
            iods.ForEach(i=>i.QueryLevel = QueryLevel.SERIES);

            foreach (var iod in iods)
            {
                var req = new CFindRequest(iod, Root.STUDY);
                var seriesUids = scu.GetResponse(req, daemon)
                     .Where(r => r.Status == (ushort)Status.PENDING)
                     .Where(r => r.HasData)
                     .Where(r => r.Data.Elements.Any(e => e.Tag == TagHelper.SERIES_INSTANCE_UID))
                     .Select(r => new
                     {
                        // Study = study,
                         Series = r.Data.GetSelector().SeriesInstanceUID.Data,
                         Modality = r.Data.GetSelector().Modality.Data
                     })
                     .ToList();
                System.Console.Write("");
            }
        }
Exemple #14
1
        public Program()
        {
            m_service = new MockCrmService();

            // test data for simple fetch
            Entity de = new Entity();
            de.LogicalName = "mydynamic";
            de["prop1"] = "foo";
            Guid deID = m_service.Create( de );

            // test data for filters
            de = new Entity();
            de.LogicalName = "contact";
            de[ "address1_name" ] = "Dan";
            de[ "address1_city" ] = "Bethesda";
            Guid deID2 = m_service.Create( de );

            // data for testing links
            Guid guid = Guid.NewGuid();
            de = new Entity();
            de.LogicalName = "subject";
            de[ "subjectid" ] = guid;
            Guid deID3 = m_service.Create( de );

            de = new Entity();
            de.LogicalName = "subject";
            de[ "subjectid" ] = guid;
            de[ "title" ] = "child";
            de[ "parentsubject" ] = new EntityReference( "subject", deID3 );
            Guid deID4 = m_service.Create( de );
        }
        /// <summary>
        /// Code to create account task for new accounts
        /// </summary>
        /// <param name="service">crm service</param>
        /// <param name="accountEntity">entity of the newly created account</param>
        public void CreateAccountTask(IOrganizationService service, Entity accountEntity)
        {
            try
            {

                //create new task for account set in 2 weeks in the future
                Microsoft.Xrm.Sdk.Entity contactAccountTask = new Entity("task");
                contactAccountTask["subject"] = "Check new account is happy";
                contactAccountTask["description"] =
                "Make contact with new customer. See if they are happy with service and resolve any issues.";
                contactAccountTask["scheduledstart"] = DateTime.Now.AddDays(14);
                contactAccountTask["scheduledend"] = DateTime.Now.AddDays(14);
                Microsoft.Xrm.Sdk.EntityReference entRef = new EntityReference("account", accountEntity.Id);
                contactAccountTask["regardingobjectid"] = entRef;

                // Create the task and this should be linked to the new account record
                service.Create(contactAccountTask);

            }

            catch (FaultException ex)
            {
                throw new InvalidPluginExecutionException("An error occurred in the plug-in.", ex);
            }
        }
        private EntityCollection GenerateRandomAccountCollection()
        {
            var collection = new List<Entity>();
            for (var i = 0; i < 10; i++)
            {
                var rgn = new Random((int)DateTime.Now.Ticks);
                var entity = new Entity("account");
                entity["accountid"] = entity.Id = Guid.NewGuid();
                entity["address1_addressid"] = Guid.NewGuid();
                entity["modifiedon"] = DateTime.Now;
                entity["lastusedincampaign"] = DateTime.Now;
                entity["donotfax"] = rgn.NextBoolean();
                entity["new_verybignumber"] = rgn.NextInt64();
                entity["exchangerate"] = rgn.NextDecimal();
                entity["address1_latitude"] = rgn.NextDouble();
                entity["numberofemployees"] = rgn.NextInt32();
                entity["primarycontactid"] = new EntityReference("contact", Guid.NewGuid());
                entity["revenue"] = new Money(rgn.NextDecimal());
                entity["ownerid"] = new EntityReference("systemuser", Guid.NewGuid());
                entity["industrycode"] = new OptionSetValue(rgn.NextInt32());
                entity["name"] = rgn.NextString(15);
                entity["description"] = rgn.NextString(300);
                entity["statecode"] = new OptionSetValue(rgn.NextInt32());
                entity["statuscode"] = new OptionSetValue(rgn.NextInt32());
                collection.Add(entity);
            }

            return new EntityCollection(collection);
        }
Exemple #17
0
        protected override void CreateScene()
        {
            var camera = new FixedCamera2D("MainCamera");
            this.EntityManager.Add(camera);

            var internetWaveLogo = new Entity()
                        .AddComponent(new Transform2D()
                        {
                            Origin = Vector2.Center,
                            X = WaveServices.ViewportManager.VirtualWidth * 0.5f,
                            Y = WaveServices.ViewportManager.VirtualHeight * 0.1f,
                        })
                        .AddComponent(new SpriteUrl("Content/Loading.png", "https://raw.githubusercontent.com/WaveEngine/Samples/master/Core/InternetTextureLoad/Images/logo.png"))
                        .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));
            EntityManager.Add(internetWaveLogo);

            var internetWaveBanner = new Entity()
                        .AddComponent(new Transform2D()
                        {
                            Origin = Vector2.Center,
                            X = WaveServices.ViewportManager.VirtualWidth * 0.5f,
                            Y = WaveServices.ViewportManager.VirtualHeight * 0.7f,
                        })
                        .AddComponent(new SpriteUrl("Content/Loading.png", "https://raw.githubusercontent.com/WaveEngine/Samples/master/Core/InternetTextureLoad/Images/banner.png"))
                        .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));
            EntityManager.Add(internetWaveBanner);
        }
Exemple #18
0
 public override void Init(Entity entity)
 {
     base.Init(entity);
     camera = new View(Target.Transform.Position, Global.Screen);
     camera.Zoom(2f);
     //camera.Rotate(45f);
 }
Exemple #19
0
        internal void setValue(Entity.Sbzt entity)
        {
            mSbztObj = entity;
            lblSjjl_Qy.Text = mSbztObj.mXtsz.mJlzt;
            lblSjjl_Jlgs.Text = mSbztObj.mXtsz.mJlgs;
            lblSjjl_Jg.Text = mSbztObj.mXtsz.mJljg;
            lblSjjl_Bsm.Text = mSbztObj.mXtsz.mBsm;
            lblSjjl_Wjdx.Text = mSbztObj.mXtsz.mWjdx;
            lblSjjl_Jlms.Text = mSbztObj.mXtsz.mJlfs;

            mCKJlzt.Checked = mSbztObj.mXtsz.mJlzt == "1";
            mCmbJlfs.Text = mSbztObj.mXtsz.mJlfs;
            mCmbJlgs.Text = mSbztObj.mXtsz.mJlgs;
            mCmbFgwj.Text = mSbztObj.mXtsz.mFgwj;
            mCmbJljg.Text = mSbztObj.mXtsz.mJljg;
            mTxtBsm.Text = mSbztObj.mXtsz.mBsm;

            lblCs_Zd.Text = mSbztObj.mXtbj.mBjfs;
            lblCs_Mc.Text = mSbztObj.mXtbj.mBjmb;
            lblCs_Wg.Text = mSbztObj.mXtbj.mSpjx + "/" + mSbztObj.mXtbj.mCzjx;

            mCmbBjfs.Text = mSbztObj.mXtbj.mBjfs;
            mTxtSpjx.Text = mSbztObj.mXtbj.mSpjx;
            mTxtBjmb.Text = mSbztObj.mXtbj.mBjmb;
            mTxtCzjx.Text = mSbztObj.mXtbj.mCzjx;
        }
Exemple #20
0
        }// A tasty bite of the enchanted apple lifts all curses from your soul.
        public override bool Eat(Mobile from)
        {
            if (base.Eat(from))
            {
                from.PlaySound(0xF6);
                from.PlaySound(0x1F7);
                from.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                IEntity mfrom = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z - 10), from.Map);
                IEntity mto = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);
                Effects.SendMovingParticles(mfrom, mto, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                from.RemoveStatMod("[Magic] Str Curse");
				from.RemoveStatMod("[Magic] Dex Curse");
				from.RemoveStatMod("[Magic] Int Curse");

                from.Paralyzed = false;
                from.Asleep = false;

                EvilOmenSpell.TryEndEffect(from);
                StrangleSpell.RemoveCurse(from);
                CorpseSkinSpell.RemoveCurse(from);
                CurseSpell.RemoveEffect(from);

                BuffInfo.RemoveBuff(from, BuffIcon.Clumsy);
                BuffInfo.RemoveBuff(from, BuffIcon.FeebleMind);
                BuffInfo.RemoveBuff(from, BuffIcon.Weaken);
                BuffInfo.RemoveBuff(from, BuffIcon.MassCurse);	
				
                return true;
            }
			
            return false;
        }
        private RectangleF GetTotalRectangle(Entity entity, Transform2D parentTransform2D)
        {
            RectangleF result = RectangleF.Empty;
            var entityTransform = entity.FindComponent<Transform2D>();

            if (entityTransform != null)
            {
                result = entityTransform.Rectangle;

                if (parentTransform2D != null)
                {
                    result.Offset(
                        entityTransform.X - (entityTransform.Rectangle.Width * entityTransform.Origin.X),
                        entityTransform.Y - (entityTransform.Rectangle.Height * entityTransform.Origin.Y));

                    result.Offset(
                        -1 * (parentTransform2D.X - (parentTransform2D.Rectangle.Width * parentTransform2D.Origin.X)),
                        -1 * (parentTransform2D.Y - (parentTransform2D.Rectangle.Height * parentTransform2D.Origin.Y)));
                }

                foreach (var child in entity.ChildEntities)
                {
                    var childTotalRectangle = this.GetTotalRectangle(child, entityTransform);

                    RectangleF.Union(ref result, ref childTotalRectangle, out result);
                }
            }

            return result;
        }
        /// <summary>
        /// ����һ������
        /// </summary>
        public int Add(Entity.TimeEntity model)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("insert into [OA_Time](");
            strSql.Append("Uid,Retime,Nowtime,Timetype,Ipaddress,Timeinfo)");
            strSql.Append(" values (");
            strSql.Append("@Uid,@Retime,@Nowtime,@Timetype,@Ipaddress,@Timeinfo)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@Uid", SqlDbType.Int,4),
                    new SqlParameter("@Retime", SqlDbType.DateTime),
                    new SqlParameter("@Nowtime", SqlDbType.DateTime),
                    new SqlParameter("@Timetype", SqlDbType.VarChar,10),
                    new SqlParameter("@Ipaddress", SqlDbType.VarChar,30),
                    new SqlParameter("@Timeinfo", SqlDbType.VarChar,30)};
            parameters[0].Value = model.Uid;
            parameters[1].Value = model.Retime;
            parameters[2].Value = model.Nowtime;
            parameters[3].Value = model.Timetype;
            parameters[4].Value = model.Ipaddress;
            parameters[5].Value = model.Timeinfo;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
            if (obj == null)
            {
                return 1;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
Exemple #23
0
 public PagedRecords GetRecords(
     Entity entity,
     NameValueCollection request,
     TableInfo tableInfo)
 {
     return GetRecords(entity, request, tableInfo, null);
 }
        private void GenerateStars()
        {
            var virtualScreenManager = this.Owner.Scene.VirtualScreenManager;

            for (int i = 0; i < 100; i++)
            {
                Entity star = new Entity()
                    .AddComponent(new Transform2D()
                    {
                        X = WaveServices.Random.Next((int)virtualScreenManager.VirtualWidth),
                        Y = WaveServices.Random.Next((int)virtualScreenManager.VirtualHeight),
                        DrawOrder = 0.8f
                    })
                    .AddComponent(new Sprite(WaveContent.Assets.Star_jpg)
                    {
                        TintColor = new Color((float)WaveServices.Random.NextDouble() * 0.3f, (float)WaveServices.Random.NextDouble() * 0.3f, (float)WaveServices.Random.NextDouble() * 0.3f)
                    })
                    .AddComponent(new SpriteRenderer(DefaultLayers.Additive))
                    .AddComponent(new StarBehavior { Speed = (float)WaveServices.Random.NextDouble() * 10, Margin = 0 });

                EntityManager.Add(star);
            }

            this.isStarsGenerated = true;
        }
Exemple #25
0
        /// <summary>
        /// Create Scene
        /// </summary>
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.CornflowerBlue;
            RenderManager.DebugLines = true;

            // Createa a Free Camera (W, A, S, D Keyboard controlled)
            FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 5, 10), Vector3.Zero);
            EntityManager.Add(camera.Entity);
            RenderManager.SetActiveCamera(camera.Entity);

            // Creates a plane ground
            this.CreateGround();

            // Creates Line Drawing Entity
            drawableLines = new DrawableLines();
            Entity lines = new Entity("Drawables")
                .AddComponent(drawableLines);
            EntityManager.Add(lines);

            // Create a Timer to instance new Sphere each 0.5 seconds
            WaveServices.TimerFactory.CreateTimer("MainTimer", TimeSpan.FromSeconds(0.5f), () =>
                {
                    // new sphere in (random(0,1), 5, random(0, 1)) position
                    this.CreateSphere(Vector3.Up * 5 + Vector3.Forward*(float)WaveServices.Random.NextDouble() + Vector3.Left*(float)WaveServices.Random.NextDouble());
                });
        }
 public void AddSetsComponentEntityToMe()
 {
     var e = new Entity();
     var s = new StringComponent("abc");
     e.Add(s);
     Assert.That(s.Entity, Is.EqualTo(e));
 }
        /// <summary>Método que representa la llamada al procedure 'CentroCosto_Cab_Actualizar'</summary>
        public static int Actualizar(Entity.CentroCosto_Cab Item, Cursor oCursor)
        {
            SqlCommand oComando = oCursor.ObtenerComando(Contexto.CnControlPresupuesto);
            string Esquema = Galeria.Conexiones[(int)Contexto.CnControlPresupuesto].EsquemaDefecto;
            oComando.CommandText = Esquema + "CentroCosto_Cab_Actualizar";
            try
            {
                SqlParameterCollection oP = oComando.Parameters;
                oP.AddWithValue("ccosto", Uso.NoNulo(Item.ccosto, DBNull.Value));
                oP.AddWithValue("descripcion", Uso.NoNulo(Item.descripcion, DBNull.Value));
                oP.AddWithValue("idcliente", Uso.NoNulo(Item.idcliente, DBNull.Value));
                oP.AddWithValue("idPersona", Uso.NoNulo(Item.idPersona, DBNull.Value));
                oP.AddWithValue("usrMod", Uso.NoNulo(Item.usrMod, DBNull.Value));
                oP.AddWithValue("total", Uso.NoNulo(Item.total, DBNull.Value));
                oP.AddWithValue("idEstado", Uso.NoNulo(Item.idEstado, DBNull.Value));

                int NumFila = oComando.ExecuteNonQuery();

                return NumFila;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
        /// <summary>Método que representa la llamada al procedure 'CentroCosto_Cab_Insertar'</summary>
        public static int Insertar(Entity.CentroCosto_Cab Item, Cursor oCursor)
        {
            SqlCommand oComando = oCursor.ObtenerComando(Contexto.CnControlPresupuesto);
            string Esquema = Galeria.Conexiones[(int)Contexto.CnControlPresupuesto].EsquemaDefecto;
            oComando.CommandText = Esquema + "CentroCosto_Cab_Insertar";
            try
            {
                SqlParameterCollection oP = oComando.Parameters;
                oP.Add("ccosto",SqlDbType.Char,6).Direction = ParameterDirection.Output;
                oP.Add("ej", SqlDbType.Char, 4).Direction = ParameterDirection.Output;
                oP.Add("mes", SqlDbType.Char, 2).Direction = ParameterDirection.Output;

                oP.AddWithValue("descripcion", Uso.NoNulo(Item.descripcion, DBNull.Value));
                oP.AddWithValue("idcliente", Uso.NoNulo(Item.idcliente, DBNull.Value));
                oP.AddWithValue("idPersona", Uso.NoNulo(Item.idPersona, DBNull.Value));
                oP.AddWithValue("usr", Uso.NoNulo(Item.usr, DBNull.Value));
                oP.AddWithValue("total", Uso.NoNulo(Item.total, DBNull.Value));
                oP.AddWithValue("idEstado", Uso.NoNulo(Item.idEstado, DBNull.Value));

                int NumFila = oComando.ExecuteNonQuery();

                Item.ccosto = oP["ccosto"].Value.ToString();
                Item.ej = oP["ej"].Value.ToString();
                Item.mes= oP["mes"].Value.ToString();
                return NumFila;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
 public SqlOverrideOperation(Entity entity, AbstractConnection connection)
     : base(connection) {
     CommandBehavior = CommandBehavior.Default;
     EntityName = entity.Name;
     _entity = entity;
     _fields = entity.Fields.WithInput().NameAliases().ToArray();
 }
Exemple #30
0
 /// <summary>
 /// 从仓库中删除这个实体。
 /// 
 /// 子类重写此方法来实现非关系型数据库的删除逻辑。
 /// </summary>
 /// <param name="entity"></param>
 protected internal override void Delete(Entity entity)
 {
     using (var dba = _dataProvider.CreateDbAccesser())
     {
         _dataProvider.DbTable.Delete(dba, entity);
     }
 }