コード例 #1
0
        public static ActiveRecordBase GetEntityControlForm(Column column)
        {
            ActiveRecordBase entity = null;
            if (column == null)
                return null;

            Table selectedTable = column.Table;
            using (ISession session = ActiveRecordConfiguration.GetISession())
            {
                IQueryable<KPMappingEntity> queryable = session.Query<KPMappingEntity>()
                    .Where(x => x.OwnerSchema.Equals(selectedTable.OwnerSchema) &&
                                x.Database.Equals(selectedTable.DatabaseName) &&
                                x.Table.Equals(selectedTable.Name) &&
                                x.Column.Equals(column.Name));

                KPMappingEntity mapEntity = queryable.FirstOrDefault();
                if (mapEntity != null)
                {
                    switch (column.ColumnTypeForm)
                    {
                        case KPComponentsFormsEnum.KPFormItemButton:
                            entity = new KPFormItemButtonEntity().GetEntityByMapping(mapEntity, column);
                            break;
                        case KPComponentsFormsEnum.KPFormItemCheckBox:
                            entity = new KPFormItemCheckBoxEntity().GetEntityByMapping(mapEntity, column);
                            break;
                        case KPComponentsFormsEnum.KPFormItemCombo:
                            entity = new KPFormItemComboEntity().GetEntityByMapping(mapEntity, column);
                            break;
                        case KPComponentsFormsEnum.KPFormItemEntity:
                            entity = new KPFormItemEntityEntity().GetEntityByMapping(mapEntity, column);
                            break;
                        case KPComponentsFormsEnum.KPFormItemGrid:
                            entity = new KPFormItemGridEntity().GetEntityByMapping(mapEntity, column);
                            break;
                        case KPComponentsFormsEnum.KPFormItemPassword:
                            entity = new KPFormItemPasswordEntity().GetEntityByMapping(mapEntity, column);
                            break;
                        case KPComponentsFormsEnum.KPFormItemText:
                            entity = new KPFormItemTextEntity().GetEntityByMapping(mapEntity, column);
                            break;
                        case KPComponentsFormsEnum.KPFormItemDateTime:
                            entity = new KPFormItemDateTimeEntity().GetEntityByMapping(mapEntity, column);
                            break;
                        case KPComponentsFormsEnum.KPFormItemZoom:
                            entity = new KPFormItemZoomEntity().GetEntityByMapping(mapEntity, column);
                            break;
                    }
                }
            }

            return entity;
        }
コード例 #2
0
        private string GetControlKPFormItemButtonEntity(Column column)
        {
            string propertyConcat = String.Empty;
            KPFormItemButtonEntity entity = column.EntityComponentForm as KPFormItemButtonEntity;
            if (entity == null)
            {
                entity = new KPFormItemButtonEntity()
                {
                    Title = GlobalizationLanguage.GetString("KPEntity_Title")
                };
            }

            var title = entity.Title;
            var eventClick = entity.KPEventClick;

            if (!String.IsNullOrWhiteSpace(title))
                propertyConcat += String.Format(@" Title=""{0}""", title);
            if (eventClick)
                propertyConcat += String.Format(@" OnKPClick=""{0}_KPClick""", column.Name.GetFormattedText());

            return propertyConcat;
        }