Winforms CRUD App with EF and c1DataSource

Posted by: sarosh.wadia on 19 January 2018, 10:09 am EST

    • Post Options:
    • Link

    Posted 19 January 2018, 10:09 am EST

    Hi!

    Is there any sample Winforms App or Form which has CRUD/Sort/Filter functionality using EF and c1DataSource and c1TrueDBGrid or Best Practices for using all the above together?

    Thanks

  • Posted 22 January 2018, 3:25 am EST

    Hello,

    Please take a look at the the TransactionsWinForms sample which comes along with the product installation at the following location: C:\Users\UserName\Documents\ComponentOne Samples\WinForms\C1DataSource\CS\TransactionsWinForms

    This demo sample explains how can one perform Add/Edit/Delete using C1DataSource with MS DataGridView, which can be replaced with C1TrueDBgrid.

    Also, there are various other product samples at the same location, we suggest you to go through them too for a better understanding of C1DataSource.

    Let me know, if you still face any troubles.

    Thanks,

    Ruchir Agarwal

  • Posted 22 January 2018, 1:41 pm EST

    Hi!

    I will take a look!

    One more question:

    I need to add a complex filter condition in the c1DataSource within brackets, how can I do that?

    e.g. Filter: ((User.Type = “Supervisor” or User.Type = “Manager”) AND (User.Salary > 100000)) OR (User.Admin) Note: The double brackets in the first part of the filter!

    In the enum I only see c1.Data.DataSource.FilterDescriptorLogicalOperator.And and c1.Data.DataSource.FilterDescriptorLogicalOperator.Or but no Brackets so how can I group my AND’s and OR’s?

    Thanks

  • Posted 23 January 2018, 10:39 am EST

    Hi,

    For having complex filter condition in C1DataSource, you can add a FilterDescriptor in ViewSource, as follows:

    C1.Data.DataSource.FilterDescriptor fd = new C1.Data.DataSource.FilterDescriptor();
    fd.Operator = C1.Data.DataSource.FilterOperator.IsGreaterThan;
    fd.PropertyPath = "UnitsInStock";
    fd.Value = 100;
    c1DataSource1.ViewSources["Products"].FilterDescriptors.Add(fd);  
    

    This should help you meet the complex filtering requirements.

    Thanks,

    Ruchir Agarwal

  • Posted 24 January 2018, 4:24 pm EST

    Hi!

    I am already doing that but what I cannot figure out is how do I group my AND and OR Expressions in brackets.

    How would you do the following filter into FilterDescriptors and add it to the ViewSource?

    Filter: ((User.Type = “Supervisor” or User.Type = “Manager”) AND (User.Salary > 100000)) OR (User.Admin) Note: The double brackets in the first part of the filter!

    Note: The important thing is grouping the expressions within single or multiple brackets.

  • Posted 29 January 2018, 12:42 am EST

    Hello,

    This is in discussion with the development team {Tracking ID: 306157}. I will update you with the information they share about it.

    Thanks,

    Ruchir Agarwal

  • Posted 29 January 2018, 11:45 am EST

    Hi!

    Ok, looking forward to hearing back from you!

    Thanks

  • Posted 10 February 2018, 3:27 am EST

    Hello,

    We are sorry to let you know that it’s limitation of C1DataSource.

    As a workaround, you are suggested to use linq query or you may even use the management tools of database server to create the view with filters.

    We regret the inconvenience caused to you due to this.

    ~Ruchir Agarwal

  • Posted 12 February 2018, 10:00 am EST

    Hi!

    Ok!

    Thanks for the update.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels