I need help regarding my project:
I am trying to make a Billing system like this
https://www.youtube.com/watch?v=cKDvSnL1nFE
but a windows desktop application.
the idea is: when the user enters product code/Id it it retrieves the products and associated information (i.e product name and price) from the database and adds in the list.
I have no idea which control to use for the list, List View or Grid View or something else.
I recommend use GridView because you have more control of your data,
then you will assign a event to cells for refresh all product information;
the event to use will be CellValueChanged.
Related
How should I filter a list view of a custom object, if I want a certain user to see the list of records on top of the list view depending on the status of the picklist field for ex. the status is Ready then it will be on the top of the list if the user is for ex. Sales Executive. any ideas on how to do this? can I use apex to filter a listview?
You can use the List View filters for status and Sharing Setting Feature provided in the standard listview, and choose the option Share list view with groups of users where you can have the option to choose multiple
Public groups or
Roles or
Roles and Subordinates
You can use any of them or all of them.
But if the constraint of your problem is not applicable to the standard way then I suggest you can create a custom list view with help of Apex and Aura Component List view or Lightning Web Component List view.
Let me know if it helps you out or not.
Thanks.
I'd try to do it without any code. Make a formula field (type = number, name = Sort Order?) and do whatever you need in that field. You can reference other fields on the record but also things like $Profile.Name. It'd still be user's job to sort by this field but you know... you can lead the horse to water but you can't make it drink ;)
Another way would be some Einstein scoring stuff, like all the demos where they're rating hot leads, opportunities most likely to close?
Have you considered making a report + dashboard? They'd see nice chart of top 10 records and they could drill down to a report where you control the sorting.
If you really feel need to code something... Yes, Apex would be able to pull up to 10K records from a listview, you need to read up about StandardSetController and setFilterId. But it'll really be limited to first 10K and then you apply your sorting/filtering on top of that. If there's important record after this 10K you might miss it.
i have a db which contains 2 tables, one of them descibes credit cards and holds their number, owner and an id; the other one describes the monthly charges of the card, holding their amount dates and the id of the card(wich is the foreign key to the first table).
in my program i am creating a main menu which will allow the user to chose the card, and than it will open a new window that will show the card's charges. in the main menu i would like to create a button for every credit card, and design it as a cover flow.
i am using wpf, and i am new at this. the way i am creating it is through the code behind, i am querying the db for the card's numbers and foreach result i am creating a button.
i want to know if this is the right way to do it, or is there any other way to create the buttons through the xaml?
What you want is called Data Templates, you create a template that represents a single item, and then apply the template to the menu control and set it's ItemsSource property to the rows from your database.
Here's a quick post I found that might help: http://www.vbknowledgebase.com/?Id=133&Desc=WPF-Menu-Databinding
I'm sure you can find more with a quick web search.
I have a typical master-detail scenario. User can click "Add New" in the master view and enter the details in the detail view. So for example lets say I have list of ObservableCollection of Product. When the user clicks "Add New", I add a new Product record to the ObservableCollection and then open a detail view for adding the Product details. This works well if the user does save the product. However if the user decides to cancel the addition of new Product, how do I remove the same from the ObservableCollection of Product in the master view. Right now I could think of two ways, first to pass the reference of ObservableCollection to the Details view, and second, use events to notify master view about the new Product record deletion. What do you suggest ? Also, if there is better way to handle this in prism specifically, please let me know.
regards,
Nirvan.
Passing a reference to the ObservableCollection to the details view is a no-no - it should only know about the record it is bound to.
You have not specified the UI you have in place for this, there can be a couple of ways to do this that may be better suited for your design. However one reasonably agnostic way to do it is to use the EventAggregator to publish the event which the master view can subscribe to. It is up to the master view how to deal with that event, different views can respond in different ways. In this particular case the master view can check the currently selected item, and if it is new (i.e. hasn't been saved, doesn't have key pieces of info like an ID) then it can simply remove it from the collection and discard it.
I have search employee page and edit employee date. User can search data in employee search page and it will show first name and last name of employee, so I create SearchEmployeeEntity in my presentation model. When user click edit employee, I will get data from service, this time I get first name, last name, username, birthday and other informations, so I create another presentation model name EmployeeEntity.
I think about my design for a while, there are two way to doing this, one is as I just explain above, other is use only one presentation model (EmployeeEntity) in both service.
Anyway, if I use EmployeeEntry in all place (search page and edit page) it's quite hard to manage data since I use static DomainContext.
Please suggest me, which way is good to create presentation model in Silverlight Application?
P.S. I use MVVM at my client.
It's the same entity so you should only need one. What's different is the context in which it is used - either you're creating a new Employee, or editing an existing one.
Silverlight RIA Services will handle this for you as it knows how to perform change tracking.
So, when you are editing, you will do a lookup against your context and perform a LoadOperation, which will return the entity to you from the DB. Allow the user to edit fields of the Employee on the clients ide, and then perform a SubmitOperation to persist the changes to the DB.
For new Employees, you create a new EmployeeEntity in your ViewModel, and then add it to the Context's Employees collection. Like so:
EmployeeContext.Employees.Add(Employee);
When the fields are filled out correctly (and hopefully you're taking advantage of Silverlight's super-easy validation rules to ensure correct data) then you, again, perform a SubmitOperation to save the new entity to the DB.
I'm working on a line-of-business silverlight application and I need a piece of advice concerning managing RIA services context lifetime.
Application - afer a few simplifications - is build of one big tab control. At the beginning there are 2 tabs: customer list and invoice list. These are plain datagrids with filtering/sorting and that sort of stuff.
User can add/edit customer or invoice selecting a row and double-clicking. Then the new tab is created with details of customer or invoice. User can open many tabs with different customers/invoices. After editing, user can save and close tab or just abandon edit and close.
The question is how to deal with data contexts.
Should I create one for customerlist and one for invoicelist and when user opens a new tab, I simply bind customer/invoive dataobject to control? This has an advantage that I dont need to refresh grids after saving changes. EDIT: This has some drawbacks. User can refresh grid - and what will happen to open detail tabs? User can also filter grid so some records being edited can be removed from datactx?
The other way is to create datacontext per tabitem. This is more safe but I need to handle refreshing grid(s).
I have no idea which method is better or maybe there is another alternative?
Use one ObservableCollection list in each case and it will automatically update the datagrids when items are changed.