public void DisplayPopup(PopupTitle pTitle, PopupMessage pMessage, PopupResponse pMessageResponse)
    {
        Mirror.NetworkManager manager = Mirror.NetworkManager.singleton;
        _secondary.gameObject.SetActive(false);

        switch (pTitle)
        {
        case PopupTitle.Warning:
            //Warning
            _title.StringReference = _tWarning;
            break;

        case PopupTitle.Error:
            //Title
            _title.StringReference = _tError;
            break;

        case PopupTitle.Notification:
            //Title
            _title.StringReference = _tNotification;
            break;
        }

        switch (pMessage)
        {
        case PopupMessage.Code:
            //Message
            _message.StringReference = _mCode;
            //Secondary
            _secondary.gameObject.SetActive(true);
            _secondary.StringReference = _sCodeExample;
            break;

        case PopupMessage.LeaveLobby:
            //Message
            _message.StringReference = _mLeaveLobby;
            //Secondary
            _secondary.gameObject.SetActive(true);
            if (manager.mode == Mirror.NetworkManagerMode.Host)
            {
                _secondary.StringReference = _sLeaveLobbyHost;
            }
            else if (manager.mode == Mirror.NetworkManagerMode.ClientOnly)
            {
                _secondary.StringReference = _sLeaveLobbyClient;
            }
            break;

        case PopupMessage.Reconnect:
            //Message
            _message.StringReference = _mCode;
            break;

        case PopupMessage.Kick:
            //Message
            if (manager.mode == Mirror.NetworkManagerMode.Host)
            {
                _message.StringReference = _mKickHost;
            }
            else
            {
                _message.StringReference = _mKickClient;
            }
            break;

        case PopupMessage.StartAlone:
            //Message
            _message.StringReference = _mStartAlone;
            break;
        }

        switch (pMessageResponse)
        {
        case PopupResponse.YesNo:
            _yesButton.gameObject.SetActive(true);
            _noButton.gameObject.SetActive(true);
            _okButton.gameObject.SetActive(false);
            break;

        case PopupResponse.Ok:
            _yesButton.gameObject.SetActive(false);
            _noButton.gameObject.SetActive(false);
            _okButton.gameObject.SetActive(true);
            break;
        }

        transform.GetChild(0).gameObject.SetActive(true);
    }
        void ReleaseDesignerOutlets()
        {
            if (BoxView != null)
            {
                BoxView.Dispose();
                BoxView = null;
            }

            if (DescriptionText != null)
            {
                DescriptionText.Dispose();
                DescriptionText = null;
            }

            if (DialogView != null)
            {
                DialogView.Dispose();
                DialogView = null;
            }

            if (EditTextBox != null)
            {
                EditTextBox.Dispose();
                EditTextBox = null;
            }

            if (ErrorMessageText != null)
            {
                ErrorMessageText.Dispose();
                ErrorMessageText = null;
            }

            if (ErrorText != null)
            {
                ErrorText.Dispose();
                ErrorText = null;
            }

            if (OkButton != null)
            {
                OkButton.Dispose();
                OkButton = null;
            }

            if (OkButtonBottomConstraint != null)
            {
                OkButtonBottomConstraint.Dispose();
                OkButtonBottomConstraint = null;
            }

            if (PopupBottomConstraint != null)
            {
                PopupBottomConstraint.Dispose();
                PopupBottomConstraint = null;
            }

            if (PopupTitle != null)
            {
                PopupTitle.Dispose();
                PopupTitle = null;
            }

            if (PopupTopConstraint != null)
            {
                PopupTopConstraint.Dispose();
                PopupTopConstraint = null;
            }
        }
        protected override bool InternalExecute(ProcessExecutingContext context)
        {
            if (Author == null)
            {
                Author = UserConnection.CurrentUser.ContactId;
            }
            var remindingSchema        = UserConnection.EntitySchemaManager.GetInstanceByName("Reminding");
            var remindingSchemaColumns = remindingSchema.Columns;

            Terrasoft.Configuration.Reminding requiredReminding;
            bool remindingExists     = false;
            var  entitySchemaManager = UserConnection.EntitySchemaManager;
            var  query = new EntitySchemaQuery(entitySchemaManager, "Reminding")
            {
                UseAdminRights = GlobalAppSettings.FeatureUseAdminRightsInEmbeddedLogic
            };

            query.AddAllSchemaColumns();
            query.Filters.Add(query.CreateFilterWithParameters(FilterComparisonType.Equal, "SubjectId", SubjectPrimaryColumnValue));
            if (!IsSubjectDelete && !IsSingleReminder)
            {
                query.Filters.Add(query.CreateFilterWithParameters(FilterComparisonType.Equal, "Contact", Contact));
            }
            query.Filters.Add(query.CreateFilterWithParameters(FilterComparisonType.Equal, "Source", (Guid)Source));
            query.Filters.Add(query.CreateFilterWithParameters(FilterComparisonType.Equal, "SysEntitySchema.SysWorkspace.Id", UserConnection.Workspace.Id));
            var entities = query.GetEntityCollection(UserConnection);

            if (IsSingleReminder)
            {
                var count = entities.Count;
                ICollection <Entity> entityToDelete = new List <Entity>();
                for (int i = 0; i < count; i++)
                {
                    var entity    = entities[i];
                    var contactId = entity.GetTypedColumnValue <Guid>("ContactId");
                    if (!contactId.Equals(Contact))
                    {
                        entity.Delete();
                        entityToDelete.Add(entity);
                    }
                }
                entities.RemoveRange(entityToDelete);
            }
            remindingExists   = entities.Count > 0 && !IsListSubjectReminds;
            requiredReminding = entities.Count == 0 || IsListSubjectReminds
                                ? (Terrasoft.Configuration.Reminding)remindingSchema.CreateEntity(UserConnection)
                                : (Terrasoft.Configuration.Reminding)entities[0];
            requiredReminding.UseAdminRights = GlobalAppSettings.FeatureUseAdminRightsInEmbeddedLogic;

            if (Active)
            {
                if (!remindingExists)
                {
                    requiredReminding.SetDefColumnValues();
                    requiredReminding.Id = Guid.NewGuid();
                }
                if (SubjectPrimaryColumnValue != Guid.Empty)
                {
                    requiredReminding.SetColumnValue(
                        remindingSchemaColumns.GetByName("SubjectId").ColumnValueName,
                        SubjectPrimaryColumnValue
                        );
                    if (!string.IsNullOrEmpty(SubjectCaption))
                    {
                        requiredReminding.SetColumnValue(
                            remindingSchemaColumns.GetByName("SubjectCaption").ColumnValueName,
                            SubjectCaption);
                    }
                    else
                    {
                        if (SysEntitySchema != Guid.Empty)
                        {
                            var subjectSchema = UserConnection.EntitySchemaManager.GetInstanceByUId(SysEntitySchema);
                            var subjectEntity = subjectSchema.CreateEntity(UserConnection);
                            if (subjectEntity.FetchFromDB(SubjectPrimaryColumnValue))
                            {
                                requiredReminding.SetColumnValue(
                                    remindingSchemaColumns.GetByName("SubjectCaption").ColumnValueName,
                                    subjectEntity.GetTypedColumnValue <String>(subjectSchema.GetPrimaryDisplayColumnName())
                                    );
                            }
                        }
                    }
                }
                if (Contact != Guid.Empty)
                {
                    requiredReminding.SetColumnValue(
                        remindingSchemaColumns.GetByName("Contact").ColumnValueName,
                        Contact
                        );
                }
                if (!string.IsNullOrEmpty(TypeCaption))
                {
                    var typeCaptionColumn = remindingSchemaColumns.GetByName("TypeCaption");
                    if (typeCaptionColumn != null)
                    {
                        requiredReminding.SetColumnValue(typeCaptionColumn.ColumnValueName, TypeCaption);
                    }
                }
                if ((Guid)Source != Guid.Empty)
                {
                    requiredReminding.SetColumnValue(
                        remindingSchemaColumns.GetByName("Source").ColumnValueName,
                        (Guid)Source
                        );
                }
                requiredReminding.SetColumnValue(
                    remindingSchemaColumns.GetByName("RemindTime").ColumnValueName,
                    RemindTime
                    );
                if ((Guid)Author != Guid.Empty)
                {
                    requiredReminding.SetColumnValue(
                        remindingSchemaColumns.GetByName("Author").ColumnValueName,
                        (Guid)Author
                        );
                }
                requiredReminding.SetColumnValue(
                    remindingSchemaColumns.GetByName("Description").ColumnValueName,
                    Description
                    );
                if (SysEntitySchema != Guid.Empty)
                {
                    requiredReminding.SetColumnValue(
                        remindingSchemaColumns.GetByName("SysEntitySchema").ColumnValueName,
                        SysEntitySchema
                        );
                }
                if (PopupTitle.IsNotNullOrWhiteSpace())
                {
                    requiredReminding.SetColumnValue("PopupTitle", PopupTitle);
                }
                if (UserConnection.GetIsFeatureEnabled("NotificationV2"))
                {
                    requiredReminding.SetColumnValue("IsNeedToSend", true);
                }
                requiredReminding.SetColumnValue(
                    remindingSchemaColumns.GetByName("NotificationType").ColumnValueName,
                    NotificationType
                    );
                requiredReminding.Save();
            }
            else
            {
                if (!IsListSubjectReminds && !IsSubjectDelete)
                {
                    requiredReminding.Delete();
                }
                else
                {
                    DeleteRemindingList(entities);
                }
            }
            return(true);
        }
Example #4
0
 public bool CanPopup()
 {
     return((PopupTitle != null && PopupTitle.Any()) || (PopupText != null && PopupText.Any()));
 }