I’m in the middle of writing a blog site in asp.net (VB) and am trying to add thumbs up / down voting buttons to each article in an asp.net repeater control. The site is driven from an SQL database and im looking for the best way to achieve this? Im hoping to end result will have a similar look and feel to reddit, stackoverflow & youtube voting.
I’m using SQL membership for security and will request that the user logs in before they can vote. I know I will need to store the following values (article ID, user id, vote value) so the total can be updated and stop any duplicate voting.
I’ve created 3 tables (Articles, Votes, Users). The votes table will record each vote storing the (article id, userid, vote value). I have also added a ‘vote total’ field to the articles table which will be updated via a stored procedure each time a vote is made. This should help performance when showing the articles.
What I cant work out is the best way to implement the buttons against each article?
I would be extremely grateful for any advise, Thanks
The voting control is within the repeater, and the repeater can store a unique ID to the article in each row, by using the DataKeys collection. If everything is being done server-side, you could retrieve the ID of the row using this data keys collection, and pass that along with the request to do the vote.
If you are talking client-side, then you'd have to store the article ID on the client somewhere (hidden field or other), and then extract it from the hidden when you go to push the request to the server.
Related
I have deleted one of my content from my Drupal site of WEB form content type.
Now I need to retrieve its report.
Please guide me on how to retrieve the report or database of a deleted web form.
Thanks in advance,
Anamika.
EDIT: Assumption that this is about Drupal 8 since this is not mentioned in the OP's question.
I am afraid you can't retrieve data from your webform once it's deleted. When you deleted the webform you expliytidly confirmed that you're okay with the deletion and all its related data.
If you happen to have a database backup, there is some hope to retrieve the data. Webform data is spread over multiple tables, here are the most important ones:
webform: List of all your webforms and their ID
webform_submission: List of all submissions (1 line per submission)
webform_submission_data: List of all your fields & values for a submission
So if you have a database backup, you can probably retrieve all the sid (submission id's) from webform_submission for the deleted webform and then retrieve all the data then in the webform_submission_data table.
If you don't have any kind of database back-up, I am afraid your data is lost forever.
I'm building a website that will be used by employees to log work that they've completed. The site contains a page to submit the information, a page to view the information and a page with the employees personal info like name, email, phone, etc. I'm using ASP.NET Membership for authentication. All code will be VB. My questions:
1) ASP.NET Membership only stores the username and email of members. I want to store additional information like first and last name, phone number, etc. Can I just update the tables in the membership database to include this information? Or should I store this information in a separate database? My goal is to populate text boxes on one of the pages with data specific to the user that is currently logged in.
2) The work completed will be stored in another database since it seems logical to keep it separate from membership data. What is the most efficient way to pull and display records from this separate "work" database that are specific to the user who has logged in and been authenticated against the member database?
3) I'm having trouble with the design of tables for the "work" database. Each record stored in the database will represent a days worth of work. However, a number of activities will occur during that day. Each activity will have a type of activity, location and amount of time worked. An employee can complete 1 activity or 100 activities. I assume I'm going to need a table just for the activities and then relate it to the work table. Does this sound correct?
For your first Point i will suggest you to create your own table of User and relate this table with membership user table with guid viz. keep on userid file in your table and relate it with membership table.
Second point will automatically get solved once you will create your own user table, all you need is to relate work and user table(created by you) to fetch the records from work
And at last if you are creating new table for activities how come you will relate it to your work table, again you will have multiple occurrence for record, instead i would suggest do not create another table for activities keep it in work table itself as if you are creating a new table, you will have to provide relationship with work which will result in redundancy.
Hope this helps.
I'm not sure why this is happening, but the last activity date for all my users is showing the same. I thought it was the way I was pulling the data from the database, but I checked my data, and it shows the same for all users.
Is there something I need to be doing to get this field updated? I'm not doing anything special with this field other than reporting it.
I found the answer here in this article. Apparently, when I pull up the list of users and I pull the profile for each, it calls a stored procedure that in turn, updates the LastActivityDate of each user to the current date and time.
HI guys
i built a web based task manager / scheduler using vb.net
i need to add a small communication part to it to allow users to send messages to each other.
below is my concept design. the question is: is this the correct way of building a simple communicator or do you have better ideas?
Yes, I think your basic design is reasonable. The UI is logical, and what you've described of the architecture sounds reasonable.
If you're looking to send e-mail to users 'off-site' check out this blog entry.
So mokokamello
i agree with Cpfohl
you already answered your question
i created a table for users, table for messages that contains from and to fields. a query (getting messages for the logged in user and marked "unread") will run at the pageload and bind to gridview. pressing the button "send" will insert data into messages table in the database and clear current text. you think this is OK – mokokamello 1 min ago edit i created a table for users, table for messages that contains from and to fields. a query (getting messages for the logged in user and marked "unread") will run at the pageload and bind to gridview. pressing the button "send" will insert data into messages table in the database and clear current text.
just work on the design to make it more palatable
good luck
I just set up user profiles using asp.net 3.5 using wvd.
For each user I would like to store data that they will be updating every day.
For example, every time they go for a run they will update time and distance. I intend to allow them to also look up their history of distance and time from any past date.
My question is, what does the database schema usually look like for such a set up? Currently asp.net set up a db for me when I made user profiles. Do I just add an extra table for every user? Should there be one big table with all users data? How do I relate a user I'd to their specific data? Etc....
I have never done this before so any ideas on how this is usually done would be very helpful. Thank you.
One easy way is to just add a (one) table to aspnetdb database, this table will be used to track your running session data for all the user profiles. Name it RunnerSessions or something similar, add the following columns to the table:
UserID (use this field to store the profile id from ASP.NET)
SessionDate (use this field to store the run session date)
SessionDistance (use this field to record the distance from that particular run session)
It is a good idea to make UserID + SessionDate fields as your primary key for the RunnerSessions table or create another field called SessionID and set it as autonumber.
To relate each profile to a particular record in the RunnerSessions table, you can store the HttpContext.Current.User.Identity.Name in the UserID field mentioned above.
You are asking for a relational database design. As relational database design is an art in itself and heavily depends on a lot of case specific conditions I will not be able to provide you with a ready-to-go schema.
As I never read any online tutorial about this I will also not post a link here. But you should be able to get started by searching for a relational database design (tutorial) in your favourite search engine.
Maybe someone knows about a good tutorial and can post a link?