Skip to main content

Posts

Showing posts from 2011

Get Date Difference in months from C#.NET

/// Returns the number of months between startDate and endDate. /// If the startDate is greater than endDate the result is negative. /// /// Start Date /// End Date ///         public int MonthDifference(DateTime startDate, DateTime endDate)         {             #region Analysis             // This came from the following analysis             // Assume 1 is start date and 2 is end date             // if Y2 = Y1 then M2 - M1             // else (12 - M1) + [(Y2 - Y1 - 1) * 12] + M2             #endregion             return endDate.Month - startDate.Month + ((endDate.Year - startDate.Year) * 12);         }

Set height of page to full screen from JavaScript

Call any of the following JS method onload of body like to set the height of page to full screen. function resizehtml() {             window.moveTo(0, 0);             window.resizeTo(screen.availWidth, screen.availHeight);         } function setPanelHeight() {                         var hederHeight = document.getElementById('header').offsetHeight;             var footerHeight = document.getElementById('footer').offsetHeight;             var contentHeight = document.getElementById('content').offsetHeight;             height = document.body.clientHeight - hederHeight - footerHeight;             document.getElementById('content').style.height = height;             }

Custom Logger in ASP.NET along with access permission to folder

This class can be used to create custom logger in ASP.NET application which includes the functionality of giving the permissions to the log folder where seperate log file will be created for each day. using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Security.AccessControl; namespace MyNamespace.Logger {     public class Logger     {                public static void CreateLog(string strMessage,  string moduleName, bool isError)         {             try             {                 string strIsError = string.Empty;                 if (isError)                     strIsError = "Error:";                 else                     strIsError = "Information:";                 string fileUrl = GetFileUrl();                 string directoryName = System.IO.Path.GetDirectoryName(fileUrl);                 CreateFolder(directoryName);                 using (System.IO.StreamWriter sw = System.IO.File.AppendText(fileUrl))  

Payment Gateway

Here are some well known payment gateways available in the market with detailed development and integration guides, http://www.abcpayments.com http://www.ebs.in http://www.ccavenue.com http://www.authorize.net https://www.paypal.com http://www.paypoint.net This link may help you in choosing right payment gateway as per your requirements.

Welcome Aboard

I welcome you to my blog, you will find here the latest information about Microsoft technologies like ASP.NET, C#, .NET framework 2.0,3.0,3.5, WCF, ASMX web services, AJAX, Javascript, SMS and payment gateways available in the market...

SMS Gateway

Following are some nice SMS gateways available in market with detailed development guides, http://www.clickatell.com http://www.celltrust.com http://www.smsxchange.com http://www.gateway4sms.com http://messaging.office.microsoft.com/HostingProviders.aspx This link gives you more details of choosing a good SMS gateway for your requirements.