ASP.net Schedule Post like Facebook - c#

Im trying to do something similar to the Scheduling of posts for Facebook pages... on ASP.net/c#
So basically what i need is :
User fills a few text boxes
Selects a date...
The post gets posted on that date...
I am unable to really understand the logic as well as coding for this...
What i have thought so far is, once the user submits the post, store the details in a table in SQL like SheduledPosts, and when the CurrentDate(Server Date) matches the date....
Transfer the SQL entry from there to the actual PostTable.
Now the actual process needs to take place without any pages loading or any actions done by the user... So I also dont understand how to make it happen from the server side...
Please note that im not trying to post anything to facebook... rather, trying to do a schedule form submitting on my own asp.net website...
Any help regarding the logic, coding, scheduling will be greatly appriciated...
Thank You

I can think of a couple of different ways to accomplish this:
Implement a "pending posts" table and have a separate process running on the server to take care of transferring the post from the "pending posts" table to the "current posts" table at the appropriate time.
Add a "publish_on" datetime field to your current posts table, and when selecting items to be displayed in the page output, add a "WHERE publish_on IS NULL OR publish_on > GETDATE()" clause to your query. You fill this in for posts you don't want going live until a particular time.
Personally, I would go with the second approach, since I think it's a more elegant solution.

You can do this with one table. Just have a 'Submitted' date field (for your records), a 'Publish' date field and a Boolean 'Published' field. Create a Windows Service to run every 5 minutes or so and let the service perform the date check; when it finds one that satisfies the date criteria, it just toggles the Boolean field to 'true' and your page logic can then display the post.
Here is a walk-through on creating a simple Windows Service:
https://msdn.microsoft.com/en-us/library/zt39148a%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

Related

Is a Database Needed Behind My ASP Site

I am building a website Asp.Net/C# and one component has a schedule with the AJAX Calendar Extender that puts the selected date in a text box, of course. I also have an AJAX Time Picker pick a time in another box.
However, I'm feeling a little ambitious; I want it where if someone selects say... July 25th, 2014, at like 1:30 PM, I want it to throw back a message on selection that the block of time is already selected. The time intervals run every 15 mins apart (i.e., 1:00, 1:15, 1:30, and 1:45).
I'm thinking I need a database behind the site to hold this, maybe SQL Server or would a lightweight Access workup due? My though is that it will hit the database and check for a duplicate instance of the select date and time slot, chosen by the user - then report back if it gets a hit... otherwise, it will populate the date and time text fields in the form.
It's for a small yard service company that makes out calls, but I wanna test and push myself. Any advice and structure suggestions from some seasoned pros who would be greatly appreciated. Thanks. Let me know if I need to provide more details.
If you do not have a database holding the data, where will you store the booked time slot? Where you plan to store your login information like user acc/password.
Of course you can store into text file but I would suggest a light DB like access. It would be enough for you to store few tables with not many line of data.
I do not see any problem with your taught to verify the data again what you stored in db. It should be the way.

Get database record automatically at a specific time

I have a task that basically I don't know how to accomplish it and I want some advice from you guys : I have a database that contains many binary images and a website that has a button.
When I press it a select statement is executed to search all the newly inserted rows after a specific date and send it to the website to process. My boss asked me if there is any way I can do that process manually by using a web service or anything else like a trigger in the database that automatically searches for new rows after a specific date and sends the new rows to the web site.
I don't know if I explained what I need. My main question is it possible to do this and what is the best way to achieve it. one more thing if it is achievable can I trigger it to work every day at a specific time ? Thank you
As I understood you question, these are the requirements:
You need to automate the process that is now manually triggered by clicking the button on the web page
The simplest way to do this in my opinion would be to create a small Console application and install it on a suitable server. Then on the server create a Windows task scheduler (Google it unless you're already familiar with it) task that runs the console application on a suitable schedule.
You could for instance have it run once every night at say 10 minutes past midnight and it would fetch all images from the past day and "send them to be processed".
First of all you have to understand website is not a repository of records but it works based on user requests. So in your website if you want to change contents on web pages, try AJAX reqeusts. If you are looking for some options to update details in other systems periodically think of eitehr Windows services, or cron jobs or may be SSIS jobs etc.
Use Cursor and Trigger but u have to store date in database which u want display on particular date

How to create fastest searching (filtering data) field in C#

I need to create User selection page for my web based application (User searching page), I have millions of registered users in my database and I want to search that users by typing the name in the text field.And by the way it should be suggest the name of users when i am typing the letters on the field (Like jquery tables).
I am using .net MVC3 for develop my web application
I am using Amazon database server for store my data (Amazon S3)
Millions of people will access this site.
-- I have tried to come up solution with elasticSearch I think this is well suited for document text search.
I want to know the way of, how can i speed up searching result? Is there any techniques to speed up filtering data from Database? Can I use ElasticSearch for this?
Please anybody can give me a best solution/ suggestions for come up with this problem?
If you can give me a examples it will be a great help. Thanks in advance.
There is no much tecniques on this:
Use AJAX to query the subset of users
On server side, one time request was got, get first (say) 10 elements of the subset found and send it to the user
On client side use defered scrolling: the control that shows the list of users do not show all users od subset got from the server, but only set of them. When user scrolls down/up list refreshes by querying again the server. Say on list view it's possible to see 10 users at a time, you get from server 15, so on scrolling at least next 5 will appear immediately.
Something like this.

Storing variable number of items in a database

I am using ASP.NET and Razor to create a calendar application similar to Google calendar and was hoping to get some feedback on my design thus far. My idea is to have 2 tables, one normal table for users, and another for a table of events which will store the users id and the time of the event, event ID, name of the event, and duration of the event.
I plan to write some code that will display a calendar on screen and allow the user to select multiple times so as to mark them as busy and give them a name. When this is done, the user submits the information and it is inserted into the database.
What is the best way to go about tackling this calendar construct? I can't really think of a simple way. I am guessing I can create a nice looking calendar using HTML and CSS, and perhaps JS to allow the drag and drop functionality? I suppose when the user selects a time, an object would be created with a start time and default duration, then when they drag it the duration changes. I am confused by how you would do this however, pulling objects out of thin air. How does Google Calendar do this?
And then how do you store all of the created objects in the database? I am guessing that Razor has a foreach construct and that I could just iterate over all objects created and insert them into the database one-by-one?
Also, how could I clean up the database, garbage collecting events that have already transpired while keeping events that are constant ie daily/weekly?
Apologies if the question is vague, if it is too vague then please press me on details I can be more clear on rather than close this. Thank you.
What is the best way to go about tackling this calendar construct?
If you are wondering about data structure here, whatever you do, do it in that way that it makes it compatible with standard iCalendar standard
I can't really think of a simple way.
Calendars are quite complex applications, there is no simple way. (events, sharing events, tentative, attendants, reminders...)
I am guessing I can create a nice looking calendar using HTML and CSS, and perhaps JS to allow the drag and drop functionality?
Yes.
I suppose when the user selects a time, an object would be created with a start time and default duration, then when they drag it the duration changes. I am confused by how you would do this however, pulling objects out of thin air. How does Google Calendar do this?
You can find some existing jquery plugins for this (try with this for start, or take a look at this list).
And then how do you store all of the created objects in the database? I am guessing that Razor has a foreach construct and that I could just iterate over all objects created and insert them into the database one-by-one?
Check out these jquery plugins and see how do they communicate with the server side. You will end up making ajax requests and then making database queries in the database. Razor has nothing to do with database...also Razor has nothing to do with client side interaction, it just renders page and everything else is on the js side.
Also, how could I clean up the database, garbage collecting events that have already transpired while keeping events that are constant ie daily/weekly?
I would't delete anything from database...don't see a reason for that. Just grab all you have and fill in the calendar. User will always look at month/date/week...grab data for that period and show it. When he goes back one year, he will have all the data still available.
Have you met my friend, Google?
In particular, 4GuysFromRolla has a tutorial, and there is a nice looking open source calendar control with some tutorials that should get you well on your way.

UI Design: Ideas For User Look-Up / Selecting User

I'm trying to design an interface for a web-based application that allows the user to look-up people (in my case it's patients for their medical records). I'm trying to think of very fast but accurate ways to search for users by their name.
I was thinking of typing the patient's name and it will match both first and last name, ordering them in a suggestion (autocomplete) list. I've done this before with several projects, but the problem that I have is that the text field could still be edited.
This method of looking up users should be akin to a drop down list of all users, but much quicker to search through and filter results.
Of course some terrible suggestions are populating all people in a drop down list and scrolling through. But if my patient list has several hundred people, this is a huge pain and a waste of time.
Does anyone have any good suggestions for creating a quick user-search function for assigning/looking up people very quickly?
EDIT: Sure I understand the use of autocomplete and have used it many times. But I only want the user to pick from a specific list of users and not be able to "search" for a user. Example: In an e-mail application (restricted to contacts) you search for contacts for the TO field. These are specific people to "search" for.
Thanks :)
i think something lke jquery autocomplete would work really nicely, the user can type free-form in the text-box, or accept one of the suggestions. after accepting the suggestion, it will appear in the textbox, and the user can still edit it further.
yeah, as James Curran mentions, you could filter the completions using a script on the server, for example:
$('#name').autocomplete('search.php?action=names');
search.php could lookup only the items available to the currently logged-in user...
For my website (NJTheater.com -- unfortunately, you'd need an admin login to see the page I'm talking about), I use a jQuery autocomplete plugin (not the jQuery UI autocomplete, which is based on a early version of the same code). It allows for getting the data via ajax, calling a webservice. (I have to selected from 13,000 people)
The control has an option to require the item be from the select list.

Categories

Resources