public async ValueTask <SubscriptionGap> GetSubscriptionGap(CancellationToken cancellationToken)
    {
        using var activity = EventuousDiagnostics.ActivitySource
                             .StartActivity(ActivityKind.Internal)
                             ?.SetTag("stream", "$all");

        try {
            var read = _eventStoreClient.ReadAllAsync(
                Direction.Backwards,
                Position.End,
                1,
                cancellationToken: cancellationToken
                );

            var events = await read.ToArrayAsync(cancellationToken).NoContext();

            var last = _getLast();

            activity?.SetActivityStatus(ActivityStatus.Ok());

            return(new SubscriptionGap(
                       _subscriptionId,
                       events[0].Event.Position.CommitPosition - last?.Position ?? 0,
                       DateTime.UtcNow - events[0].Event.Created
                       ));
        }
        catch (Exception e) {
            activity?.SetActivityStatus(ActivityStatus.Error(e));
            throw;
        }
    }
 public static string GetString(ActivityStatus statuses)
 {
     string ret = "";
     switch (statuses)
     {
         case ActivityStatus.Cancelled:
             ret = "cancelled";
             break;
         case ActivityStatus.Started:
             ret = "started";
             break;
         case ActivityStatus.Suspended:
             ret = "suspended";
             break;
         case ActivityStatus.Complete:
             ret = "complete";
             break;
         case ActivityStatus.Pending:
             ret = "pending";
             break;
         case ActivityStatus.NotDone:
             ret = "notdone";
             break;
         case ActivityStatus.Deleted:
             ret = "deleted";
             break;
         case ActivityStatus.NotCreated:
             ret = "activity create failed";
             break;
         default:
             break;
     }
     return ret;
 }
Beispiel #3
0
 public FriendUpdateMessage(int accountId, ActivityStatus status, bool ownsCoven)
     : base(MessageType.FriendUpdate)
 {
     AccountId = accountId;
     Status    = status;
     OwnsCoven = ownsCoven;
 }
    public async ValueTask <EventHandlingStatus> HandleEvent(IMessageConsumeContext context)
    {
        using var activity = SubscriptionActivity
                             .Create(
                  $"{Constants.Components.EventHandler}.{DiagnosticName}/{context.MessageType}",
                  ActivityKind.Internal,
                  tags: _defaultTags
                  )
                             ?.SetContextTags(context)
                             ?.Start();

        try {
            var status = await _innerHandler.HandleEvent(context).NoContext();

            if (activity != null && status == EventHandlingStatus.Ignored)
            {
                activity.ActivityTraceFlags = ActivityTraceFlags.None;
            }

            activity?.SetActivityStatus(ActivityStatus.Ok());

            return(status);
        }
        catch (Exception e) {
            activity?.SetActivityStatus(ActivityStatus.Error(e, $"Error handling {context.MessageType}"));
            throw;
        }
    }
Beispiel #5
0
        public static List <Activity> getActivitiesByStatus(ActivityStatus status, int fromIndex, int count, bool descending)
        {
            string orderBy = " ORDER BY `insertedTimestamp` ASC";

            if (descending)
            {
                orderBy = " ORDER BY `insertedTimestamp` DESC";
            }

            string          sql           = "select * from `activity` where `status` = ?" + orderBy + " LIMIT " + fromIndex + ", " + count;
            List <Activity> activity_list = null;

            lock (storageLock)
            {
                try
                {
                    activity_list = sqlConnection.Query <Activity>(sql, (int)status);
                }
                catch (Exception e)
                {
                    Logging.error(String.Format("Exception has been thrown while executing SQL Query {0}. Exception message: {1}", sql, e.Message));
                    return(null);
                }
            }

            return(activity_list);
        }
Beispiel #6
0
 protected ReadingUnit(string id, string title, ActivityStatus status, IEnumerable <ActivitySession> sessions)
 {
     Id                = id;
     Title             = title;
     ActivityStatus    = status;
     CompletedSessions = sessions;
 }
        /// <summary>
        /// Method to add Activity Status - RS
        /// </summary>
        /// <param name="addActivityStatus">Slab</param>
        /// <param name="instituteId">institute id</param>
        /// <returns>message</returns>
        public async Task <SharedLookUpResponse> AddActivityStatusAsync(AddActivityStatusAC addActivityStatus, int instituteId)
        {
            if (!await _iMSDbContext.ActivityStatus.AnyAsync(x => x.InstituteId == instituteId && x.Code.ToLowerInvariant() == addActivityStatus.Code.ToLowerInvariant()))
            {
                ActivityStatus activityStatus = new ActivityStatus()
                {
                    CreatedOn   = DateTime.UtcNow,
                    InstituteId = instituteId,
                    Name        = addActivityStatus.Name,
                    Code        = addActivityStatus.Code,
                    Description = addActivityStatus.Description,
                    Status      = true,
                    IsEditable  = true
                };
                _iMSDbContext.ActivityStatus.Add(activityStatus);
                await _iMSDbContext.SaveChangesAsync();

                return(new SharedLookUpResponse()
                {
                    HasError = false, Message = "Activity Status added successfully"
                });
            }
            else
            {
                return new SharedLookUpResponse()
                       {
                           HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Activity Status with the same name is already exist"
                       }
            };
        }
Beispiel #8
0
    /*void OnTriggerStay(Collider col)
     * {
     *  if(col.gameObject.tag == "Player")
     *  {
     *      PlayerInSight(col.transform.position);
     *  }
     * }*/

    void OnDestinationReached()
    {
        // Set nodeReached to true
        if (currentStatus == ActivityStatus.Patrolling)
        {
            //Wait 5 seconds
            //StartCoroutine(WaitForTime(5f));
            nodeReached = true;
        }
        else if (currentStatus == ActivityStatus.Investigating)
        {
            // Investigation point reached
            print("Investigation Dest Reached");
            //StartCoroutine(WaitForTime(5.0f));
            currentStatus = ActivityStatus.Idle;
            print("Post Coroutine Investigation");
        }
        else if (currentStatus == ActivityStatus.Chasing)
        {
            print("Chasing Dest Reached");
            // Check if player dead?
            if (!playerInSight)
            {
                currentStatus = ActivityStatus.Investigating;
                //StartCoroutine(WaitForTime(5.0f));
                currentStatus = ActivityStatus.Idle;
            }
        }
    }
        public IEnumerable <ReadingCategory <ReadingWord> > AddNewWordCategories(int nbr = 5, string programId = "Program Id",
                                                                                 ActivityStatus status = null)
        {
            using var session = DocumentStore.OpenSession();
            status ??= new CurrentlyActive();
            var categories = new List <ReadingCategoryDTO <ReadingWordDTO> >();

            for (int i = 0; i < nbr; i++)
            {
                var category = NewWordCategory(status);
                var dto      = category.ToDTO(programId);

                if (status is Planned)
                {
                    dto.ActivityStatus.SortingIndex = i;
                }

                session.Store(dto);
                categories.Add(dto);
            }

            session.SaveChanges();

            var toReturn = categories.Select(x => x.ToCategory());

            return(toReturn);
        }
Beispiel #10
0
 public WorkOrderModel()
 {
     // _assignedDate = DateTime.Now.ToString("yyyy-MM-dd");
     // _resourceId = "";
     // _fallbackResourceId = "";
     // _positionInRoute = "";
     // _address = "";
     // _apptNumber = "";
     // _cell = "";
     // _city = "";
     // _customerNumber = "";
     // _email = "";
     // _duration = "";
     // _language = "";
     // _name = "";
     // _phone = "";
     // _serviceWindowStart = "";
     // _serviceWindowEnd = "";
     // _slaWindowStart = DateTime.Now;
     // _slaWindowEnd = DateTime.Now;
     // _state = "";
     // _teamId = "";
     // _timeSlot = false;
     // _timeZone = "";
     // _workType = "";
     // _workTypeLabel = "";
     // _zip = "";
     // _inventories = new List<InventoryModel>();
     // _requiredInventories = new List<RequiredInventoryModel>();
     //_providerPreferences = new List<ProviderPreferenceModel>();
     _status = ActivityStatus.Pending;
     //_commandType = ActivityCommandType.Update;
     //_actionIfCompleted = ActionIfCompleted.CreateIfAssignOrReschedule;
 }
Beispiel #11
0
        protected override void OnStateChanged(ActivityStatus previousState, ActivityStatus newState)
        {
            if (newState == ActivityStatus.CM)
                this.ReportPart.Verifier = this.PerformingStaff;

            base.OnStateChanged(previousState, newState);
        }
Beispiel #12
0
        public static bool updateStatus(byte[] data, ActivityStatus status, ulong block_height)
        {
            bool result = false;

            if (CoreConfig.walletNotifyCommand != "")
            {
                string notify_cmd = CoreConfig.walletNotifyCommand.Replace("%s", Encoding.UTF8.GetString(data));
                IxiUtils.executeProcess(notify_cmd, "", false);
            }

            lock (storageLock)
            {
                if (block_height > 0)
                {
                    string sql = "UPDATE `activity` SET `status` = ?, `blockHeight` = ? WHERE `data` = ?";
                    result = executeSQL(sql, status, (long)block_height, data);
                }
                else
                {
                    string sql = "UPDATE `activity` SET `status` = ? WHERE `data` = ?";
                    result = executeSQL(sql, status, data);
                }
            }

            return(result);
        }
Beispiel #13
0
        public virtual string GetStringStatus(ActivityStatus status)
        {
            if (status == ActivityStatus.Scheduled)
            {
                return("agendada");
            }
            if (status == ActivityStatus.InProgress)
            {
                return("em andamento");
            }
            if (status == ActivityStatus.Done)
            {
                return("concluída");
            }
            if (status == ActivityStatus.Reported)
            {
                return("reportada como problema");
            }
            if (status == ActivityStatus.Canceled)
            {
                return("cancelada");
            }

            throw new ActivityConverterException(status.ToString());
        }
Beispiel #14
0
 void Disabled()
 {
     if (Time.time > (disableStart + disableTimer))
     {
         currentStatus = ActivityStatus.Idle;
     }
 }
        public async Task <ActionResult <ActivityStatus> > PostActivityStatus(ActivityStatus activityStatus)
        {
            _context.ActivityStatus.Add(activityStatus);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetActivityStatus", new { id = activityStatus.ActivityStatusId }, activityStatus));
        }
Beispiel #16
0
 public dtoDataValue(DataValue DV)
 {
     this.id     = DV.id;
     this.Name   = DV.Name;
     this.Value  = DV.Value;
     this.Status = DV.Status;
 }
        public async Task <IActionResult> PutActivityStatus(int id, ActivityStatus activityStatus)
        {
            if (id != activityStatus.ActivityStatusId)
            {
                return(BadRequest());
            }

            _context.Entry(activityStatus).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ActivityStatusExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        /// <summary>
        /// Method to update Activity Status - RS
        /// </summary>
        /// <param name="updateMeetingAgenda">Slab detail</param>
        /// <param name="instituteId">institute id</param>
        /// <returns>message</returns>
        public async Task <SharedLookUpResponse> UpdateActivityStatusAsync(UpdateActivityStatusAC updateActivityStatus, int instituteId)
        {
            List <ActivityStatus> activityStatuses = await _iMSDbContext.ActivityStatus.Where(x => x.InstituteId == instituteId && x.Id != updateActivityStatus.ActivityStatusId).ToListAsync();

            bool isDuplicate = activityStatuses.Any(x => x.Code.ToLowerInvariant() == updateActivityStatus.Code.ToLowerInvariant());

            if (isDuplicate)
            {
                return new SharedLookUpResponse()
                       {
                           HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Duplicate code of Activity Status. Please use unique code"
                       }
            }
            ;
            else
            {
                ActivityStatus activityStatus = await _iMSDbContext.ActivityStatus.FirstAsync(x => x.Id == updateActivityStatus.ActivityStatusId);

                activityStatus.Name        = updateActivityStatus.Name;
                activityStatus.Code        = updateActivityStatus.Code;
                activityStatus.Description = updateActivityStatus.Description;
                activityStatus.Status      = updateActivityStatus.Status;

                _iMSDbContext.ActivityStatus.Update(activityStatus);
                await _iMSDbContext.SaveChangesAsync();

                return(new SharedLookUpResponse()
                {
                    HasError = false, Message = "Activity Status updated successfully"
                });
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,ActivityStatusName")] ActivityStatus activityStatus)
        {
            if (id != activityStatus.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(activityStatus);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ActivityStatusExists(activityStatus.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(ListActivityStatuses)));
            }
            return(View(activityStatus));
        }
Beispiel #20
0
        public void Check_ActivityRespository_Update()
        {
            //given
            var descriptionText        = "Given Description";
            var descriptionTextChanged = "Given Description Modificada";
            var project = ProjectReference.From(EntityId.From(1u), Description.From(descriptionText));

            var id = EntityId.From(1u);

            var task = Activity.From(Description.From(descriptionText), id,
                                     EntityId.From(1u), ActivityStatus.From(1));

            //when
            var taskOptionsBuilder = new DbContextOptionsBuilder <ActivityDbContext>();

            taskOptionsBuilder.UseSqlite("Data Source=todoagility_repo_update_test.db;");
            var taskDbContext = new ActivityDbContext(taskOptionsBuilder.Options);
            var repTask       = new ActivityRepository(taskDbContext);

            using var taskDbSession = new ActivityDbSession(taskDbContext, repTask);
            taskDbSession.Repository.Add(task);
            taskDbSession.SaveChanges();

            //then
            var taskSaved  = taskDbSession.Repository.Get(id);
            var updatetask = Activity.CombineWithPatch(taskSaved,
                                                       Activity.Patch.FromDescription(Description.From(descriptionTextChanged)));

            taskDbSession.Repository.Add(updatetask);
            taskDbSession.SaveChanges();

            var taskUpdated = taskDbSession.Repository.Get(id);

            Assert.NotEqual(taskUpdated, task);
        }
        public void Check_DomainEvents_ActivityAdded_Raise()
        {
            //given

            //existing project
            var project = Project.From(EntityId.From(1u), Description.From("descriptionText"));

            //a activity it is attached to it
            var activity = Activity.From(Description.From("activity to do"), EntityId.From(1u),
                                         EntityId.From(1u), ActivityStatus.From(1));

            var projectOptionsBuilder = new DbContextOptionsBuilder <ProjectDbContext>();

            projectOptionsBuilder.UseSqlite("Data Source=todoagility_proj_activity_reference.db;");
            var projectDbContext = new ProjectDbContext(projectOptionsBuilder.Options);
            var repProject       = new ProjectRepository(projectDbContext);

            using var projectDbSession = new DbSession <IProjectRepository>(projectDbContext, repProject);
            repProject.Add(project);
            projectDbSession.SaveChanges();
            var handlerActivityAdded = new ActivityAddedHandler(projectDbSession);
            var dispatcher           = new DomainEventDispatcher();

            dispatcher.Subscribe(typeof(ActivityAddedEvent).FullName, handlerActivityAdded);

            //when
            dispatcher.Publish(ActivityAddedEvent.For(activity));

            //then
            var proj = repProject.Get(EntityId.From(1u));

            Assert.True(proj.Activities.Count > 0);
        }
Beispiel #22
0
        public Activity(string tagNumber, string tagDes, int progress, int weightFactor
                        , float valueUnitNum, int estimateMh, int actualMh, ActivityStatus status
                        , DateTime?acStartDate, DateTime?acEndDate
                        , DateTime?planStartDate, DateTime?planEndDate, long formDicId, int valueUnitId
                        , int workpackageId, int locationId, long subsystemId, ActivityCondition condition, string acCode
                        , int desciplineId, int wStepId)
        {
            this.TagNumber         = tagNumber;
            this.TagDescription    = tagDes;
            this.Progress          = progress;
            this.WeightFactor      = weightFactor;
            this.ValueUnitNum      = valueUnitNum;
            this.EstimateMh        = estimateMh;
            this.ActualMh          = actualMh;
            this.Status            = status;
            this.ActualStartDate   = acStartDate;
            this.ActualEndDate     = acEndDate;
            this.PlanStartDate     = planStartDate;
            this.PlanEndDate       = planEndDate;
            this.FormDictionaryId  = formDicId;
            this.ValueUnitId       = valueUnitId;
            this.WorkPackageId     = workpackageId;
            this.LocationId        = locationId;
            this.SubsytemId        = subsystemId;
            this.Condition         = condition;
            this.ActivityCode      = acCode;
            this.DesciplineId      = desciplineId;
            this.WorkPackageStepId = wStepId;

            this.Punchs            = new List <Punch>();
            this.StatusHistory     = new List <ActivityStatusHistory>();
            this.ActivityDocuments = new List <ActivityDocument>();
        }
Beispiel #23
0
    public async Task <Result> Handle(object command, CancellationToken cancellationToken)
    {
        using var activity = AppServiceActivity.StartActivity(_appServiceTypeName, command);

        try {
            var result = await InnerService.Handle(command, cancellationToken).NoContext();

            if (activity != null)
            {
                if (result is ErrorResult error)
                {
                    activity.SetActivityStatus(ActivityStatus.Error(error.Exception));
                }
                else
                {
                    activity.SetActivityStatus(ActivityStatus.Ok());
                }
            }

            return(result);
        }
        catch (Exception e) {
            activity?.SetActivityStatus(ActivityStatus.Error(e));
            throw;
        }
    }
        public void Check_UpdateActivityCommandHandler_Succeed()
        {
            var description        = "Given Description";
            var id                 = 1u;
            var projectId          = 1u;
            var dispatcher         = new DomainEventDispatcher();
            var taskOptionsBuilder = new DbContextOptionsBuilder <ActivityDbContext>();

            taskOptionsBuilder.UseSqlite("Data Source=todoagility_cqrs_test.db;");
            var taskDbContext = new ActivityDbContext(taskOptionsBuilder.Options);
            var repTask       = new ActivityRepository(taskDbContext);

            using var taskDbSession = new DbSession <IActivityRepository>(taskDbContext, repTask);

            var project      = Project.From(EntityId.From(projectId), Description.From(description));
            var originalTask = Activity.From(Description.From(description), EntityId.From(id),
                                             EntityId.From(projectId), ActivityStatus.From(1));

            taskDbSession.Repository.AddProject(project);
            taskDbSession.Repository.Add(originalTask);
            taskDbSession.SaveChanges();

            var descriptionNew = "Given Description Changed";
            var command        = new UpdateActivityCommand(id, descriptionNew);

            var handler = new UpdateActivityCommandHandler(taskDbSession, dispatcher);

            handler.Execute(command);

            var task = taskDbSession.Repository.Get(EntityId.From(id));

            Assert.NotEqual(task, originalTask);
        }
        public virtual void Update()
        {
            if (eRechargeActivityOpenRule.LimitTime != OpenRule)
            {
                return;
            }
            if (Status == ActivityStatus.Waiting)
            {
                if (DateTime.Now > StartTime && DateTime.Now < EndTime)
                {
                    Status = ActivityStatus.Started;
                    OperationActivityManager.Instance.MarkAllCharacterDirty(ServerList);
                    OnStart();
                }
            }
            else if (Status == ActivityStatus.Started)
            {
                if (DateTime.Now > EndTime)
                {
                    Status = ActivityStatus.Ended;
                    OperationActivityManager.Instance.MarkAllCharacterDirty(ServerList);
                    OnEnd();
                }
            }
//          else if (Status == ActivityStatus.Started)
//          {
//              if (DateTime.Now > EndTime)
//              {
//                  Status = ActivityStatus.Ended;
//                  OnEnd();
//              }
//          }
        }
        public void Check_ChangeStatusActivityCommandHandler_Failed()
        {
            var description    = "Given Description";
            var id             = 1u;
            var newStatus      = 4;
            var projectId      = 1u;
            var dispatcher     = new DomainEventDispatcher();
            var optionsBuilder = new DbContextOptionsBuilder <ActivityDbContext>();

            optionsBuilder.UseSqlite("Data Source=todoagility_cqrs_changed_failed_test.db;");
            var taskDbContext = new ActivityDbContext(optionsBuilder.Options);
            var repTask       = new ActivityRepository(taskDbContext);

            using var taskDbSession = new DbSession <IActivityRepository>(taskDbContext, repTask);

            var originalTask = Activity.From(Description.From(description), EntityId.From(id),
                                             EntityId.From(projectId), ActivityStatus.From(1));

            taskDbSession.Repository.Add(originalTask);
            taskDbSession.SaveChanges();

            var command = new ChangeActivityStatusCommand(id, newStatus);

            var handler = new ChangeActivityStatusCommandHandler(taskDbSession, dispatcher);
            var result  = handler.Execute(command);

            Assert.False(result.IsSucceed);
        }
Beispiel #27
0
 private static void ThrowCannotTransitionToFinalStatus(ActivityStatus targetStatus, ActivityStatus currentStatus)
 {
     throw new InvalidOperationException($"Cannot transition {nameof(Activity)} to the '{targetStatus}'-status:"
                                         + $" Transition may only occur for an {nameof(Activity)} with"
                                         + $" {nameof(Status)} == {ActivityStatus.Running}."
                                         + $" However, the current {nameof(Status)} of this {nameof(Activity)} is '{currentStatus}'.");
 }
Beispiel #28
0
 public async Task <bool> Delete(ActivityStatus ActivityStatus)
 {
     if (await ValidateId(ActivityStatus))
     {
     }
     return(ActivityStatus.IsValidated);
 }
Beispiel #29
0
            protected static T CurrentProcedureStep <T>(Procedure rp, ActivityStatus status) where T : ProcedureStep
            {
                ProcedureStep uncastProcedureStep = CollectionUtils.SelectFirst(
                    rp.ProcedureSteps,
                    delegate(ProcedureStep ps) { return(ps.Is <T>() && ps.State == status); });

                return(uncastProcedureStep != null?uncastProcedureStep.Downcast <T>() : null);
            }
 public static ActivityStatusModel Map(ActivityStatus activityStatus)
 {
     return(new ActivityStatusModel
     {
         Id = activityStatus.Id,
         Name = activityStatus.Name
     });
 }
Beispiel #31
0
 public ActivityEventBase(object trigger, string displayName, string activityId, ActivityEventType type,
                          int templateId = 0, ActivityStatus status = ActivityStatus.Unspecified)
     : base(trigger, displayName, templateId)
 {
     this.ActivityId = activityId;
     this.Type       = type;
     this.Status     = status;
 }
 private ActivityUpdatedEvent(EntityId id, Description description, EntityId projectId, ActivityStatus status)
     : base(DateTime.Now)
 {
     Description = description;
     Id          = id;
     ProjectId   = projectId;
     Status      = status;
 }
Beispiel #33
0
        protected override void OnStateChanged(ActivityStatus previousState, ActivityStatus newState)
        {
            if(newState == ActivityStatus.CM)
            {
                if (this.ReportPart == null)
                    throw new WorkflowException("This ReportingStep does not have an associated ReportPart.");
            }

            base.OnStateChanged(previousState, newState);
        }
        public bool Add(ActivityStatus entity)
        {
            if (entity.ID != 0)
            {
                return false;
            }

            Context.ActivityStatus.InsertOnSubmit(entity);
            Context.SubmitChanges();
            return true;
        }
		protected override void OnStateChanged(ActivityStatus previousState, ActivityStatus newState)
		{
			if (newState == ActivityStatus.CM)
			{
				if (this.ReportPart == null)
					throw new WorkflowException("This ReportingStep does not have an associated ReportPart.");

				// When a supervisor completes a submitted transcription, do not overwrite the original transcriber.
				if (this.ReportPart.Transcriber == null)
					this.ReportPart.Transcriber = this.PerformingStaff;
			}

			base.OnStateChanged(previousState, newState);
		}
        public bool Remove(ActivityStatus entity)
        {
            if (entity.ID == 0)
            {
                return false;
            }

            ActivityStatus existEntity = Entities.SingleOrDefault(x => x.ID == entity.ID);
            if (existEntity == null)
            {
                return false;
            }

            Context.ActivityStatus.DeleteOnSubmit(existEntity);
            Context.SubmitChanges();
            return true;
        }
        public bool Update(ActivityStatus entity)
        {
            if (entity.ID == 0)
            {
                return false;
            }

            var existEntity = Context.ActivityStatus.SingleOrDefault(x => x.ID == entity.ID);
            if (existEntity == null)
            {
                return false;
            }

            existEntity.Name = entity.Name;
            Context.SubmitChanges();
            return true;
        }
Beispiel #38
0
		protected override void OnStateChanged(ActivityStatus previousState, ActivityStatus newState)
		{
			// complete the report part when publication is complete
			if (newState == ActivityStatus.CM)
			{
				this.ReportPart.Complete();

				// if step corresponds to the initial report (not an addendum), mark procedure(s) as
				// being complete
				if (this.ReportPart.Index == 0)
				{
					foreach (Procedure procedure in this.AllProcedures)
					{
						procedure.Complete((DateTime) this.EndTime);
					}
				}
			}

			base.OnStateChanged(previousState, newState);
		}
Beispiel #39
0
		protected virtual void OnStarted()
		{
			mWaitHandle.Reset();
			mStatus = ActivityStatus.Running;

			if (mEvents != null)
				mEvents.ActivityStarted(this);
		}
 private static Activity CreateActivity(ActivityStatus status)
 {
     return new Activity("fakeActivity", status);
 }
Beispiel #41
0
 public Activity(string name, ActivityStatus status) : base(name)
 {
     Status = status;
 }
Beispiel #42
0
 internal void MeetingEnded()
 {
     _villagerActivity = _villagerActivity & ~ActivityStatus.CONVOCATED;
 }
 public WorkOrderModel()
 {
     // _assignedDate = DateTime.Now.ToString("yyyy-MM-dd");
     // _resourceId = "";
     // _fallbackResourceId = "";
     // _positionInRoute = "";
     // _address = "";
     // _apptNumber = "";
     // _cell = "";
     // _city = "";
     // _customerNumber = "";
     // _email = "";
     // _duration = "";
     // _language = "";
     // _name = "";
     // _phone = "";
     // _serviceWindowStart = "";
     // _serviceWindowEnd = "";
     // _slaWindowStart = DateTime.Now;
     // _slaWindowEnd = DateTime.Now;
     // _state = "";
     // _teamId = "";
     // _timeSlot = false;
     // _timeZone = "";
     // _workType = "";
     // _workTypeLabel = "";
     // _zip = "";
     // _inventories = new List<InventoryModel>();
     // _requiredInventories = new List<RequiredInventoryModel>();
     //_providerPreferences = new List<ProviderPreferenceModel>();
     _status = ActivityStatus.Pending;
     //_commandType = ActivityCommandType.Update;
     //_actionIfCompleted = ActionIfCompleted.CreateIfAssignOrReschedule;
 }
Beispiel #44
0
 public static ActivityStatus CreateActivityStatus(int ID, string title, int internalId, byte[] rowVersion)
 {
     ActivityStatus activityStatus = new ActivityStatus();
     activityStatus.Id = ID;
     activityStatus.Title = title;
     activityStatus.InternalId = internalId;
     activityStatus.RowVersion = rowVersion;
     return activityStatus;
 }
Beispiel #45
0
 public void AddToActivityStatus(ActivityStatus activityStatus)
 {
     base.AddObject("ActivityStatus", activityStatus);
 }
Beispiel #46
0
        /// <summary>
        /// Called after this procedure step undergoes a state transition.
        /// </summary>
        /// <param name="previousState"></param>
        /// <param name="newState"></param>
        protected override void OnStateChanged(ActivityStatus previousState, ActivityStatus newState)
        {
            if (this.IsPreStep == false)
            {
                _procedure.UpdateStatus();
            }

            base.OnStateChanged(previousState, newState);
        }
Beispiel #47
0
 internal void FestEnded()
 {
     _villagerActivity = _villagerActivity & ~ActivityStatus.PARTYING;
 }
Beispiel #48
0
 internal void FestStarted()
 {
     _villagerActivity = _villagerActivity | ActivityStatus.PARTYING;
 }
Beispiel #49
0
        public void Post(UnitOfWork uow)
        {
            if (this.Status == ActivityStatus.Waiting)
            {
                WHHistory whHistory = new WHHistory(uow);
                whHistory.Item = this.Item;
                whHistory.OriginalQty = this.Qty;
                whHistory.OriginalUnit = this.Unit;
                whHistory.RefNo = this.ActivityNo;
                whHistory.RefType = WHHistory.ReferenceType.Manual;
                whHistory.Warehouse = this.Warehouse;
                whHistory.Remark = this.Remark;
                whHistory.FromTo = this.FromTo;
                whHistory.WHQty = this.Qty;
                whHistory.WHUnit = whHistory.OriginalUnit;
                whHistory.Save();

                _Status = ActivityStatus.Complete;
                OnChanged("Status");

                _PostedBy = base.CurrentUser;
                OnChanged("PostedBy");
                _PostedDate = ServerHelper.GetCurrentDateTime();
                OnChanged("PostedDate");

                _Date = ServerHelper.GetCurrentDateTime();
                OnChanged("Date");
            }
        }
Beispiel #50
0
		protected virtual void OnException(Exception e)
		{
			mStatus = ActivityStatus.Exception;
			mException = e;
			mWaitHandle.Set();

			if (mEvents != null)
				mEvents.ActivityException(this, e);
		}
Beispiel #51
0
		/// <summary>
		/// Reset the status property to the original values. If the activity is still running an exception is throw.
		/// </summary>
		protected virtual void ResetRunningStatus()
		{
			if (mStatus == ActivityStatus.Running)
				throw new ActivityStatusNotValidException();

			mIsCanceled = false;
			mStatus = ActivityStatus.Pending;
			mException = null;
			mWaitHandle.Set(); //signaled
		}
Beispiel #52
0
		protected virtual void OnCompleted()
		{
			mStatus = ActivityStatus.Completed;
			mWaitHandle.Set();

			if (mEvents != null)
				mEvents.ActivityCompleted(this);
		}
Beispiel #53
0
 public TriggerData(string name, ActivityStatus status)
     : base(name, status)
 {
 }
Beispiel #54
0
        private void clientChangeStat(ActivityStatus stat)
        {
            try
            {
                var rows = disp_grid_client.SelectedRows;
                foreach (DataGridViewRow r in rows)
                {
                    DataGridViewCellCollection c = r.Cells;
                    int clientId = int.Parse(c["col_clientId"].Value.ToString());
                    RecordsDataSet.ClientRow client = db.Client.FindByid(clientId);

                    client.clientStatus = stat.ToString();
                }

                dbmgr.UpdateAll(db);
                fillClientGrid();

                showSuccessMessage("Updated " + rows.Count + " item(s)");
            }
            catch (Exception ex)
            {
                db.RejectChanges();
                showErrorMessage("An Error Occured.\n\nDetails:\n" + ex.Message);
            }
        }
 private void CheckStatus(ActivityStatus status, ProcedureStep o)
 {
     Assert.AreEqual(status, o.State, string.Format("Exptected {0} status {1}", o.GetClass().Name, status.ToString()));
 }
    /// <summary>
    /// 设置活动状态-根据不同状态设置UI
    /// </summary>
    /// <param name="status"></param>
    public void SetActivityStatus(ActivityStatus status)
    {
        switch (status)
        {
            case ActivityStatus.HasReward:
                {
                    m_lblCDText.effectStyle = UILabel.Effect.Outline;
                    m_lblCDText.effectColor = SystemUIColorManager.WHITE_OUTLINE;
                    m_lblCDText.color = SystemUIColorManager.WHITE;

                    m_lblInfoTitle.effectStyle = UILabel.Effect.Outline;
                    m_lblInfoTitle.effectColor = SystemUIColorManager.WHITE_OUTLINE;
                    m_lblInfoTitle.color = SystemUIColorManager.WHITE;

                    ShowHasRewardFlag(true);
                    ShowFinishedFX(false);

                    // 设置领取按钮
                    m_goGetBtn.SetActive(false);
                    

                    // 设置分享按钮
                    //m_goShareBtn.SetActive(false);
                }
                break;
            case ActivityStatus.HasFinished:
                {
                    m_lblCDText.effectStyle = UILabel.Effect.Outline;
                    m_lblCDText.effectColor = SystemUIColorManager.YELLOW_OUTLINE;
                    m_lblCDText.color = SystemUIColorManager.YELLOW;

                    m_lblInfoTitle.effectStyle = UILabel.Effect.Outline;
                    m_lblInfoTitle.effectColor = SystemUIColorManager.YELLOW_OUTLINE;
                    m_lblInfoTitle.color = SystemUIColorManager.YELLOW;

                    ShowHasRewardFlag(false);
                    ShowFinishedFX(true);

                    // 设置领取按钮
                    m_goGetBtn.SetActive(true);
                    m_goGetBtn.GetComponentsInChildren<BoxCollider>(true)[0].enabled = true;
                    m_spGetBtnBGUp.spriteName = "btn_03up";

                    // 设置分享按钮
                    //m_goShareBtn.SetActive(true);
                }
                break;
            case ActivityStatus.TimeUseUp:
                {
                    m_lblCDText.effectStyle = UILabel.Effect.Outline;
                    m_lblCDText.effectColor = SystemUIColorManager.WHITE_OUTLINE;
                    m_lblCDText.color = SystemUIColorManager.WHITE;

                    m_lblInfoTitle.effectStyle = UILabel.Effect.Outline;
                    m_lblInfoTitle.effectColor = SystemUIColorManager.WHITE_OUTLINE;
                    m_lblInfoTitle.color = SystemUIColorManager.WHITE;

                    ShowHasRewardFlag(false);
                    ShowFinishedFX(false);

                    // 设置领取按钮
                    m_goGetBtn.SetActive(false);

                    // 设置分享按钮
                    //m_goShareBtn.SetActive(false);
                }
                break;
            case ActivityStatus.OtherStatus:
                {
                    m_lblCDText.effectStyle = UILabel.Effect.None;
                    m_lblCDText.color = SystemUIColorManager.BROWN;

                    m_lblInfoTitle.effectStyle = UILabel.Effect.None;
                    m_lblInfoTitle.color = SystemUIColorManager.BROWN;

                    ShowHasRewardFlag(false);
                    ShowFinishedFX(false);

                    // 设置领取按钮
                    m_goGetBtn.SetActive(true);
                    m_goGetBtn.GetComponentsInChildren<BoxCollider>(true)[0].enabled = false;
                    m_spGetBtnBGUp.spriteName = "btn_03grey";

                    // 设置分享按钮
                    //m_goShareBtn.SetActive(true);
                }
                break;
            default:
                break;
        }
    }    
    /// <summary>
    /// 设置活动状态-根据不同状态设置UI
    /// </summary>
    /// <param name="status"></param>
    public void SetActivityStatus(ActivityStatus status)
    {
        switch (status)
        {
            case ActivityStatus.HasReward:
                {
                    m_lblCDText.effectStyle = UILabel.Effect.Outline;
                    m_lblCDText.effectColor = SystemUIColorManager.WHITE_OUTLINE;
                    m_lblCDText.color = SystemUIColorManager.WHITE;

                    m_lblTitleText.effectStyle = UILabel.Effect.Outline;
                    m_lblTitleText.effectColor = SystemUIColorManager.WHITE_OUTLINE;
                    m_lblTitleText.color = SystemUIColorManager.WHITE;

                    m_goTimeLimitActivityHasReward.SetActive(true);
                    ShowActivityFinishedAnim(false);
                }
                break;
            case ActivityStatus.HasFinished:
                {
                    m_lblCDText.effectStyle = UILabel.Effect.Outline;
                    m_lblCDText.effectColor = SystemUIColorManager.YELLOW_OUTLINE;
                    m_lblCDText.color = SystemUIColorManager.YELLOW;

                    m_lblTitleText.effectStyle = UILabel.Effect.Outline;
                    m_lblTitleText.effectColor = SystemUIColorManager.YELLOW_OUTLINE;
                    m_lblTitleText.color = SystemUIColorManager.YELLOW;

                    m_goTimeLimitActivityHasReward.SetActive(false);
                    ShowActivityFinishedAnim(true);
                }
                break;
            case ActivityStatus.TimeUseUp:
                {
                    m_lblCDText.effectStyle = UILabel.Effect.Outline;
                    m_lblCDText.effectColor = SystemUIColorManager.WHITE_OUTLINE;
                    m_lblCDText.color = SystemUIColorManager.WHITE;

                    m_lblTitleText.effectStyle = UILabel.Effect.Outline;
                    m_lblTitleText.effectColor = SystemUIColorManager.WHITE_OUTLINE;
                    m_lblTitleText.color = SystemUIColorManager.WHITE;

                    m_goTimeLimitActivityHasReward.SetActive(false);
                    ShowActivityFinishedAnim(false);
                }
                break;
            case ActivityStatus.OtherStatus:
                {
                    m_lblCDText.effectStyle = UILabel.Effect.None;
                    m_lblCDText.color = SystemUIColorManager.BROWN;

                    m_lblTitleText.effectStyle = UILabel.Effect.None;
                    m_lblTitleText.color = SystemUIColorManager.BROWN;

                    m_goTimeLimitActivityHasReward.SetActive(false);
                    ShowActivityFinishedAnim(false);
                }
                break;
            default:
                break;
        }
    }
Beispiel #58
0
 internal void MeetingStarted()
 {
     _villagerActivity = _villagerActivity | ActivityStatus.CONVOCATED;
 }