Friday, May 27, 2011

How to Format Date in CustomCalendarExtender control

The default date format for the CustomCalendarExtender is MM/dd/yyyy which is typically US date format. To change this format, you need to set the Format property of the control.

For UK based date format you can set this to dd/MM/yyyy which would display date as 19/03/2011 instead of 03/19/2011 (default format)


Happy Coding :)

Implementing Transactions in WCF

In synchronous communication (request-response-acknowledge) we generally refer to the response HTTP code to determine a successful transaction. But in some cases it might happen that an acknowledgement be sent to the server which will store this value in the database.

A typical scenario would be of file download process wherein the client needs to send the acknowledgement which stored in database for future use. For this you need to implement Transaction in WCF. To do this, you can use the TransactionScope class or you can use the OperationBehaviour attribute in WCF as below

[OperationBehavior(TransactionScopeRequired = true)]

This would require your web-method to execute as a part of transaction. Having done that, you can now return a Boolean value (True/False) as a result depending on the status of the download process. This value can then be stored in the database in Boolean/Bit format for future reference.

Happy Coding :)