コード例 #1
0
        public CustomField ToCustomField(DbFieldDescription dbFieldDescription,
                                         DbFieldValue dbFieldValue = null)
        {
            var customField = _mapper.Map <CustomField>(dbFieldDescription);

            if (customField != null && dbFieldValue != null)
            {
                customField.Value    = dbFieldValue.Value;
                customField.EntityID = dbFieldValue.EntityId;
            }

            return(customField);
        }
コード例 #2
0
        private void SetFieldValueInDb(EntityType entityType, int entityID, int fieldID, string fieldValue)
        {
            if (!_supportedEntityType.Contains(entityType))
            {
                throw new ArgumentException();
            }

            fieldValue = fieldValue.Trim();

            var dbEntity = Query(CrmDbContext.FieldValue)
                           .FirstOrDefault(x => x.EntityId == entityID &&
                                           x.EntityType == entityType &&
                                           x.FieldId == fieldID);

            if (string.IsNullOrEmpty(fieldValue) && dbEntity != null)
            {
                _factoryIndexer.Delete(dbEntity);

                CrmDbContext.Remove(dbEntity);
            }
            else
            {
                if (dbEntity == null)
                {
                    dbEntity = new DbFieldValue
                    {
                        EntityId   = entityID,
                        FieldId    = fieldID,
                        EntityType = entityType,
                        TenantId   = TenantID
                    };

                    CrmDbContext.Add(dbEntity);
                }


                dbEntity.Value         = fieldValue;
                dbEntity.LastModifedOn = _tenantUtil.DateTimeToUtc(_tenantUtil.DateTimeNow());
                dbEntity.LastModifedBy = _securityContext.CurrentAccount.ID;

                CrmDbContext.SaveChanges();

                _factoryIndexer.Index(dbEntity);
            }
        }
コード例 #3
0
ファイル: DbColumn.cs プロジェクト: duffman/PutteMySQL
 public DbColumn(DbFieldType fieldType, DbFieldValue fieldValue)
 {
     this.FieldType  = fieldType;
     this.FieldValue = fieldValue;
 }