Structure for shop (e-commerce) database [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I write my project and I will give to user to add his store to my system and then user will can to add shopItem to his store.
My question is:
Maybe already exist shop database for Category-Subcategory.
I mean - When user will add for example boots - he need choose
Category Clothes -> then choose Subcategory Shoes.
So i need database with all category-subcategory for MS SQL - or other database (maximum I will write script for transfer data to MS SQL)
Thank you.
Regards,
David.

You are talking about a hierarchical relationship. Typically you would have a Category database which has a primary key (say, CategoryID). If a subcategory can only belong to single category, then you would have another field in your Category table (maybe called ParentCategoryID). For root-level categories, this field would be NULL. For a subcategory, ParentCategoryID would contain the CategoryID of whatever category is the parent (pretty logical).
If a subcategory can exist under multiple categories, then you need a mapping table that contains the CategoryID and ParentCategory ID.
If you need a subcategory also to be allowed to be a root category, then your mapping table has to take this into account (maybe by allowing NULLs in the ParentCategoryID table)
MSDN has a tutorial on hierarchical data structures here: https://msdn.microsoft.com/en-us/library/bb677213.aspx

Related

Issue regarding fetching data from DB using LINQ and .NET [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Actually I don't have the idea that whether I should use some technique in storing data so that I can fetch according to my requirement or just need to search a query returning data according to my requirement. I want to store some data that is linked with eachother some rough data is given below
Name Reference City
Mian Null GUj
Hamza Mian Khi
Adam Mian Lhr
Jamil Adam Lhr
Musa Jamil Khi
Subhan Musa ISL
I want the solution that when I enter some name its fetches data of that person and its all childs and sub childs.
Ex:
If I enter Adam acoording to above table info it should return Adam, Jamil, Musa, Subhan.
Well you must have a foreign key for the parent.
Here is an example
select * from person parent
left join person child on child.Parent_ID = parent.ID
where parent.Name like 'Adam'
I think this should work for you, you could also left join the sub children of the sub children.
Or you can write query that search recursive.
Please see this article for more info
recursive-select

Virto Commerce Parent Customer Relationship Needed [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm looking to create a parent customer that has child customers underneath it. So for example Home Depot as the parent and store #300 as the child.
Yes it is possible. You need to however identify what is different between the stores and what information you'd like to have available for each store.
1st thing you can do is to create a master catalog which will be managed by parent and then create a virtual catalog for a child. Then create two stores, one for parent and one for child (assigning appropriate catalogs for each). This will allow you to control which products are available in which store and also control taxonomy (categorization) for each store.
You can also control security for each store using organizational structure. For instance if it is a B2B solution, you can create organizational structure where parent organization is Home Depot while child organization is your store. Now all employees from child org will belong to that child org and can have limited set of permissions.
Another possibility is if you want to manage inventory differently for each store. In that case you will need to create fulfillment centers and assign them to a specific store. That way product can be made available in one store and not in the other.

how to store entire grid view into one single row of table in a database asp.net [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i have a grid view shopping cart in my application. the datasource of gridview is session as datatable.. i have no problem in shopping cart. my cart is perfectly the way i want it.. now my problem is that on PLACEORDER button click i want to export this gridview details into database like
-----------------------------------------------------------------------
Orderid | Orderdate | products | amount | username
-----------------------------------------------------------------------
xxx | datetime.now |all products in cart | total amount| currentuser
-----------------------------------------------------------------------
single row in the order table should contain all the details about the order that a user places
Now my question is it possible to do it ? if yes how ? please explain. i m short of time .. thanks in advance
You need a second table, that would have 3 columns:
1. Your primary key for the table
2. OrderId (a foreign key to your order table)
3. The product or the productId.
Then you can select all the products with a given OrderId to see what was ordered on that order. This also allows you to count products sold and a bunch of other reporting if needed.
The wrong way to do it would be to store it in the same table as a long string. This allows no reporting, forces you to parse it in your code, ruins all scalability... It is a bad solution don't do it.

How do I create a good database with SQL Server for a form? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to develop a form with asp.net Webform and would like to display in a ListBox or checkbox data from SQL Server. So I can call the elements of the table, there is no problem. But the worry is that I'd like to stored information that the user has selected / chosen the form in a different table because in the future I would like someone developer can not change the elements of the form without touching the code but just touch Sql server management Studio.
I hope you understand my problem ... Do you have a solution?
Thank you for your help :)
You can create a master table where all your master data resides. Ex. list of languages to be shown in Checkbox or Listbox.
And there will be another table which holds the user inputs usually referencing the Ids of master data along with other user inputs.
Ex.
Languages -> master table
-----------------------------
LanguageID
Name
UserDetails -> detail or actual table where you can store your user's inputs as well as the LanguageId from language table
-----------------------------
UserId
Name
City
LanguageID -> foreign key which reference of Language table
Hope this will help you.
I believe I understand what you're after.
Typically the way to do this is to have two tables in your database.
Options
- OptionID
- OptionName
// maybe an isactive flag?
Responses
- ResponseID
- OptionID
// maybe a username?
Your form then shows all the active options on the page. When a user comes along you create a response row where the OptionID is set to the ID of the option the user chose (with an appropriate foreign key).
Your developer can then add and deactivate options without removing users' responses.

How can I make many to one relations in SQL [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm writing an exam project. A summary of events is as follows; manager opens an exam and schools for the exam consists of a chairman and two members will establish a commission. Committee members will be selected from the staff table.
In relational database design, you need to use primary keys and foreign keys to relate tables to each other. A primary key is a unique identifier for a table and foreign keys are references to primary keys in other tables. Then you perform joins on your tables to get back the related data you want.
For your case, you need some sort of relation between the two tables that you listed and then you can create a many to one relationship. A many to one relationship consists of many records in one table relating to one record in another table.
For example:
tblCommittee
CommitteeId
Name
DateCreated
Person1Id
Person2Id
tblPerson
PersonId
Name
Sample data:
Person
PersonId Name
1 Billy
2 Joe
3 Bob
4 Jeff
Committee
CommitteeId Name DateCreated Person1Id Person2Id
1 Committee one 1/7/2014 1 2
2 Committee two 12/3/2013 4 3

Categories