serenity-is / serenity Goto Github PK
View Code? Open in Web Editor NEWBusiness Apps Made Simple with Asp.Net Core MVC / TypeScript
Home Page: https://serenity.is
License: MIT License
Business Apps Made Simple with Asp.Net Core MVC / TypeScript
Home Page: https://serenity.is
License: MIT License
I checked up on serenity code about logging functions. I guess serenity has matured Audit Log and Capture Log abilites. Is there any example about these?
Thank you
How to realize User personal page. Where he can change password, remind forgot password and ... ?
Recently, added ability to use declarative attributes on row code.
But code generator still produces code with old style.
Should update templates, and generation code.
Hi,
I have encountered 2 error message while trying to create Editor List similar to MovieCastEditor :
The error show up after creating the new editor type and rebuild solution, before proceeding to transform all t4 templates. I had saw the same error message when using V1.5+ and had caused some issues which makes me decided to work on the latest v1.6.3, but still same error message appear. The visual studio using now is 2015 community edition.
Thanks to advise for the error message!
How to pass parameter inside lookupscript?
For example:
I want to do filtering by product category. Want to pass categoryID over lookup and get back only products from this category
Is sessionState as "SQL server" supported?
I mean standard aspStateDB base in SQL server to store session between IIS instances in farm.
Now farm balance load between servers and Authorization lost very often
Hi,
I want to assign date value to a field when opening dialog. This my code:
public class SomeDialog : EntityDialog<SomeRow>
{
SomeForm form;
public SomeDialog()
{
form = new SomeForm(this.idPrefix);
}
protected override void LoadEntity(SomeRow entity)
{
base.LoadEntity(entity);
if (IsNew)
form.DateTimeTypeField.Value = JsDate.Today.ToDateString();// OR Datetime.Now.ToDateString() etc
}
}
When dialog opens DatetimeTypeField always shows 1.1.1970 value.
When custom field definitions change, we update rows in the web server.
But other servers are not aware of this change.
We should notify them by using TwoLevelCache generations etc.
When you generate a row type using code generator, and later generate it again, you lose user modified information like field captions.
We should reuse as much information in compiled code as possible.
Hi,
I deployed my project to public web server. I changed globalication configuration:
but always welcome message and some other texts stay original.
I realized that [Web project]Project.Texts strings always show original (english) format. How can i change to turkish language.
When this property is set on Row, and a field whose value is not assigned (when row is in tracking mode) read through Field.AsObject[row] etc, this method throws an InvalidOperationException, as field value is undefined.
Need a better name for it.
Also it is not cloned yet, on Row.Clone
Hi,
I would like to write a function on exporting form data (i.e. Orders) into a flat file or excel upon clicking the save button, where can I insert the export function coding at in order to detect and trigger when the form is successfully saved?
Thanks to advise!
hello, first of all congratulations for your work, is ti possibile retrieve the current user and roles int the project serene.script?
can you help me?
thank you
This property is not set automatically, so to find TextualField for an ID field, we do a linear search. It is not very effective and might give wrong results.
We should set it automatically on row code generation.
It should be able to handle cache validation for data that depends on more than one table
Even better, should work with something similar to CacheDependency.
Hello sir I have four table, course, class, subject and topic. Class has ref. of CourseId, Subject has ref. ClassId, Topic has ref. of SubjectId. I have generated all form and customize it work fine, but there is additional requirement in topic popup has facility to add course, class same as Nothwind=>Product=>Product Name click => Display Supplier and Category like functionality.
Class name filter on Course dropdown.
Plz help me.
Hi @volkanceylan ,
Here, manuel scripts,
public static IDynamicScript SchemaTable =
new DbLookupScript<SchemaTableItem>("Common.SchemaTable",
getItems: c =>
{
c.Open();
return SqlSchemaInfo.GetTableNames(c).Select(t => new SchemaTableItem { SchemaTable = ((t.Item1 != null) ? string.Format("{0}.{1}", t.Item1, t.Item2) : string.Format("{0}", t.Item2)) }).ToList();
})
{
IdField = "SchemaTable",
TextField = "SchemaTable",
Expiration = TimeSpan.FromHours(-1)
};
public static IDynamicScript SchemaTableField =
new DbLookupScript<SchemaTableFieldItem>("Common.SchemaTableField",
getItems: c =>
{
c.Open();
var r = new List<SchemaTableFieldItem>();
foreach (var t in SqlSchemaInfo.GetTableNames(c))
{
r.AddRange(SqlSchemaInfo.GetTableFieldNames(c, t.Item1, t.Item2, true)
.Select(x => new SchemaTableFieldItem { FieldName = string.Format("{0}", x), SchemaTable = ((t.Item1 != null) ? string.Format("{0}.{1}", t.Item1, t.Item2) : string.Format("{0}", t.Item2)) }));
}
return r;
})
{
IdField = "FieldName",
TextField = "FieldName",
Expiration = TimeSpan.FromHours(-1)
};
public class SchemaTableItem
{
public string SchemaTable { get; set; }
}
public class SchemaTableFieldItem
{
public string FieldName { get; set; }
public string SchemaTable { get; set; }
}
/// on Row
[DisplayName("Primary Table"), Size(30), NotNull, LookupEditor("Common.SchemaTable")]
public String PrimaryTable
{
get { return Fields.PrimaryTable[this]; }
set { Fields.PrimaryTable[this] = value; }
}
[DisplayName("Primary Field"), Size(30), NotNull, LookupEditor("Common.SchemaTableField", CascadeFrom = "PrimaryTable")]
public String PrimaryField
{
get { return Fields.PrimaryField[this]; }
set { Fields.PrimaryField[this] = value; }
}
its showing the table lookup , but itsnt showing tables columns, when table lookup editor value changed no error,,
same thing working working on row class lookup script.
also old manuel editor is working
public class TableFieldEditor : LookupEditorBase<SchemaTableFieldItem>
{
private readonly CascadedWidgetLink<LookupEditor> _schemaTableLink;
public TableFieldEditor(jQueryObject container)
: base(container)
{
_schemaTableLink = new CascadedWidgetLink<LookupEditor>(this, p => this.SchemaTable = p.Value);
}
protected override string GetLookupKey()
{
return SchemaTableFieldItem.LookupKey;
}
protected override IEnumerable<SchemaTableFieldItem> GetItems(Lookup<SchemaTableFieldItem> lookup)
{
return base.GetItems(lookup).Where(x => x.SchemaTable == SchemaTable);
}
[Option]
public string SchemaTableField
{
get { return _schemaTableLink.ParentID; }
set { _schemaTableLink.ParentID = value; }
}
private string schemaTable;
[Option]
public string SchemaTable
{
get
{
return schemaTable;
}
set
{
if (schemaTable != value)
{
schemaTable = value;
Value = null;
UpdateItems();
}
}
}
}
[Imported, Serializable, PreserveMemberCase]
public partial class SchemaTableFieldItem
{
[InlineConstant]
public const string IdProperty = "FieldName";
[InlineConstant]
public const string NameProperty = "FieldName";
[InlineConstant]
public const string LocalTextPrefix = "Common.SchemaTableField";
[InlineConstant]
public const string LookupKey = "Common.SchemaTableField";
public static Lookup<SchemaTableFieldItem> Lookup { [InlineCode("Q.getLookup('Common.SchemaTableField')")] get { return null; } }
public String FieldName { get; set; }
public String SchemaTable { get; set; }
[Imported, PreserveMemberCase]
public static class Fields
{
[InlineConstant]
public const string FieldName = "FieldName";
[InlineConstant]
public const string SchemaTable = "SchemaTable";
}
}
}
Hi, I will like to remove the "New Record" button in one of the pages, did read up the guide but was unable find clues regarding it (or probably missed it), thanks to advise!
Hello sir,
Please give me step by step process of edit role permission functionality in Administration section and how to disable edit permission button by specific role. Where to set button text? I've tried to set button text in site.texts.tr.json file but it can't works and in this file contain other language text set so i can't understand how to translate this text to source language(means set language).
Please help me step by step guide.
Hi JaiQ
I'm trying to add a Subject form by sergen.exe code auto generated but i can't work properly. The browser console show that 'Uncaught TypeError: IntraMVC.CourseDB.SubjectGrid is not a function. after that i delete Subject folder in CourseDB from IntaMVC.Script and IntraMVC.Web and agian run sergen.exe and code generated. This procedure try 3 to 4 times after it work fine.
Please tell me the exact problem how misbehave it. How can i fix this?
I'm using VS2015, I installed the template and hit F5. It appears that the script project is not built when launching the web project. Under solution configuration if you make the script project a dependency of the web project it should alleviate this.
Currently, GetNativeSort uses INameRow to determine native sort order for a entity. It should make use of NaturalOrder information of fields, or we should remove this property completely.
When run from an application created with the Serene template, it should determine script and web project locations and the root namespace
Hi Volkan :)
I'm sorry but I'm not sure if an update broke things... I was developing on 1.6.4 on Friday and then updated this morning when VS said there were updates available.
Since then the Add New behaviour on tab pages seems to open a new master page instead of a new detail page?
For example in Customer --> Edit Customer(CustomerName) --> Orders Tab : when you click "New Order", the New Order dialog opens with OrderForm on a "Customer" tab and a blank "Orders" tab and the New Order Detail does the same thing.
Is this a bug or did I break it :)
Thanks s
Some of tasks in this list are planned, while others are just ideas on what can be done.
The way we implement master/detail is not so intuitive.
We should provide some kind of Mixin functionality. These mixins should intercept and take role in Save/List/Retrieve handlers at various phases.
There exists a similar functionality in SaveRequestBehaviourAttribute but this needs to be attached to a SaveRequestHandler, and can't be reused in a ListRequestHandler.
Ideally, Mixins should list what kind of attributes they are interested in (the ones that activates them). This way attributes that activates mixins shouldn't have any code in them, to avoid any extra dependencies to row classes they are used with.
public class MasterDetailRelationAttribute : Attribute
{
// zero code
}
public class OrderRow : Row
{
[MasterDetailRelation]
public List<OrderDetailRow> DetailList
{
}
}
[ActivateOn(typeof(MasterDetailRelationAttribute))]
public class DetailMixin : ISaveMixin, IListMixin, IFormMixin...
{
void ISaveMixin.AfterSave()
{
// ...
}
void IListMixin.OnReturn()
{
// ...
}
}
This way, DetailMixin doesn't have to be referenced from assembly where OrderRow resides, only MasterDetailRelationAttribute is enough.
Currently, custom fields can't be marked as required.
We should add this option, but better not apply it in SQL side, as it would be hard to change it later.
Better, check it in Create/Update handler.
Hi Volkan,
I have a problem with a tab page like the example in serenity template - Customers -> Customer Orders. I have referred back to the example and it has the same problem :)
When you add a new Customer the Orders tab page is enabled but the CustomerOrdersGrid shows everyones orders instead of no orders. I have tried overriding the OnSaveSuccess function and apply the response.EntityID to the CustomerFilter but it doesn't fix it.
Can you help please?
I want to use MultipleImageUploadEditor attribute but visual studio can not find related attribute file. There are ImageUploadEditor.cs and ImageUploadEditorAttrbute classes but there is only MultipleImageUploadEditor.cs. Is there anyway to use MultipleImageUploadEditor?
When you try to generate code second time, sergen tries to run KDIFF3 to merge changes. It should give a more descriptive message. Maybe also an option to skip merge operation altogether.
We show notification messages on active dialog. But if we close current dialog, just after showing a notification, notification will be lost (as its parent is the dialog).
It could be better to position the notification on dialog, instead of putting it inside the dialog.
Another way would be to move the notification to next dialog or document body, when top level one is closed.
Hi, back again with an issue.
I have two tables one references from the other, how can I make the sergen to generate dropdown or list in a place of foreign key id. Is this possible or you have some classes by yourself?
Example like the region selection drop down in the sample project.
Cannot implicitly convert type 'Serenity.Data.StringField' to 'Serenity.Data.IIdField'.
An explicit conversion exists (are you missing a cast?)
It seems that the only table(s) that are causing issues are those with key fields that are strings/varchars. Its possible that I may have configured something incorrectly. I used sergen to auto generate the code that has the issue. If I remove the table(s) that contain StringField keys then everything works.
We should find a way to use it in CreateRequestHandler and similar places
Also check Sql.Max, Sql.Avg etc for such overloads
Hello sir,
How to add custom code like send email or sms by click on button. Where to add some logic like test generation and calculation.
We should remove it from BasicEditorTypes or make it equal with ImageUploadEditor(AllowNonImage = true).
Also file-binary items needs an icon. It is shown as empty square in editor.
If a custom field is not marked as Insertable, and has a default value, it should be applied on server side in CreateRequestHandler.
Is there a way to represent relation data (ex: Orders & OrderItems)? If I want to adjust the view where can I do that?
I already write a simple pure javascript code for google maps page but i wonder is there any better solution.
I want to handle google maps canvas and and marker and others stuffs in cs file in the Script project. I don't know is TemplateDialog right class for base panel.
I put a simple class in Script project like that:
[Panel]
public class HaritaDialog : TemplatedDialog<object>
{
Widget<object> map;
public HelalMarketHaritaDialog()
{
map = ById("GridDiv");
}
protected override string GetTemplateName()
{
return "GridDialog";
}
}
I have create a Page and cshtml file in Web solution. In the cshtml
<div id="GridDiv"></div>
<script type="text/javascript">
jQuery(function () {
new Project.Module.HaritaDialog($('#GridDiv'), {}).init();
Q.initFullHeightGridPage($('#GridDiv'));
var myLatlng = new google.maps.LatLng(41.0191602,29.086761);
var mapOptions = {
center: myLatlng,
zoom: 16,
// disableDefaultUI: true // un-comment to remove default Maps UI
// map type options: HYBRID, ROADMAP, SATELLITE, TERRAIN
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("GridDiv"), mapOptions);
Q.serviceRequest('Module/SubModule/List', {}, function(result){
if(result!=null && result.Entities != null && result.Entities.length>0){
for(var i=0;i<result.Entities.length;i++){
if(result.Entities[i].Koordinat == undefined || result.Entities[i].Koordinat == null)
break;
var koordinat = result.Entities[i].Koordinat.split(',');
var myLangLat = {lat: parseFloat(koordinat[0]), lng: parseFloat(koordinat[1])};
var marker = new google.maps.Marker({
position: myLangLat,
map: map,
animation: google.maps.Animation.DROP,
title: result.Entities[i].Ad
});
}
}
}, null);
});
</script>
How to add filter like Country and City dropdown in Northwind => Customer form and bind cascading City dropdown and filter data on grid. Please guide me step by step procedure.
Recently, we added a ContainsField option to ListRequest, but we are not using it anywhere, except some handlers that overrides ApplyContainsText method.
ListRequestHandler should make use of this parameter, along with ContainsText, when field given is not marked as FieldFlags.NotFilterable
Thanks for this awesomeness and for adding the order/detail example. I have been working with Serenity for about a week and already amazed at what features are provided.
I have a question on clientside validation of the LookupEditor as used in your "New Order" form (*Customer). When a LookupEditor is a required field and not given a value before submission, clientside validation does not occur and instead server side validation throws an error in Turkish. Do you have any suggestions regarding where to best solve this issue? Thanks again sb
Hi,
I just discovered Lookupeditor attribute and love it. But I realized that a row can handle only one LookupEditor. When I used multiple Lookupeditor attribute on several field/property, t4 transforming gives an error:
Error 1 Running transformation: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Project.Entities.HedeRow' threw an exception. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: lookupType
at Serenity.ComponentModel.LookupEditorAttribute..ctor(Type lookupType) in c:\Sandbox\Serene\Serenity\Serenity.Core\ComponentModel\PropertyGrid\Editing\BasicEditorTypes.cs:line 217
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
at System.Reflection.RuntimePropertyInfo.GetCustomAttributes(Boolean inherit)
at Serenity.Data.RowFieldsBase.Initialize() in c:\Sandbox\Serene\Serenity\Serenity.Data.Entity\Row\RowFieldsBase.cs:line 368
at Serenity.Data.RowExtensions.Init[TRowFields](TRowFields rowFields) in c:\Sandbox\Serene\Serenity\Serenity.Data.Entity\Extensions\RowExtensions.cs:line 46
at Gimnet.Sertifika.Entities.FirmaRow..cctor() in c:\Users\ademca\Documents\Visual Studio 2012\Projects\Gimnet2\Gimnet\Gimnet.Web\Modules\Sertifika\Firma\FirmaRow.cs:line 249
--- End of inner exception stack trace ---
at Gimnet.Sertifika.Entities.FirmaRow..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Serenity.PropertyGrid.PropertyItemHelper.GetBasedOnRow(Type type) in c:\Sandbox\Serene\Serenity\Serenity.Data.Entity\PropertyGrid\PropertyItemHelper.cs:line 63
at Serenity.PropertyGrid.PropertyItemHelper.GetPropertyItemsFor(Type type) in c:\Sandbox\Serene\Serenity\Serenity.Data.Entity\PropertyGrid\PropertyItemHelper.cs:line 18
at Serenity.CodeGeneration.ScriptFormGenerator.<>c__DisplayClass27_1.<GenerateCode>b__0() in c:\Sandbox\Serene\Serenity\Serenity.Web\CodeGeneration\ScriptFormGenerator.cs:line 93
at Serenity.Reflection.CodeWriter.InBrace(Action insideBlock) in c:\Sandbox\Serene\Serenity\Serenity.Core\Reflection\CodeWriter.cs:line 47
at Serenity.CodeGeneration.ScriptFormGenerator.GenerateCode() in c:\Sandbox\Serene\Serenity\Serenity.Web\CodeGeneration\ScriptFormGenerator.cs:line 81
at Microsoft.VisualStudio.TextTemplatingBCDB993AC8CB286F8D6846AB78AD85B7D7613156BF763564781FB67DB2B60DA6195498D7C665D76ACF8E2657D90FF438276B8ADD17DE83AD5A98EDB2339328C3.GeneratedTextTransformation.TransformText() C:\Users\xxx\Documents\Visual Studio 2012\Projects\xxx\xxx\xxx.Script\Imports\FormContexts\FormContexts.tt 1 1 xxx.Script
Hi,
I can add filter editor into toolbar for any field in Grid screen.
protected override void CreateToolbarExtensions()
{
AddEqualityFilter<LookupEditor>(SomeRow.Fields.FirmaId,
options: new LookupEditorOptions { LookupKey = "LookupKey" });
}
But if i add enum type field i do not know what is lookup key for an enum.
I found a key in Project.Sciprt.js file, like this:
Project.Module.....SomeEnumTypeId
if i use this gives error "there is no lookup in registered list bla bla bla"
I means _enum type field_
public class XXXRow:...
{
...
public SomeEnumTypeId Field1{
get{....}
set{...}
...
}
How to add third party control like tinymce editor in place of TextAreaEditor, Treeview control, radio button list, checkboxlist and many more...
How to bind default values to dropdown list. In Serenity guide show example of Adding a Movie Kind Field doesn't work. I work on Class Year drop down has some default values like
[EnumKey("CourseDB.ClassYearKind")]
public enum ClassYearKind
{
[Description("First")]
First = 1,
[Description("Second")]
Second = 2,
[Description("Third")]
Third = 3,
[Description("Fourth")]
Four = 4,
[Description("Fourth")]
Five = 5,
[Description("Sixth")]
Six = 6
}
but it didn't work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.