Clear asp.net control in page using Jquery

No comments:


<script>
    $(document).ready(function () {
       $("#btnSubmit").click(function () {
          
          //Clear All textboxes
           $('input[type=text]').each(function () {
            $(this).val('');
          
           //Clear All Dropdowns and Listboxes
            $("select").each(function () {
             $(this).val('0');
            });

           //Clear Checkbox and Checkbox list Selection    
           $('input:checkbox').removeAttr('checked');

          //Clear Radio and Radiobutton list Selection
          $('input:radio').removeAttr('checked');
                })
            });
        });
    </script>

How to select Today records from Sql Server

No comments:
  SELECT CONVERT(DATE, DATE_CREATED) as DATE_CREATED,* FROM RESOURCES WHERE    DATE_CREATED=CONVERT (DATE, GETDATE())
 
  SELECT * FROM RESOURCES WHERE DATE_CREATED=CONVERT (DATE, GETDATE())


Business Acces Layer in 3 Tier architecture in Asp.net

No comments:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using GRMI.DiverseFund.SqlDBDiverseFundDataAccessLayer;
using GRMI.DiverseFund.SqlDBDiverseFundBal;


namespace GRMI.DiverseFund.SqlDBDiverseFundBal
{
    public class InvestorBackerMethods
    {
        InvestorBackerResponse objIbr = new InvestorBackerResponse();

        public InvestorBackerResponse InsertPeerFundingInformation(InvestorBackerProperties objIbp)
        {
            SqlParameter[] p = new SqlParameter[]
            {
                new SqlParameter("@ProfileID", System.Guid.NewGuid().ToString().Substring(4, 19).ToUpper()),
                new SqlParameter("@InvestorBackerType", objIbp.InvestorBackerType),
                new SqlParameter("@InvestorBackerReferenceID",  objIbp.InvestorBackerReferenceId),
                new SqlParameter("@IsTermsAccepted",  objIbp.IsTermsAccepted),
                new SqlParameter("@DisplayName",  objIbp.DisplayName),
              

                new SqlParameter("@MembershipTypeId",  objIbp.MembershipId),
            };

            objIbr.ResultCount = UseDatabaseElements.ExecuteInsertUpdateQuery("spDF_InsertInvBacMaster", p);
            return objIbr;

        }
        public InvestorBackerResponse UpdatePeerFundingInformation(InvestorBackerProperties objIbp)
        {
            SqlParameter[] p = new SqlParameter[]
            {
               new SqlParameter("@ProfileID", objIbp.ProfileId),
               new SqlParameter("@InvestorBackerType", objIbp.InvestorBackerType),
               new SqlParameter("@InvestorBackerReferenceID", objIbp.InvestorBackerReferenceId),
               new SqlParameter("@IsTermsAccepted",objIbp.IsTermsAccepted),
               new SqlParameter("@DisplayName", objIbp.DisplayName),
               new SqlParameter("@ElectronicSignature", objIbp.ElectronicSignature),
               new SqlParameter("@FirstName ", objIbp.FirstName),
               new SqlParameter("@MiddleName ", objIbp.MiddleName),
               new SqlParameter("@LastName ",objIbp.LastName),
              

               new SqlParameter("@BActive", objIbp.BActive),
            };

            objIbr.ResultCount = UseDatabaseElements.ExecuteInsertUpdateQuery("spDF_InsertInvBacMaster", p);
            return objIbr;
        }
        public InvestorBackerResponse GetAllDropDown()
        {
            objIbr.GetMultipleTable = UseDatabaseElements.FetchMultipleTable("spFR_GetInfoParameters");
            return objIbr;
        }

        public InvestorBackerResponse GetInvestorDetails(InvestorBackerProperties objIbpGetInvestorDetails)
        {
            SqlParameter[] p = new SqlParameter[]
            {
                new SqlParameter("@userName", objIbpGetInvestorDetails.UserName)
            };
            objIbr.GetMultipleTable = UseDatabaseElements.FetchMultipleTable("spDF_GETINVESTORDETAILS", p);
            return objIbr;


        }
        public InvestorBackerResponse GetBackerDetails(InvestorBackerProperties objIbpBackerDetails)
        {
            SqlParameter[] p = new SqlParameter[]
            {
                new SqlParameter("@userName", objIbpBackerDetails.UserName)
            };
            objIbr.GetMultipleTable = UseDatabaseElements.FetchMultipleTable("spDF_GETINVESTORDETAILS", p);
            return objIbr;


        }


    }
}


//Responces

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace GRMI.DiverseFund.SqlDBDiverseFundBal
{
    public class InvestorBackerResponse
    {
        private int _ResultCount;

        public int ResultCount
        {
            get { return _ResultCount; }
            set { _ResultCount = value; }
        }
        private string _SingleValue;

        public string SingleValue
        {
            get { return _SingleValue; }
            set { _SingleValue = value; }
        }
        private DataTable _GetTable;

        public DataTable GetTable
        {
            get { return _GetTable; }
            set { _GetTable = value; }
        }
        private DataSet _GetMultipleTable;

        public DataSet GetMultipleTable
        {
            get { return _GetMultipleTable; }
            set { _GetMultipleTable = value; }
        }

    }
}



Data Access Layer in 3 Tier architecture in Asp.net

No comments:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Globalization;

//Namespace standard is COMPANYNAME.PROJECTNAME.MODULENAME
//If we want use this DAL project in any other project, use connection string name as ConStr.
namespace GRMI.DiverseFund.SqlDBDiverseFundDataAccessLayer
{
    public class UseDatabaseElements
    {
        public static SqlConnection GetConnection()
        {

            SqlConnection con = new SqlConnection();
            con.ConnectionString = ConfigurationManager.ConnectionStrings[""].ConnectionString.ToString();
            return con;
        }

        //Below Method is used to Insert update records into the Databse.
        public static int ExecuteInsertUpdateQuery(string procName, SqlParameter[] parameter)
        {
            int i = 0;
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = GetConnection();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = procName;
            foreach (SqlParameter p1 in parameter)
            {
                cmd.Parameters.Add(p1);

            }
            try
            {
                cmd.Connection.Open();
                i = cmd.ExecuteNonQuery();

            }
            catch (ArgumentNullException ex)
            {
                throw new ArgumentNullException(ex.Message.ToString());
            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();

                }
            }
            return i;

        }
        //Below method to get single value from database.
        public static string FetchSingleValue(string procName, SqlParameter[] parameter)
        {
            object SingleValue = null;
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = GetConnection();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = procName;
            foreach (SqlParameter p1 in parameter)
            {
                cmd.Parameters.Add(p1);
            }
            try
            {
                cmd.Connection.Open();
                SingleValue = cmd.ExecuteScalar();
            }
            catch (ArgumentNullException ex)
            {
                throw new ArgumentNullException(ex.Message.ToString());
            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }
            if (SingleValue == null)
                return "";
            else
                return Convert.ToString(SingleValue);

        }
        //Below method to get single value from database.
        public static string FetchSingleValue(string procName)
        {
            object SingleValue = null;
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = GetConnection();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = procName;
            try
            {
                cmd.Connection.Open();
                SingleValue = cmd.ExecuteScalar();
            }
            catch (ArgumentNullException ex)
            {
                throw new ArgumentNullException(ex.Message.ToString());
            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }
            if (SingleValue == null)
                return "";
            else
                return Convert.ToString(SingleValue);

        }
        //Below method is to get table  records.
        public static DataTable FetchTable(string procName, SqlParameter[] parameter)
        {
            DataTable dt = new DataTable();
            dt.Locale = CultureInfo.InvariantCulture;
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = GetConnection();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = procName;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            foreach (SqlParameter p1 in parameter)
            {
                cmd.Parameters.Add(p1);
            }
            try
            {
                cmd.Connection.Open();
                da.Fill(dt);
            }
            catch (ArgumentNullException ex)
            {
                throw new ArgumentNullException(ex.Message.ToString());

            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }
            return dt;

        }
        //Below method is to get table  records
        public static DataTable FetchTable(string procName)
        {
            DataTable dt = new DataTable();
            dt.Locale = CultureInfo.InvariantCulture;
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = GetConnection();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = procName;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            try
            {
                cmd.Connection.Open();
                da.Fill(dt);
            }
            catch (ArgumentNullException ex)
            {
                throw new ArgumentNullException(ex.Message.ToString());

            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }
            return dt;

        }
        //Below method is to get Multiple table data.
        public static DataSet FetchMultipleTable(string procName, SqlParameter[] parameter)
        {
            DataSet ds = new DataSet();
            ds.Locale = CultureInfo.InvariantCulture;
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = GetConnection();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = procName;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            foreach (SqlParameter p1 in parameter)
            {
                cmd.Parameters.Add(p1);
            }
            try
            {
                cmd.Connection.Open();
                da.Fill(ds);
            }
            catch (ArgumentNullException ex)
            {
                throw new ArgumentNullException(ex.Message.ToString());

            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }
            return ds;

        }
        //Below method is to get Multiple table data.
        public static DataSet FetchMultipleTable(string procName)
        {
            DataSet ds = new DataSet();
            ds.Locale = CultureInfo.InvariantCulture;
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = GetConnection();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = procName;
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            try
            {
                cmd.Connection.Open();
                da.Fill(ds);
            }
            catch (ArgumentNullException ex)
            {
                throw new ArgumentNullException(ex.Message.ToString());

            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }
            return ds;

        }
    }

}