Thursday, 10 January 2013

Intel launch new 2 time faster Processor-Itanium 9500

Itanium 9500

Intel launched a new  processors, Itanium 9500, which the company claimed is over two-times faster than its previous generation processors.

The new Intel Itanium processor 9500 series is more than twice as powerful as the previous generation, making it ideal for today's most demanding workloads, including business analytics, database, and large-scale ERP applications, Intel said in a statement.

Monday, 12 November 2012

Happy Diwali

With gleam of Diyas
And the Echo of the Chants
May Happiness and Contentment Fill Your life
Wishing you a very happy and prosperous Diwali!!  


Friday, 19 October 2012

Multilingual website using asp.net

Multilingual website using asp.net

Step 1: in design create a drop down to select the language  and having few field such as name,number,currency and date specific to culture












<pre class="brush: csharp">// "ddlLanguage"
runat="server" AutoPostBack="True" 
            onselectedindexchanged="ddlLanguage_SelectedIndexChanged" 
            meta:resourcekey="ddlLanguageResource1">
        "en-us">English
        "fr-FR">French
        

    Your Current Culture is -"lblCulture" runat="server" Text="Label">
    
    "lblName" runat="server"  Text="Name" meta:resourcekey="lblNameResource1">                   
        "txtName" runat="server" meta:resourcekey="txtRName" Text="TechTT">
        
        
      
    
      
    "lblCurrency" runat="server" Text="Currency" meta:resourcekey="lblCurr">               
    "txtCurrency" runat="server" >
    
    
    "lblNFormat" runat="server" Text="No." meta:resourcekey="lblNumber">                       
    "txtN" runat="server" >
    
    
    "lblCDate" runat="server" Text="Current Date" meta:resourcekey="lblDate">          
    "txtCurrentDate" runat="server">
     
</pre>

      
    

Step 3: in code behind, on selection of language we will convert  the data according to Culture and UICulture

Code on selection change event
UICulture = ddlLanguage.SelectedValue;
        Culture = ddlLanguage.SelectedValue;
  
          
  
        Thread.CurrentThread.CurrentUICulture = new CultureInfo(ddlLanguage.SelectedValue);
        Thread.CurrentThread.CurrentCulture= CultureInfo.CreateSpecificCulture(ddlLanguage.SelectedValue);
          
   //to get the current culture
               CultureInfo c = CultureInfo.CurrentCulture;
  
               lblCulture.Text = c.NativeName;
        //currentculture UI
               lblName.Text = Convert.ToString(this.GetLocalResourceObject("lblNameResource1.Text"));
               txtName.Text=Convert.ToString (this.GetLocalResourceObject ("txtRName"));
               lblCurrency.Text = Convert.ToString(this.GetLocalResourceObject("lblCurr"));
               lblNFormat.Text = Convert.ToString(this.GetLocalResourceObject("lblNumber"));
               lblCDate.Text = Convert.ToString(this.GetLocalResourceObject("lblDate"));
  
        //CurrentCulture specific to currency and no. format etc.
        double Currency = 500.50;
        double noformat = 9580000.75;
  
        txtCurrency.Text = Currency.ToString("c");
        txtN.Text = noformat.ToString("n");
        txtCurrentDate.Text = DateTime.Now.ToLongDateString();

Thursday, 1 March 2012

SQL Helper

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CommonUtility
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Collections;
    using System.IO;
    using System.Web.UI.WebControls;
    using System.Web.UI;

    public class SqlHelper
    {
        string ConnectionString = string.Empty;
        static SqlConnection con;
        public SqlHelper()
        {
            ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            con = new SqlConnection(ConnectionString);
        }
        public void SetConnection()
        {
            if (ConnectionString == string.Empty)
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }
            con = new SqlConnection(ConnectionString);
        }
        public void CloseConnection()
        {
             if (con.State == ConnectionState.Open )
             {
                 con.Close();
             }
        }
        public DataSet ExecuteProc(string procName, Hashtable parms)
        {
            DataSet ds = new DataSet();
            SqlCommand cmd = new SqlCommand();
            SqlDataAdapter da = new SqlDataAdapter();
            cmd.CommandText = procName;
            cmd.CommandType = CommandType.StoredProcedure;
            if (con == null)
            {
                SetConnection();
            }
            cmd.Connection = con;
            if (parms.Count > 0)
            {
                foreach (DictionaryEntry de in parms)
                {
                    cmd.Parameters.AddWithValue(de.Key.ToString(), de.Value);
                }
            }
            da.SelectCommand = cmd;
            da.Fill(ds);
            return ds;
        }
        //for insert/update/delete operations i.e executenonquery
        public int ExecuteQuery(string procName, Hashtable parms)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = procName;
            if (parms.Count > 0)
            {
                foreach (DictionaryEntry de in parms)
                {
                    cmd.Parameters.AddWithValue(de.Key.ToString(), de.Value);
                }
            }
            if (con == null)
            {
                SetConnection();
            }
            cmd.Connection = con;
            if (con.State == ConnectionState.Closed)
                con.Open();
            int result = cmd.ExecuteNonQuery();
            return result;
        }
        //withoutput parameters
        public int ExecuteQuerywithOutputparams(SqlCommand cmd)
        {
            if (con == null)
            {
                SetConnection();
            }
            cmd.Connection = con;
            if (con.State == ConnectionState.Closed)
                con.Open();
            int result = cmd.ExecuteNonQuery();
            return result;
        }

        //with output parameter
        public int ExecuteQueryWithOutParam(string procName, Hashtable parms)
        {
            SqlCommand cmd = new SqlCommand();
            SqlParameter sqlparam = new SqlParameter();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = procName;
            if (parms.Count > 0)
            {
                foreach (DictionaryEntry de in parms)
                {
                    if (de.Key.ToString().Contains("_out"))
                    {
                        sqlparam = new SqlParameter(de.Key.ToString(), de.Value);
                        sqlparam.DbType = DbType.Int32;
                        sqlparam.Direction = ParameterDirection.Output;
                        cmd.Parameters.Add(sqlparam);
                    }
                    else
                    {
                        cmd.Parameters.AddWithValue(de.Key.ToString(), de.Value);
                    }
                }
            }
            if (con == null)
            {
                SetConnection();
            }
            cmd.Connection = con;
            if (con.State == ConnectionState.Closed)
                con.Open();
            int result = cmd.ExecuteNonQuery();
            if (sqlparam != null)
                result = Convert.ToInt32(sqlparam.SqlValue.ToString());
            return result;
        }
    }
}