Complex Sorting of DataTable in c# - c#

I have a datatable, the first five columns of which contain static information, and the rest of which are dynamically built based on some user selections. The dynamic columns are actually groups of 3 columns - such as:
Shop Name (user will enter quantity in this column)
Shop Sale
Shop Stock
These would appear per row, of course, but each user might select a different set of 3 columns to display.
The above already works. The requirement I am trying to solve for now is to SORT the grid based on the Shop Sale column, keeping the sets of three intact. As an example, the shop with most sales will come left-most, and so on...

I resolved this issue, I sorted shops list at an earlier stage, using datatable.defaultview.sort method, issue resolved.

Related

Get dynamic input from user

I'm trying to create a simple project, an Inventory management system.
We have a set of items for sale in our inventory (defined in the database) and we dispatch items in the quantity that the customer order.
The issue I have is, a user may order just 1 item, or they may order a 100 items, in whatever quantities they prefer (assume the user of this system gets this info through an email).
So I have some trouble creating the "Sales Order" GUI.
I tried using a ListBox / ListView. There I can select all the items they want and generate a sales order, but I can't enter the corresponding quantity.
It is not practical to have like 20 text boxes in the form.
If I understand your question correctly, it seems as if a good approach would be to have a means of selecting the specific product you want to quantify first. Supermarket POS systems do this through PLU (Price Look Up) codes that identify the product name and price. You could alternately have a search box that combs through your database for product names matching the search query.
After that you can have one text box (I would recommend a number spinner) to select the quantity.
Finally have a button that submits that order of that specific product and move on to the next. You could wait to submit all the quantities needed until the order is completed to signify that it is one unique order if that information is important to you.

How to display different data in Datagrid based on some criteria? C#

I am currently breaking my head over a school project where i have to simulate a smart-shopping bag (datagridview) where customers log in and put various products in it (fruit,chocolates, etc...) and buy them.
They cam insert product into the bag, change it or remove it.
The problem is that i am simulating it with DatagridView, where users see the products that other users selected to buy, since DataGrid only shows the table in the database as a whole. Is there any way to display the products that the specific UserID have put into the datagridview?

How to add unique information to a row in a gridview using winforms?

I am working on designing a small POS system using C# and Winforms. I am using grid view to add scanned item to a transaction (items being sold.) I am looking to collect some tracking information for some items depending of item type.
For example, if a customer is buying a speaker, head phone and a new cell phone. I would need to obtain additional tracking information for the cell phone. I need to know
If the phone was sold as "New Activation" or "Phone Upgrade"
Phone number for that phone
A serial number
The new phone carrier
The carrier's Plan that was selected.
Each item in the database have a type. I could display another form when item if a certain type is added to the transaction (just before it is added.) and then the user will be promoted to fill before the item is actually added to the transaction.
I am struggling with how to add the additional information to the transaction. I could add hidden column with that additional information to the gridview (one column for, phone number, carrier, plan, serial. But there could be so many different hidden column, and I am not sure if the is my only option?
For the back-end, there are three approaches (possibly more) that could be used.
The first approach is to have your database table have 20 additional columns, e.g. CustomName1, CustomValue1, CustomName2, CustomValue2, etc. I've seen this approach used in a couple systems, personally I don't like it because it's limited in the number of fields and it's hard to query.
The second approach is to generalize the first approach into a separate table. E.g. The columns will be POSID, FieldName, FieldValue.
The third approach is to have predefined tables for each particular type of sold product.
The UI design is a separate issue. A simple approach is to provide a "More..." button that is only enabled when a single item in the DGV is selected. When clicked, it will open a form that contains additional input fields.
Another approach is that when the type of product is selected, the additional columns are added to the DGV.

Paged HTML table to select Multiple rows

For one of my projects I need to allow the user to select some products out of a table.
This table will be paged (+2k records in DB).
So the user needs to be able to select items on different pages without losing them.
I was thinking about using 2 tables. One table to select items from and another table(also with paging) where the selected items will be displayed.
But I have no idea how to persist the selected items without using Sessions...
If anybody has a better idea please share it.
Edit:
It is possible(won't happen that much) to select all products (+2k records).
I don't know how mvc will behave if you have 2k hidden fields.
Also lets say i use hidden fields and have the following in my viewmodel
public List<int> SelectedIds {get;set;}
I can then use hidden fields with "SelectedIds[i]" as name(replacing i by an integer).
But the user can also deselect the items again.
And I don't think the binding will work when you skip numbers.
ex: 2 hidden field with these names "SelectedIds[0]" && "SelectedIds[2]"
This is something I'll have to test when i am home...

Insert number of textboxes relating to number of rows in a database table

I am creating a staff rota system in visual studio and would like to populate some textboxes with the staff names from a database to ensure the user does not miss any staff for the rota. Obviously staff will come and go therefore the number of textboxes may need to change.
For instance one week there may be 5 staff members to enter into the rota, but if a staff member leaves the company then the number of textboxes will have to automatically change and be populated with the names from the table after the staff member is deleted from the database.
For the end result I plan on having a list of textboxes populated with the names of existing staff members from the table. This will then allow the user to select their shift times and lunch hours etc.
Any advice or recommendations would be greatly appreciated.
Instead of textboxes...
Use Radio buttons if ONLY one can be selected from the list
Use Checkboxes if MORE than one can be selected from the list
Only use a textbox if you wish to EDIT the names (data)
#Thousand Thanks for the suggestion of using asp.net repeater control.
I did not wish to edit the information I was extracting so I have created a template which extracts the data into labels. Thank you and apologies as this question is in the negative.

Categories

Resources