private void SetCurrentUser()
        {
            var modifiedBy = _entitySchemaColumns.FindByName("ModifiedBy");

            if (modifiedBy != null)
            {
                _entity.SetColumnValue("ModifiedById", _userConnection.CurrentUser.ContactId);
            }
        }
        private Select WrapSelect(Select sourceSelect)
        {
            EntitySchemaColumnCollection visaColumns = _baseVisaSchema.Columns;
            string alias  = "InternalSelect";
            Select select =
                new Select(_userConnection)
                .Column(alias, "Id")
                .Column(alias, "CreatedOn")
                .Column(alias, "CreatedById")
                .Column(alias, "ModifiedOn")
                .Column(alias, "ModifiedById")
                .Column(alias, "ProcessListeners")
                .Column(alias, "Objective")
                .Column(alias, "VisaOwnerId")
                .Column(alias, "IsAllowedToDelegate")
                .Column(alias, "DelegatedFromId")
                .Column(alias, "StatusId")
                .Column(alias, "SetById")
                .Column(alias, "SetDate")
                .Column(alias, "IsCanceled")
                .Column(alias, "Comment")
                .Column(alias, "VisaSchemaName")
                .Column(alias, "Title")
                .Column(alias, "VisaObjectId")
                .Column(alias, "VisaSchemaTypeId")
                .Column(alias, "VisaTypeName")
                .Column(alias, "VisaSchemaCaption")
                .Column(alias, "SchemaName")
                .Column(alias, "SourceSchemaName")
                .Column("CreatedBy", "Name").As(visaColumns.FindByName("CreatedBy").DisplayColumnValueName)
                .Column("VisaStatus", "Name").As(visaColumns.FindByName("Status").DisplayColumnValueName)
                .From(sourceSelect).As(alias)
                .LeftOuterJoin("Contact").As("CreatedBy").On("CreatedBy", "Id").IsEqual(alias, "CreatedById")
                .LeftOuterJoin("VisaStatus").On("VisaStatus", "Id").IsEqual(alias, "StatusId")
                .OrderBy(OrderDirectionStrict.Descending, alias, "ModifiedOn") as Select;

            return(select);
        }
Exemple #3
0
        /// <summary>
        /// Fills column value of the entity.
        /// </summary>
        /// <param name="entity">Entity.</param>
        /// <param name="columnName">Column name.</param>
        /// <param name="value">Column value.</param>
        public static void SpecifyActivityLookupColumnValue(Entity entity, string columnName, Guid value)
        {
            if (value.IsEmpty())
            {
                return;
            }
            EntitySchema activitySchema                     = entity.Schema;
            EntitySchemaColumnCollection columns            = activitySchema.Columns;
            EntitySchemaColumn           entitySchemaColumn = columns.FindByName(columnName);

            if (entitySchemaColumn != null)
            {
                entity.SetColumnValue(entitySchemaColumn, value);
            }
        }
        protected EntitySchemaColumn GetColumnByName(string columnName)
        {
            EntitySchemaColumnCollection columns = _rootSchema.Columns;

            return(columns.FindByName(columnName) ?? columns.FindByColumnValueName(columnName));
        }
Exemple #5
0
        private EntitySchemaColumn GetSchemaColumnByName(string columnName, EntitySchema schema)
        {
            EntitySchemaColumnCollection columns = schema.Columns;

            return(columns.FindByName(columnName) ?? columns.FindByColumnValueName(columnName));
        }