Oops!!! Difficult question to answer, and also fairly complicated topic to address. Especially in this century where the technical world moving (migrating) from Technology to Technology at a very good pace. ‘Which way to go?’ – is the most common question (precisely DOUBT?) which creeps into a developer’s conscience from time to time. For a newbie (a person who starts coding with delighted dreams to achieve something pretty quickly in short span of time, and immediately stumbles with bunch of compile errors…just kidding), this topic is a bottleneck which leaves him with many new questions – ‘What am I doing?’, ‘Where am I going’, blah, blah…and blah. I will try to address this most commonly raised flag (or skeptical thought) in a generic human way.
Let me get started by wishing you a very happy and prosperous new year. I wish this new year would be more delightful and encouraging to one and all.
“I am a MVP” – huh…a heavy weight sentence from my heart. Continuing with this post will let you know the reason why I mentioned it as heavy weight. First let me quickly reconcile a bit of my past.
Three years back when I first stepped into ASP.Net 2.0 coding, I am a very good Electrical Engineer. I did research in EE, Control Systems blah blah blah…, with a good knowledge base in EE and when everything going perfect in Control Systems Design. But suddenly I started looking up (till date I don’t know the reason exactly) for something to make it as a HOBBY (folks knows, being an EE you tend to get mechanical parts and analog signals in your mind at some or the other point, where we need some other option to take out analog signals from our mind). I want to paint, learn guitar, play sports etc (OMG – Immediately realized that those are not going to be my ALICES’ in my wonderland).
Implementing MVP Pattern using UserControls with WCF Database Operations in Entity Framework and LINQ – Part III
In this part of the tutorial, we carry on with the construction of MVP Pattern. First we start with the creation of View interfaces for the UserControls (which we created in PART II). Then we create the presenter classes, which will take the corresponding instances of views and then manipulate the view using Model classes (there by achieving code portability). Once we are done with the presenter classes, we implement the View interfaces in the codebehind of the UserControls. Finally we create a sample ASP.Net web page (typically webform), and use the UserControls for database transactions.
Implementing MVP Pattern using UserControls with WCF Database Operations in Entity Framework and LINQ – Part II
In this part of the tutorial – We first code for the CustomerService.cs by implementing ICustomerService.cs interface. We use LINQ queries to code database transactions. Then we create a host application (here it is a Console application) which operates the WCF service. Then we create a sample website for implementing MVP Pattern to access WCF. In the website, we implement some UserControls for fetching/updating/deleting records from the database.
Implementing MVP Pattern using UserControls with WCF Database Operations in Entity Framework and LINQ – PART I
First we create a database – ‘CustomersDB’ – with a table in it – ‘Customers’. This table Customers holds the basic data related to each and every customer. Then we create the entity model for this CustomersDB using ADO.Net Entity Framework. After that we create a WCF service with minimal end point configuration to access ServiceContracts which do basic database operations. Instead of coding the data access methods (of the class implementing ServiceContract) in traditional ADO.Net queries, we tend to use LINQ for the same. Once the service is ready, we host it using a Console App. With this we complete the backend of the article. Now we implement the MVP pattern for better separation of UI from its code with the help of presenter class. So we create an interface for both model and view and then implement them in their respective class. Finally we create a UI with some UserControls in it for adding/editing/deleting customers from the front end.
In the first part of this tutorial (PART I – Click Here), we uploaded files to the database in binary format using a FileUpload control. The plot behind saving files is to take the file from the FileUpload control, convert the same to the binary format, then save it to the DB. To make our accomplishment more flexible and maintainable, we use stored procedures along with custom classes for database transactions.
In this part of the tutorial, we retrieve the files (which are stored in a table of a database). For this purpose we first create a custom class which will hold the code for database transactions, then we create a generic handler which will process all the incoming requests for the downloading of files. Finally we create a web page which uses the before mentioned class and handler along with a repeater control to make the file available to the client.
In this tutorial, we first save files to the database in binary format, then in the second part of the tutorial we see how to provide a download option to the files residing in database. For uploading the files to DB, we use a FileUpload control and to provide download facility we make use of a Generic handler. The plot behind saving files is to take the file from the FileUpload control, convert the same to the binary format, then save it to the DB. To make our accomplishment more flexible and maintainable, we use stored procedures along with custom classes for database transactions. And the plot behind retrieving files is to use a handler which process the incoming request which are made to the files in database.
In this tutorial, we see how to develop a simple Contact Page webform. This Contact Page is going to be a similar one to what we usually see in our day to day experience out in internet. Here we use AJAX HTML editor to enable Html email to the owner of the website. The basic outline would be – Users provide their general details like name and email, and also they can provide Html Message (using AJAX HTML Editor) in the Contact Page, where a basic validation is done as first step. Then we take the Html string, and send the same in the email to the authorized person of the website (typically owner) using SMTP settings (System.Net.Mail namespace). For ease of use, we use Gmail SMTP settings (host and port) for sending email. For better interactivity UpdateProgress control is used to show the progress of email routine.
In this article, we see how to provide a download option (say for example to download images) to the users of our website. In accomplishing the requirement we use a Generic HttpHandler – which handles all the requests made for the download. For demonstration purpose we take some images and display them using a Datalist, in which we do provide an option to download. On download option click, the generic handler will process the request and displays an dialog in the client questioning client either to save or open the file, accordingly corresponding action will be taken place.
1) The main motive behind writing this code snippet is that this topic has been asked number of times @forums.
3) The credit of the code goes to a MSFT (I never knew his name) for providing this sample @forums.
In this tutorial, we see how to develop a simple comments section. This comments section is going to be a similar one to what we usually see in our day to day experience. Here we use TinyMCE editor to enable Html Comments. And also catpcha is enabled (with the help of reCaptcha of Google). The basic outline would be – Users provide their general details like name and email, and also they can provide Html Comment (using TinyMCE), and finally they should enter the text showed in the captcha for validating robots. Then we take the Html string, encode it using HtmlEncode(), store it in database. Finally we retrieve the encoded string from the database, we then decode it and display it in the page as Comment.
Sending Automated Emails asynchronously using a C# Windows Service in conjunction with Database Email records PART – II
In this part of the tutorial, we first create a Windows Service Project, then implement a Service called – ‘BirthdayEmailService’. Then we add a reference to our previously created Class Library – ‘EmailComponent’. We code BirthdayEmailService using Timer to perform the email sending task for every hour. Then we incorporate the Installer classes for the purpose of installation. Finally a Setup and Deployment Project is created for the Service. Finally the complete Solution is build and the exe file is generated which is ready enough to get installed.
Sending Automated Emails asynchronously using a C# Windows Service in conjunction with Database Email records – Part I
In this tutorial, we learn how to send automated birthday wish emails to the customers of our product. We first design our database with basic details of every customer, and of course with a Email address field. Then we create a class library to hold the classes of database interactivity and to send email asynchronously. We use ADO.Net (for this tutorial I am skipping Entity Framework implementation, which usually I prefer to interact with Database. For generating EF modules of database, kindly watch this tutorial – Click Here) with a stored procedure for database interaction (primarily to fetch email ids of customers to whom we got to send birthday wishes). Then finally we use a Windows Service (which obviously run background in the server)through which the previously created class library is accessed and async emails are send.
In this tutorial, I create a sample Database “Example” with a table “Images” which holds the information about images like ImageName, ImageDescription and ImagePath. Then I use a SqlDataSource in combination with Repeater to display the images from the database onto the page. Here we use LightBox plugin to open up a modalpopup window with the details of the image (shown in modalpopup) along with the flexibility of navigating between images without closing the modalpopup.
In this tutorial, I create a sample Database “Example” with a table “Images” which olds the information about images like ImageName, ImageDescription and ImagePath. Then I use a SqlDataSource in combination with Repeater to display the images from the database onto the page. Here we use GalleryView to make the slideshow of images in the repeater along with display of the particular image which is in focus.
In this tutorial, we first create a Database and store the necessary details of the Images like ImageName, ImagePath (physical directory path in relative URL), ImageDescription etc. Then we display these images on the web page using a Repeater in combination with SqlDataSource. After this we use Client CallBack to display the details of corresponding image on which mouse is hovered. CallBacks are accomplished by implementing ICallBackEventHandler.
1) The code in this tutorial demos on how to raise an event of UsercControl which is on Parent page.
2) We got a UserControl (TestUserControl.ascx), which got a button in it. On Button click, we use a delegate to call an event from the parent page.
3) Even though personally I can’t vote to this approach of linking Page to its UserControl, but its worthy to know the procedure (as some situations may demand it).
1) In this tutorial (which is PART – II), we create a small website in ASP.Net 4.0 and we shall use a WebForm (named: PubsServiceTestPage.aspx) as a client to our service (which we created in former tutorial).
2) We Use the inline model of Webform (not the codebehind model).
3) We perform the actions using our client like, Getting all the Authors and display them in the Dropdownlist for selections, Selecting a Author and display his corresponding books using a Repeater, Modify and save the book details back to database etc.
4) To test the Client, we need the service to be running in the server, that can be simply manipulated by starting another instance of VS 2010 and running (Ctrl + F5) the PubsService.svc.cs.
1) In this tutorial we create a simple WCF service which is used to retrieve and save data from Pubs Database (Microsoft sample database).
2) The service also demos on how to use EF 4.0 and LINQ against database coding, with no requirement of writing SQL queries.
3) The continuation of this tutorial shows on how to create a client (say a WebForm in a website) to utilize this service.
Before looking at the code, Read about – What is JumpStart? The following code presents a Mandatory (Required) CheckBoxList with a Default Selection. <%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
Entity Framework – Creating Model from Existing Database and using it in Sample Project – Video Tutorial # 2
Hello Folks, This is the second section of my FIRST Video Presentation in IntStrings.com, Hope you guys enjoy it. The outline of the presentation – PART # 1 – Getting started with Entity...