public override void Update(QmsDataerror entity) { QmsDataerror oldEntity = this.RetrieveById(entity.DataErrorId); base.update(oldEntity,entity); base.Save(); }
public QmsDataerror QmsDataError() { QmsDataerror q = new QmsDataerror(); q.AssignedAt = this.AssignedAt; q.AssignedByUserId = this.AssignedByUserId; q.AssignedToOrgId = this.AssignedToOrgId.Value; q.AssignedToUserId = this.AssignedToUserId; q.CorrectiveActionId = this.CorrectiveActionId; q.CreatedAt = this.CreatedAt; q.CreatedByUserId = this.CreatedByUserId.Value; q.CreatedByOrgId = this.CreatedByOrgId; q.DeletedAt = this.DeletedAt; q.Details = this.Details; q.DataErrorId = this.DataErrorId; q.DataErrorKey = this.DataErrorKey; q.Emplid = this.EmplId; q.StatusId = this.StatusId.Value; q.ErrorListId = this.ErrorListId; q.QmsErrorCode = this.QmsErrorCode; q.QmsErrorMessageText = this.QmsErrorMessageText; q.ResolvedAt = this.ResolvedAt; q.StatusId = this.StatusId.Value; q.SubmittedAt = this.SubmittedAt; q.UpdatedAt = this.UpdatedAt; q.RowVersion = this.RowVersion; return(q); }
public DataError(QmsDataerror qmsDataError, User viewer) { orgViewerIsFrom = viewer.OrgId.Value; this.AssignedAt = qmsDataError.AssignedAt; this.AssignedByUserId = qmsDataError.AssignedByUserId; if (this.AssignedByUserId.HasValue) { this.AssignedByUser = new User(qmsDataError.AssignedByUser, false, false); } this.AssignedToOrgId = qmsDataError.AssignedToOrgId; if (this.AssignedToOrgId.HasValue) { this.AssignedToOrg = new Organization(qmsDataError.AssignedToOrg); } this.AssignedToUserId = qmsDataError.AssignedToUserId; if (this.AssignedToUserId.HasValue) { this.AssignedToUser = new User(qmsDataError.AssignedToUser, false, false); } this.CorrectiveActionId = qmsDataError.CorrectiveActionId; this.CreatedAt = qmsDataError.CreatedAt; this.CreatedByUserId = qmsDataError.CreatedByUserId; this.CreatedByUser = new User(qmsDataError.CreatedByUser, false, false); this.CreatedByOrgId = qmsDataError.CreatedByOrgId; this.CreatedByOrg = new Organization(qmsDataError.CreatedByOrg); this.DeletedAt = qmsDataError.DeletedAt; this.Details = qmsDataError.Details; this.EmplId = qmsDataError.Emplid; this.Employee = new Employee(qmsDataError.Empl); this.DataErrorId = qmsDataError.DataErrorId; this.DataErrorKey = qmsDataError.DataErrorKey; this.ErrorListId = qmsDataError.ErrorListId; this.QmsErrorCode = qmsDataError.QmsErrorCode; this.QmsErrorMessageText = qmsDataError.QmsErrorMessageText; this.ResolvedAt = qmsDataError.ResolvedAt; this.StatusId = qmsDataError.StatusId; this.Status = new Status(qmsDataError.Status); this.SubmittedAt = qmsDataError.SubmittedAt; this.UpdatedAt = qmsDataError.UpdatedAt; this.RowVersion = qmsDataError.RowVersion; this.DataCategory = qmsDataError.ErrorList.DataItem.DataItemCategory; this.DataElement = qmsDataError.ErrorList.DataItem.DataItemName; setReadOnly(viewer); }
internal int ExecuteUpdates(DataError ehriError, User submittedBy, string history) { submitter = submittedBy; entity = ehriError; StatusTransition action = referenceRepository.RetrieveOrgStatusTranstion(ehriError.OrgStatusTransId); string actionStatus = action.ToStatus.StatusCode; entity.StatusId = action.ToStatus.StatusId; entity.UpdatedAt = DateTime.Now; if(actionStatus == StatusType.UNASSIGNED) { ActionDescription = string.Format("{0} submitted error for resolution<br/>{1}",submitter.DisplayName,history); dataErrorService.addHistory(this.entity, submitter, ActionDescription); NotificationEventType = EhriErrorNotificationType.EHRI_Submitted; SubmitForResolution(); } else if(actionStatus == StatusType.ASSIGNED) { ActionDescription = string.Format("{0} assigned error<br/>{1}",submitter.DisplayName,history); dataErrorService.addHistory(this.entity, submitter, ActionDescription); NotificationEventType = EhriErrorNotificationType.EHRI_Assigned; AssignToUser(entity); } else if(actionStatus == StatusType.CLOSED) { ActionDescription = string.Format("{0} closed error<br/>{1}",submitter.DisplayName,history); dataErrorService.addHistory(this.entity, submitter, ActionDescription); NotificationEventType = EhriErrorNotificationType.EHRI_Closed; Close(entity); } else if(actionStatus == StatusType.CLOSED_ACTION_COMPLETED) { ActionDescription = string.Format("{0} completed error<br/>{1}",submitter.DisplayName,history); dataErrorService.addHistory(this.entity, submitter, ActionDescription); NotificationEventType = EhriErrorNotificationType.EHRI_Closed; CloseActionCompleted(entity); } else if(actionStatus == StatusType.PENDING_REVIEW) { ActionDescription = string.Format("{0} submitted error for review<br/>{1}",submitter.DisplayName,history); dataErrorService.addHistory(this.entity, submitter, ActionDescription); NotificationEventType = EhriErrorNotificationType.EHRI_PendingReview; SubmitForReview(entity); } else if(actionStatus == StatusType.RETURNED) { ActionDescription = string.Format("{0} returned error to specialist<br/>{1}",submitter.DisplayName,history); dataErrorService.addHistory(this.entity, submitter, ActionDescription); NotificationEventType = EhriErrorNotificationType.EHRI_Returned; Return(entity); } else if (actionStatus == StatusType.CLOSED_CONVERT_TO_CORR_ACTION) { ActionDescription = string.Format("{0} converted to corrective action<br/>{1}",submitter.DisplayName,history); dataErrorService.addHistory(this.entity, submitter, ActionDescription); NotificationEventType = EhriErrorNotificationType.EHRI_Closed; createCorrectiveAction(submittedBy); } QmsDataerror error = entity.QmsDataError(); dataErrorRepository.Update(error); dataErrorRepository.context.SaveChanges(); return ehriError.Id; }