public static void UpdateInitial(Session session, UpdateInitial initial, UpdateParameters parameters) { if (!characterInfo.TryGetValue(session.Character, out CharacterUpdateInfo info)) { return; } info.Level = (uint)initial.Class6.Level; info.Location = initial.InitialUpdate.Location; info.Health = new CharacterUpdateInfo.Vital { Current = (uint)initial.InitialUpdate.CurHealth, Maximum = (uint)initial.InitialUpdate.MaxHealth }; info.Stamina = new CharacterUpdateInfo.Vital { Current = (uint)initial.InitialUpdate.CurStam, Maximum = (uint)initial.InitialUpdate.MaxStam }; info.Mana = new CharacterUpdateInfo.Vital { Current = (uint)initial.InitialUpdate.CurMana, Maximum = (uint)initial.InitialUpdate.MaxMana }; IWritable update = BuildUpdate(initial, session.Character.Sequence); BroadcastUpdate(session, update); }
internal override void UpdateProgress(UpdateParameters p) { if (this.objects != null) { for (int i = 0; i < this.objects.Count; i++) { var obj = this.objects[i]; if (obj.Enabled) { this.Current = this.objects[i]; this.UpdateChildren(p); } } } else { p.ScreenEngine.RootComponent.TraveseTree(o => { if (this.TypeFilterType.IsAssignableFrom(o.GetType())) { if (o.Enabled) { this.Current = o; this.UpdateChildren(p); } } }); } }
//методы public string CreateQuery(UpdateParameters parameters, DbContext context , string prefix = null) { StringBuilder scriptBuilder = new StringBuilder(); if (parameters.UpdateDeliveryType) { scriptBuilder.AppendLine( CreateDeliveryTypeQuery(parameters, context, prefix)); scriptBuilder.AppendLine(); } if (parameters.UpdateCategory) { scriptBuilder.AppendLine( CreateCategoryQuery(parameters, context, prefix)); scriptBuilder.AppendLine(); } if (parameters.UpdateTopic) { scriptBuilder.AppendLine( CreateTopicQuery(parameters, context, prefix)); scriptBuilder.AppendLine(); } return scriptBuilder.ToString(); }
public static void UpdateHealth(Session session, UpdateVital vital, UpdateParameters parameters) { if (!characterInfo.TryGetValue(session.Character, out CharacterUpdateInfo info)) { return; } var vitalUpdate = new CharacterUpdateInfo.Vital { Current = vital.Current, Maximum = vital.Maximum }; switch (vital) { case UpdateHealth _: info.Health = vitalUpdate; break; case UpdateStamina _: info.Stamina = vitalUpdate; break; case UpdateMana _: info.Mana = vitalUpdate; break; } IWritable update = BuildUpdate(vital, session.Character.Sequence); BroadcastUpdate(session, update); }
public string CreateCategoryQuery(UpdateParameters parameters, DbContext context , string prefix = null) { string tvpName = prefix + CoreTVP.UPDATE_USER_TYPE; var merge = new MergeOperation<UserCategorySettings<Guid>>(context, null, tvpName, CoreTVP.UPDATE_USERS_PARAMETER_NAME); merge.Compare.IncludeProperty(p => p.UserID) .IncludeProperty(p => p.DeliveryType) .IncludeProperty(p => p.CategoryID); merge.Update.ExcludeAllPropertiesByDefault = true; if (parameters.UpdateCategorySendCount) { merge.Update.Assign(t => t.SendCount, (t, s) => t.SendCount + s.SendCount); } if (parameters.UpdateCategoryLastSendDateUtc) { merge.Update.Assign(t => t.LastSendDateUtc, (t, s) => DateTime.UtcNow); } if (parameters.CreateCategoryIfNotExist) { merge.Insert.IncludeDefault(t => t.IsEnabled, true) .IncludeDefault(t => t.LastSendDateUtc, DateTime.UtcNow); } MergeType mergeType = parameters.CreateCategoryIfNotExist ? MergeType.Upsert : MergeType.Update; return merge.ConstructCommand(mergeType); }
public void SignalQueries_UpdateCountersTest() { //параметры var logger = new ShoutExceptionLogger(); var target = new SqlSignalQueries(logger, SignaloBotTestParameters.SqlConnetion); var updateParameters = new UpdateParameters() { UpdateDeliveryTypeLastSendDateUtc = true, UpdateCategorySendCount = true, UpdateCategoryLastSendDateUtc = true, CreateCategoryIfNotExist = true, UpdateTopicSendCount = false, UpdateTopicLastSendDateUtc = true, CreateTopicIfNotExist = true }; var items = new List<SignalDispatchBase<Guid>>() { SignaloBotEntityCreator<Guid>.CreateSignal(), SignaloBotEntityCreator<Guid>.CreateSignal() }; //проверка bool result = target.UpdateCounters(updateParameters, items).Result; }
public static void UpdateUse(Session session, ClientUpdateUse use, UpdateParameters parameters) { BroadcastUpdate(session, new ServerUpdateUse { Guid = use.Guid }, parameters); }
public void TestInvalidUpdateFieldLayoutByParametersInjection(UpdateParameters param, Enums.InvalidInjection invalid) { var handler = new DefaultManager(); var fieldUuid = FieldsCreator.Data[$"{ResourceId.Client}-{FieldType.SingleLineText.ToString()}-0"].Guid; var request = GenerateUpdateFieldLayoutRequest(ResourceId.Client, LayoutUuids[ResourceId.Client], FieldUuids[ResourceId.Client], Title.MinJa, UpdateCellLayout.MinX, UpdateCellContent.Field); var updateParam = new Dictionary <string, object>(); if (param == UpdateParameters.Update) { request[param.GetEnumStringValue()] = MapperData.InvalidInjectionMapper[invalid]; } else if (param == UpdateParameters.Guid) { updateParam = request[UpdateParameters.Update.GetEnumStringValue()] as Dictionary <string, object>; updateParam[LayoutUuids[ResourceId.Client].ToString()] = MapperData.InvalidInjectionMapper[invalid]; } else { updateParam = request[UpdateParameters.Update.GetEnumStringValue()] as Dictionary <string, object>; var uuidParam = updateParam[LayoutUuids[ResourceId.Client].ToString()] as Dictionary <string, object>; uuidParam[param.GetEnumStringValue()] = MapperData.InvalidInjectionMapper[invalid]; updateParam[LayoutUuids[ResourceId.Client].ToString()] = uuidParam; } var response = handler.Send <object>(FieldManager.FieldLayoutApiRelativeUrl, JsonConvert.SerializeObject(request), HttpMethod.PUT); PrAssert.That(response, PrIs.ErrorResponse().And.HttpCode(System.Net.HttpStatusCode.BadRequest)); }
/// <summary> /// Reschedules the visit. /// </summary> /// <param name="p">parameters</param> public void RescheduleVisit(VisitRescheduleVisitSP p) { IDoctorScheduleService doctorScheduleService = (IDoctorScheduleService) EntityFactory.GetEntityServiceByName(vDoctorSchedule.EntityName, ""); vVisit visit = GetByIDV(p.VisitID, new GetByIDParameters()); OwnerPatientOrOwnerDoctorSecurity.Check("reschedule an appointment", visit, vVisit.ColumnNames.PatientUserID, vVisit.ColumnNames.DoctorID); DoctorSchedule oldDoctorSchedule = doctorScheduleService.GetByIDT(visit.DoctorScheduleID, new GetByIDParameters()); DoctorSchedule newDoctorSchedule = doctorScheduleService.GetByIDT(p.NewDoctorScheduleID, new GetByIDParameters()); // checking business rules ((VisitBR)BusinessLogicObject).RescheduleVisit(visit, oldDoctorSchedule, newDoctorSchedule); // updating old schedule (it should allow +1 number of patients) if (oldDoctorSchedule.NumberOfRegisteredPatients != 0) { oldDoctorSchedule.NumberOfRegisteredPatients--; } UpdateParameters updateParameters = new UpdateParameters(); updateParameters.DetailEntityObjects.Add(new DetailObjectInfo() { EntityName = vDoctorSchedule.EntityName, EntitySet = oldDoctorSchedule, FnName = RuleFunctionSEnum.Update }); // updating new schedule (it should allow -1 number of patients) newDoctorSchedule.NumberOfRegisteredPatients++; updateParameters.DetailEntityObjects.Add(new DetailObjectInfo() { EntityName = vDoctorSchedule.EntityName, EntitySet = newDoctorSchedule, FnName = RuleFunctionSEnum.Update }); // Adding notification for user var notification = CreateScheduleNotification(visit); notification.NotificationTemplateID = (int)EntityEnums.NotificationTemplateEnum.VisitRescheduled; TemplateParams tmpP = new TemplateParams(); tmpP.AddParameter("FromDate", DateTimeEpoch.ConvertUnixEpochToLocalTime(oldDoctorSchedule.SlotUnixEpoch, visit.PatientWorldTimeZoneID).ToString()); tmpP.AddParameter("ToDate", DateTimeEpoch.ConvertUnixEpochToLocalTime(newDoctorSchedule.SlotUnixEpoch, visit.PatientWorldTimeZoneID).ToString()); notification.ParametersValues = tmpP.SerializeToString(); updateParameters.DetailEntityObjects.Add(new DetailObjectInfo() { EntityName = vNotification.EntityName, EntitySet = notification, FnName = RuleFunctionSEnum.Insert } ); // updating visit changes visit.DoctorScheduleID = p.NewDoctorScheduleID; Update(visit, updateParameters); }
public override void Update(UpdateParameters p) { base.Update(p); this.GetScreenBounds(); actualBackColor = this.PropState.BackColor * (float)this.PropState.Opacity; screenRotation = MathHelper.ToRadians((float)this.PropState.Rotation); }
public override void Update(UpdateParameters updateParameters) { base.Update(updateParameters); if (Controls.Length > 0) { Flow(); } }
internal override void UpdateProgress(UpdateParameters p) { base.UpdateChildren(p); if (runnables.All(a => !a.InProgress)) // all animations executed repeatsDone++; }
public override void Update(UpdateParameters updateParameters) { base.Update(updateParameters); if (updateParameters.RawKeyState.IsKeyDown(Keys.Enter)) { Ok(); } }
private void CalculateHorizontalCameraPosition(ref UpdateParameters updateParameters) { updateParameters.XPos = Target.position.x; if (NeedsHorizontalOffsetAdjustment(ref updateParameters)) { AdjustHorizontalOffset(ref updateParameters); } }
public override void Update(UpdateParameters p) { base.Update(p); if (MediaPlayer.State == MediaState.Stopped) { Start(); } }
protected virtual async Task UpdateTopicCounters(UpdateParameters parameters, List <SignalDispatch <ObjectId> > items) { if (!parameters.UpdateTopic) { return; } var operations = new List <WriteModel <TTopic> >(); foreach (SignalDispatch <ObjectId> item in items) { var filter = Builders <TTopic> .Filter.Where( p => p.SubscriberId == item.ReceiverSubscriberId.Value && p.CategoryId == item.CategoryId && p.TopicId == item.TopicId); var update = Builders <TTopic> .Update.Combine(); if (parameters.UpdateDeliveryTypeLastSendDateUtc) { update = update.Set(p => p.LastSendDateUtc, item.SendDateUtc); } if (parameters.UpdateDeliveryTypeSendCount) { update = update.Inc(p => p.SendCount, 1); } if (parameters.CreateCategoryIfNotExist) { update = update.SetOnInsertAllMappedMembers(new TTopic() { SubscriberId = item.ReceiverSubscriberId.Value, CategoryId = item.CategoryId.Value, TopicId = item.TopicId, LastSendDateUtc = item.SendDateUtc, SendCount = 1, AddDateUtc = DateTime.UtcNow, IsEnabled = true, IsDeleted = false }); } operations.Add(new UpdateOneModel <TTopic>(filter, update) { IsUpsert = parameters.CreateTopicIfNotExist }); } var options = new BulkWriteOptions() { IsOrdered = false }; BulkWriteResult <TTopic> response = await _collectionFactory.GetCollection <TTopic>().BulkWriteAsync(operations, options); }
internal override void UpdateProgress(UpdateParameters p) { base.UpdateChildren(p); if (runnables.All(a => !a.InProgress)) { // all animations executed repeatsDone++; } }
protected void CreateValuesFromUpdateParameters(ActiveRecordDataSourceUpdateEventArgs args) { IOrderedDictionary values = UpdateParameters.GetValues(HttpContext.Current, Source); for (int i = 0; i < UpdateParameters.Count; i++) { Parameter parameter = UpdateParameters[i]; args.UpdateValues[parameter.Name] = values[i]; } }
///// <summary> ///// Updates the payment information and mark it as done ///// </summary> ///// <param name="payKey">PayKey of the received payment</param> ///// <returns></returns> //private Payment CompletePaymentInDatabaseByPayKey(string payKey) //{ // PaymentBR biz = (PaymentBR)this.BusinessLogicObject; // FilterExpression filter = new FilterExpression(new Filter(Payment.ColumnNames.PayKey, payKey)); // filter.AddFilter(new Filter(Payment.ColumnNames.PaymentStatusID, (int)EntityEnums.PaymentStatusEnum.PendingWithPayKey)); // List<Payment> paymentsList = (List<Payment>) GetByFilter(new GetByFilterParameters(this.Entity, filter, new SortExpression(),0, 1000, null, GetSourceTypeEnum.Table)); // biz.PaymentReceived(paymentsList, payKey);// checking business rules // return CompletePaymentInDatabase(paymentsList[0]); // //UpdateParameters updateParameters = new UpdateParameters(); // //for(int i = 0; i < paymentsList.Count; i++) // //{ // // var payment = paymentsList[i]; // // payment.PaymentStatusID = (int) EntityEnums.PaymentStatusEnum.Done; // // payment.CompletedDateTime = DateTime.UtcNow; // // if (i != 0) // the other object should be changed separately to come to the transaction // // { // // parameters.DetailEntityObjects.Add(new DetailObjectInfo() // // { // // EntityName = Payment.EntityName, // // AdditionalDataKey = "", // // EntitySet = payment, // // FKColumnNameForAutoSet = "", // // FnName = RuleFunctionSEnum.Update // // }); // // } // //} // //Update(paymentsList[0], updateParameters); // //return paymentsList[0]; //} private Payment CompletePaymentInDatabase(Payment payment) { UpdateParameters updateParameters = new UpdateParameters(); payment.PaymentStatusID = (int)EntityEnums.PaymentStatusEnum.Done; payment.CompletedDateTime = DateTime.UtcNow; Update(payment, updateParameters); return(payment); }
protected ComponentReplicationHandler(EntityManager entityManager) { EntityManager = entityManager; ShortCircuitParameters = new CommandParameters { AllowShortCircuiting = true }; UpdateParameters = new UpdateParameters { Loopback = ComponentUpdateLoopback.ShortCircuited }; }
/// <exclude /> internal override void UpdateProgress(UpdateParameters p) { // update keyframes first this.UpdateChildren(p); this.UpdateAnimation(); if (this.EnableTrace && this.trace.Count < this.trace.Capacity) { this.trace.Add(new Tuple <double, double>(p.GameTime.ElapsedGameTime.TotalMilliseconds, targets[0].GetValue())); } }
static UpdateImplementation() { UpdateParameters.Add( Assign( Property(UpdateEntityParameter, _updatedMember.Name), Constant(DateTime.UtcNow))); Update = Lambda <Action <TEntity> >( Block(UpdateParameters), UpdateEntityParameter) .Compile(); }
public static void UpdateLocation(Session session, UpdateLocation location, UpdateParameters parameters) { if (!characterInfo.TryGetValue(session.Character, out CharacterUpdateInfo info)) { return; } info.Location = location.Location; IWritable update = BuildUpdate(location, session.Character.Sequence); BroadcastUpdate(session, update); }
public static void UpdateTarget(Session session, UpdateTarget target, UpdateParameters parameters) { if (!characterInfo.TryGetValue(session.Character, out CharacterUpdateInfo info)) { return; } info.Target = target.Target; IWritable update = BuildUpdate(target, session.Character.Sequence); BroadcastUpdate(session, update); }
private Vector3 CalculateTargetPosition(out UpdateParameters updateParameters) { updateParameters = new UpdateParameters(); CalculateVerticalCameraPosition(ref updateParameters); CalculateHorizontalCameraPosition(ref updateParameters); return(new Vector3( updateParameters.XPos, updateParameters.YPos - CameraOffset.y, Target.position.z - CameraOffset.z)); }
//update methods public virtual async Task Update(UpdateParameters parameters, List <SignalDispatch <ObjectId> > items) { if (!parameters.UpdateAnything) { return; } Task dtTask = UpdateDTCounters(parameters, items); Task categoryTask = UpdateCategoryCounters(parameters, items); Task topicTask = UpdateTopicCounters(parameters, items); await dtTask; await categoryTask; await topicTask; }
/// <summary> /// Broadcast <see cref="IWritable"/>, the way the packet will be broadcast will dictated by the supplied <see cref="UpdateParameters"/>. /// </summary> private static void BroadcastUpdate(Session session, IWritable message, UpdateParameters parameters) { if (!string.IsNullOrEmpty(parameters.Fellowship)) { session.Fellowships.SingleOrDefault(f => f.Info.Name == parameters.Fellowship)?.BroadcastMessage(message); } else if (parameters.Sequence != 0u) { session.Fellowships.ForEach(f => f.BroadcastMessage(message, c => c.Sequence == parameters.Sequence)); } else { BroadcastUpdate(session, message); } }
private Payment UpdateStatusPaymentInDatabase(long paymentID, EntityEnums.PaymentStatusEnum newStatus, bool setCompletedDate) { Payment payment = (Payment)GetByID(paymentID, new GetByIDParameters()); UpdateParameters updateParameters = new UpdateParameters(); payment.PaymentStatusID = (int)newStatus; if (setCompletedDate) { payment.CompletedDateTime = DateTime.UtcNow; } Update(payment, updateParameters); return(payment); }
/// <summary> /// This method represents the update stage of the four primary stages of the component lifecycle /// (hierarchy building, component initialization, update and draw, dispose). /// <remarks> /// The <see cref="Update"/> method is the main counterpart of the <see cref="Draw"/> method. /// While the <see cref="Draw"/> method /// is responsible for drawing components on the screen, the <see cref="Update"/> method is responsible /// for calculating where the things need to be drawn. Essentially, the <see cref="Update"/> takes /// the "heavy" part out of equasions for when things need to be rendered. /// </remarks> /// </summary> public virtual void Update(UpdateParameters p) { this.updateCycle = p.Game.CycleNumber; if (this.Subcomponents != null) { for (int i = 0; i < this.Subcomponents.Count; i++) { var subcomponent = this.Subcomponents[i]; if (subcomponent.Enabled) { subcomponent.Update(p); } } } }
/// <inheritdoc /> public override void Update(UpdateParameters p) { if (!this.inProgress || this.isPaused) { return; } UpdateTime(p); if (!this.inProgress || this.isPaused) { return; } UpdateProgress(p); }
//update public virtual async Task Update(UpdateParameters parameters, List <SignalDispatch <long> > items) { if (!parameters.UpdateAnything) { return; } using (SenderDbContext context = _dbContextFactory.GetDbContext()) { SqlParameter updateSubscribersParam = ToUpdateSubscriberType(items); string command = CreateUpdateQuery(parameters, context); int changes = await context.Database.ExecuteSqlCommandAsync(command, updateSubscribersParam) .ConfigureAwait(false); } }
public override void Update(UpdateParameters p) { if (!this.inProgress || this.isPaused) { return; } this.elapsedTime += p.GameTime.ElapsedGameTime; if (this.elapsedTime.TotalSeconds > this.durationReader.GetValue()) { this.Stop(); } base.Update(p); }
internal override void UpdateProgress(UpdateParameters p) { if (currentRunnable == null) { currentRunnable = GetNextAnimation(); currentRunnable.Start(); } currentRunnable.Update(p); if (!currentRunnable.InProgress) { repeatsDone++; currentRunnable = null; } }
/// <summary> /// Updates the specified entity set. /// </summary> /// <param name="entitySet">The entity set.</param> /// <param name="parameters">The parameters.</param> /// <exception cref="BRException"></exception> public void Update(object entitySet, UpdateParameters parameters) { Check.Require(_IsInitialized, "The class is not initialized yet."); BusinessRuleErrorList errors = new BusinessRuleErrorList(); CheckRules(entitySet, RuleFunctionSEnum.Update, errors); CheckDetailEntityRules(parameters.DetailEntityObjects, errors); if (errors.Count > 0) { throw new BRException(errors); } this.DataAccessObject.Update(entitySet, parameters); }
public override void Update(UpdateParameters p) { if (this.FrameCount == 0) { this.tmpBounds.X = this.FrameBounds.X + this.CurrentFrame * this.FrameBounds.Width; this.tmpBounds.Y = this.FrameBounds.Y; } else { this.tmpBounds.X = this.FrameBounds.X + (this.CurrentFrame % this.FrameCount) * this.FrameBounds.Width; this.tmpBounds.Y = this.FrameBounds.Y + (this.CurrentFrame / this.FrameCount) * this.FrameBounds.Height; } this.tmpBounds.Width = this.FrameBounds.Width; this.tmpBounds.Height = this.FrameBounds.Height; if (originalSourceRectangle.HasValue) this.tmpBounds.Offset(originalSourceRectangle.Value.X, originalSourceRectangle.Value.Y); this.SourceRectangle = this.tmpBounds; base.Update(p); }
private void RunUpdateAsync() { if (bgw.IsBusy) return; toolStripStatusLabel2.Text = "Идет обновление..."; UpdateParameters _params = new UpdateParameters { Board = txtBoard.SelectedItem.ToString(), LoadImages = chkImageLoad.Checked, PagesNum = int.Parse(txtPagesNum.Text) }; bgw.RunWorkerAsync(_params); }
public override void Update(UpdateParameters p) { base.Update(p); this.Time += p.GameTime.ElapsedGameTime.TotalSeconds; // calculate the new location of the hero if (this.CanMove) { if (this.Direction != Lunohod.Direction.VectorStop) this.Speed = this.Speed * (1.0f - this.Deceleration * p.GameTime.ElapsedGameTime.TotalSeconds); offset = this.Direction * (float)(this.Speed * p.GameTime.ElapsedGameTime.TotalSeconds); this.Bounds.Offset(offset.X, offset.Y); } // calculate distance to the tower p.LevelEngine.Tower.Bounds.Center(ref towerCenter); this.Bounds.Center(ref heroCenter); distanceToTower = (towerCenter - heroCenter).Length(); }