Wednesday 13 March 2019

Not fired method when using interface

1. Create Mvc project

Webconfig

<configuration>
  <connectionStrings configSource="ConnectionStrings.config" />
  <appSettings>

ConnectionStrings.config

<?xml version="1.0"?>
<connectionStrings>
  <add name="SelfCore" connectionString="Server=VS-BALAMURUGANG;Database=Test;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />

  </connectionStrings>

AccountViewModel
-- Add contract reference
namespace Self.Portal.Models
{
    public class AccountViewModel
    {
        public List<Account> RegisterList { get; set; }
    }

}

Controller
--add using Self.Contracts;
--using Self.Portal.Models;
--using Self.provider;

---------
 public AccountProvider _accountProvider = new AccountProvider();
        [HttpGet]
        public ActionResult AddRegister()
        {
            //AccountViewModel _accountViewModel = new AccountViewModel();
            //List<Account> account = new List<Account>();
            //account = _accountProvider.Register();
            //_accountViewModel.RegisterList = account;
            return View();
        }

        [HttpPost]
        public ActionResult AddRegister(FormCollection form)
        {
            string Name = Convert.ToString(form["txtName"]);
            string City = Convert.ToString(form["txtCity"]);
            string Address = Convert.ToString(form["txtAddress"]);

            AccountViewModel _accountViewModel = new AccountViewModel();
            List<Account> account = new List<Account>();
            account = _accountProvider.Register(Name, City,Address);
            _accountViewModel.RegisterList = account;
            return View(_accountViewModel);
        }

        public ActionResult ViewRegister()
        {
            AccountViewModel _accountViewModel = new AccountViewModel();
            List<Account> account = new List<Account>();
            account = _accountProvider.ViewRegister();
            _accountViewModel.RegisterList = account;
            return View(_accountViewModel);
        }
--------

AddRegister.cshtml
--------------------------

@{
    ViewBag.Title = "AddRegister";
}

<h2>AddRegister</h2>
@using (Html.BeginForm("AddRegister", "Account", FormMethod.Post, new { enctype = "multipart/form-data", @id = "formAddRegister" }))
{
    <div class="page-wrapper">
        <div class="page-body">
            <div class=".form-control">
                <div class="card">
                    <div class="card-header">
                        <h5 class="">Add Banner</h5>
                    </div>
                    <div class="card-block">
                        <div class="row">
                            <div class="col-md-12 text-right m-b-15">
                                <a href="/Account/EditRegister" class="btn btn-primary btn-round">Edit Employee</a>
                            </div>
                            <div class="col-md-12" style="margin-top:20px;">

                                @*<div class="form-group row">
            <div class="col-sm-12">
                <div class="alert alert-success border-success">
                    @ViewBag.Message
                </div>
                <div class="alert alert-danger border-danger">
                    @ViewBag.ErrorMessage
                </div>
            @*</div>
        </div>*@
                                <input id="BannerId" name="BannerId" type="hidden" value="0" />
                                <input id="rbStatus" name="rbStatus" type="hidden" value="A" />
                                <input id="hdnImagepath" name="hdnImagepath" type="hidden" />
                                <div id="resultdiv">

                                </div>
                                <div class="form-group row">
                                    <div class="col-sm-3">
                                        <label for="lblBannerName" class="block">Name *</label>
                                    </div>
                                    <div class="col-sm-9">
                                        <input id="txtBannerName" name="txtName" type="text" class="form-control" placeholder="" maxlength="50" required value="">
                                        <span class="messages"></span>
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <div class="col-sm-3">
                                        <label for="lblBannerName" class="block">City *</label>
                                    </div>
                                    <div class="col-sm-9">
                                        <input id="txtBannerName" name="txtCity" type="text" class="form-control" placeholder="" maxlength="50" required value="">
                                        <span class="messages"></span>
                                    </div>
                                </div>
                                <div class="form-group row">
                                    <div class="col-sm-3">
                                        <label for="lblBannerName" class="block">Address *</label>
                                    </div>
                                    <div class="col-sm-9">
                                        <input id="txtBannerName" name="txtAddress" type="text" class="form-control" placeholder="" maxlength="50" required value="">
                                        <span class="messages"></span>
                                    </div>
                                </div>
                                <div class="text-center">
                                    <button type="submit" class="btn btn-primary btn-round" id="Save">Save</button>
                                    <a id="ancReset" href="/Banner/AddBanner" class="btn btn-primary btn-round">Reset</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
}

-----------
ViewRegister.cshtml
--------------------------


@{
    ViewBag.Title = "ViewRegister";
}

<h2>ViewRegister</h2>

<div>
    @if (Model.RegisterList.Count > 0)
    {
        <table class="table table-styling table-hover table-striped contribution-table table-responsive">
            <thead>
                <tr>
                    <td>S.No</td>
                    <td>Title</td>
                    <td>Training Type</td>
                    <td>Category</td>
                    <td>Author</td>
                    <td>Display Image</td>
                    <td>Start Date</td>
                    <td>End Date</td>
                    <td>IsEnable</td>
                    <td>Priority</td>
                    <td style="width:200px;text-align:center;">Action</td>
                </tr>
            </thead>
            <tbody>
                @{
                    int itr = 0;
                    foreach (var listItem in Model.RegisterList)
                    {
                        <tr>
                            <td>@(itr + 1)</td>
                            <td>
                                <label class="TaskName">@listItem.Name</label>
                                <input type="hidden" class="TaskIDHidden" value="@listItem.Name" />
                            </td>
                        </tr>
                        itr = itr + 1;
                    }
                }
            </tbody>
        </table>
    }
    else
    {
        <div class="alert alert-danger background-warning">
            No Records Found.
        </div>
    }
</div>
--------------------------------

CREATE TABLE [dbo].[tblEmployee1](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) NULL,
[City] [varchar](50) NULL,
[Address] [varchar](50) NULL
---------------------

CREATE procedure [dbo].[PROC_AddEmployee] 

   @Name varchar (50), 
   @City varchar (50), 
   @Address varchar (50) 

as 
begin 
   Insert into tblEmployee1 values(@Name,@City,@Address) 
End

--------------------------
CREATE procedure [dbo].[PROC_GetRegister1] 

as 
begin 
   Select * from tblEmployee1
End

-------------------------------
-------------------------------
ProjectName.Contracts

Account.cs

public class Account
    {
        public string Name { get; set; }
        public string City { get; set; }
        public string Address { get; set; }

    }
-----------------------------

ProjectName.Provider

AccountProvider.cs

public class AccountProvider
    {
        AccountRepository accountRepository = new AccountRepository();
        public List<Account> Register()
        {
            //List<Account> accounts = accountRepository.GetRegisterList();
            //return accounts;
            return accountRepository.GetRegisterList();
        }
        public List<Account> Register(string Name,string City,string Address)
        {
            //List<Account> accounts = accountRepository.GetRegisterList();
            //return accounts;
            return accountRepository.GetRegisterList(Name, City, Address);
        }
        public List<Account> ViewRegister()
        {         
            return accountRepository.ViewRegisterList();
        }

    }
------------------------------
ProjectName.Repository

AccountRepository

public class AccountRepository:BaseRepository
    {
        public List<Account> GetRegisterList()
        {
            //Account _accounts = null;
            List<Account> _accountsList = new List<Account>();
            //string getTrainingType = AdminResource.GetFutureTrainingById;
            var dbCommand = SelfCore.GetStoredProcCommand("PROC_GetRegister");
            SelfCore.AddInParameter(dbCommand, "@Name", DbType.String, "Bala");
            using (var dataReader = SelfCore.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    _accountsList.Add(new Account
                    {
                        Name = GetStringValue(dataReader, "Name")

                    });
                }
            }
            return _accountsList;
        }

        public List<Account> GetRegisterList(string Name,string City,string Address)
        {         
            List<Account> _accountsList = new List<Account>();         
            var dbCommand = SelfCore.GetStoredProcCommand("PROC_GetRegister");
            SelfCore.AddInParameter(dbCommand, "@Name", DbType.String, Name);
            SelfCore.AddInParameter(dbCommand, "@City", DbType.String, City);
            SelfCore.AddInParameter(dbCommand, "@Address", DbType.String, Address);
            using (var dataReader = SelfCore.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    _accountsList.Add(new Account
                    {
                        Name = GetStringValue(dataReader, "Name"),
                        City = GetStringValue(dataReader, "City"),
                        Address = GetStringValue(dataReader, "Address")
                    });
                }
            }
            return _accountsList;
        }

        public List<Account> ViewRegisterList()
        {         
            List<Account> _accountsList = new List<Account>();         
            var dbCommand = SelfCore.GetStoredProcCommand("PROC_GetRegister1");         
            using (var dataReader = SelfCore.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    _accountsList.Add(new Account
                    {
                        Name = GetStringValue(dataReader, "Name"),
                        City = GetStringValue(dataReader, "City")
                    });
                }
            }
            return _accountsList;
        }

    }
---------------------------
BaseRepository

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace Self.Repository
{
    public class BaseRepository
    {
        static Database _SelfCore;
     

        public static Database SelfCore
        {
            get
            {
                return _SelfCore;
            }
        }
     
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseRepository"/> class.
        /// </summary>
        public BaseRepository()
        {
            DatabaseProviderFactory factory = new DatabaseProviderFactory();
            Database core = factory.Create(_Database.SelfCore);
            _SelfCore = core;         
        }

        public struct _Database
        {
            public const string SelfCore = "SelfCore";         
        }

        /// <summary>
        /// Gets the integer value.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <returns></returns>
        protected Int32 GetIntegerValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];

            Int32 valueToReturn = default(Int32);

            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = (Int32)value;
            }

            return valueToReturn;
        }

        /// <summary>
        /// Gets the long value.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <returns></returns>
        protected Int64 GetLongValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];

            Int64 valueToReturn = default(Int64);

            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = (Int64)value;
            }

            return valueToReturn;
        }

        /// <summary>
        /// Gets the string value.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <returns></returns>
        protected string GetStringValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];

            string valueToReturn = null;

            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = value.ToString();
            }

            return valueToReturn;

        }

        /// <summary>
        /// Gets the char value.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <returns></returns>
        protected char GetCharValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];

            char valueToReturn = default(char);

            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = Convert.ToChar(value);
            }

            return valueToReturn;

        }



        /// <summary>
        /// Gets the date value.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <returns></returns>
        protected DateTime? GetDateValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];

            DateTime? valueToReturn = null;

            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = (DateTime?)value;
            }

            return valueToReturn;

        }

        /// <summary>
        /// To return the Int64 value
        /// </summary>
        /// <param name="dataReader"></param>
        /// <param name="columnName"></param>
        /// <returns></returns>
        protected Guid GetGuidValue(IDataReader dataReader, string columnName)
        {

            //Retreive the column from the data reader
            object value = dataReader[columnName];
            Guid valueToReturn = new Guid();
            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = (Guid)value;
            }
            return valueToReturn;
        }

        /// <summary>
        /// Get the Bool value from Small int
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <returns>It returns the Boolvalue</returns>
        protected bool GetSmallIntBoolValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];
            bool valueToReturn = false;


            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                if ((Int16?)value == 1) { valueToReturn = true; }
            }
            return valueToReturn;
        }

        protected bool GetBoolValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];
            bool valueToReturn = false;


            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = (bool)value;
            }
            return valueToReturn;
        }

        protected double GetDoubleValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];

            double valueToReturn = default(double);

            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = (double)value;
            }

            return valueToReturn;
        }

        protected decimal GetDecimalValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];

            decimal valueToReturn = default(decimal);

            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = (decimal)value;
            }

            return valueToReturn;
        }
        protected TimeSpan GetTimeSpanValue(IDataReader dataReader, string columnName)
        {
            //Retreive the column from the data reader
            object value = dataReader[columnName];

            TimeSpan valueToReturn = default(TimeSpan);

            //If the retrieved value is not null then cast it to the correct type
            if (!(value is DBNull))
            {
                valueToReturn = (TimeSpan)value;
            }

            return valueToReturn;
        }

        /// <summary>
        /// GetCurrentCulture
        /// </summary>
        /// <returns></returns>
        protected string GetCurrentCulture()
        {
            return Thread.CurrentThread.CurrentUICulture.ToString();
        }
    }

    public static class DataRecordExtensions
    {
        public static bool HasColumn(this IDataRecord dr, string columnName)
        {
            for (int i = 0; i < dr.FieldCount; i++)
            {
                if (dr.GetName(i).Equals(columnName, StringComparison.InvariantCultureIgnoreCase))
                    return true;
            }
            return false;
        }
    }
}



Base Contract

namespace GCE.Contracts.Shared
{
    public class BaseContract
    {
        /// <summary>
        /// Get or Set CreatedBy.
        /// </summary>
        public string CreatedByName { get; set; }


        /// <summary>
        /// Get or Set CreatedBy.
        /// </summary>
        public long CreatedBy { get; set; }

        /// <summary>
        /// Get or Set CreatedDate.
        /// </summary>
        public DateTime CreatedDateTime { get; set; }


        public string UpdatedByName { get; set; }

        /// <summary>
        /// Get or Set UpdatedBy.
        /// </summary>
        public long UpdatedBy { get; set; }

        /// <summary>
        /// Get or Set UpdatedDate.
        /// </summary>
        public DateTime? UpdatedDateTime { get; set; }

        /// <summary>
        /// Get or Set Status.
        /// </summary>
        public char Status { get; set; }
    }

}


Without BaseRepository

public List<Account> GetRegisterList(string Name, string City, string Address)
        {
            //Account _accounts = null;
            List<Account> _accountsList = new List<Account>();
            var constring = ConfigurationManager.ConnectionStrings["SelfCore"].ToString();
            SqlConnection con = new SqlConnection(constring);
            con.Open();
            SqlCommand cmd = new SqlCommand("PROC_GetRegister", con);
            cmd.CommandType = CommandType.StoredProcedure;
           cmd.Parameters.Add(new SqlParameter("@Name", Name));
         cmd.Parameters.Add(new SqlParameter("@City", City));
          cmd.Parameters.Add(new SqlParameter("@Address", Address));
            SqlDataReader dr = cmd.ExecuteReader();
            try
            {
                while (dr.Read())
                {
                    Account AM = new Account();
                    AM.Name = dr.GetString(1);
                    AM.Address = dr.GetString(2);
                    AM.City = dr.GetString(3);
                 //  -- AM.Description = dr.GetGuid(4);
                 //  -- AM.ImageUrl = dr.GetString(5);
                 //  -- AM.Latitude = dr.GetDecimal(6);
                 // --  AM.Longitude = dr.GetDecimal(7);
                 //--   AM.Location = dr.GetString(8);
                 // --  AM.ArticleURL = dr.GetString(9);
                    _accountsList.Add(AM);
                }
            }
            catch (Exception ex)
            {

            }
            con.Close();
            return _accountsList;
        }



Monday 17 October 2016

Disable mouse right click on web page

<html>
   <head>
   </head>
   <body oncontextmenu="return false" >
   </body>
</html>

http://www.w3schools.com/jsref/event_oncontextmenu.asp





rowString = rowString.Replace('"', ' ').Trim();


http://stackoverflow.com/questions/12740486/want-to-remove-the-double-quotes-from-the-strings



Sunday 16 October 2016

Interesting English

1. Which is the longest word in English?

Pneumonoultramicroscopicsilicovolcanoconiosis

The word contains forty five letters and this is one of the lung disease name caused by silica dust which is delivered from volcano.
----------
2. Food Time

Breakfast -- Breaking the fast.
Brunch -- Between breakfast and lunch (Breakfast+Lunch) Which means late morning or early afternoon
Lunch -- Afternoon food that is middle of the day
Supper -- Night food.
Dinner -- Main meal of the day. Not only refer the night food
Happy Eating!!
---------- 
3. Wishes
How do you do -- It's a normal way of greeting and the reply is same How do you do
Good Bye -- God be with you
----------
4. Welfare inquiry

British English
Q: How are you?
A1: I am fine, Thanks. How about you?
A2: Very well, Thank you. How about you?
A3: I am great and you
A4: I am OK/All right/Superb
A5: So..so -- not to bad (எதோ போகுது)

American English
Q1: How are you doing?
Q2: What's up man?
Q3: How is everything?
Q4: How is going?
A1: I am doing good and you?
A2: Can't complaint
A3: Nothing to grumble (புலம்புதலுக்கு ஒன்றுமில்லை)
Note: Positive answer and sad reply
----------
 5. Rhetorical Questions

The questions which is not expect the answers
Examples
1. Why should I help you? (நான் ஏன் உனக்கு உதவ வேண்டும்)
2. Are you crazy? ( நீ  என்ன பைத்தியக்காரனா)
3. Don't you have sense? (உனக்கு அறிவு இல்லையா)
----------
6. Informal verbs

Gonna -- Going to
Wanna -- Want to
Gotta -- Got to
----------

7. Pangram
      A sentence which have each alphabetic word at least one time.
Example:
A quick brown fox jumps over the lazy dog
Jackdaws love my big sphinx of quartz

----------



Tuesday 11 October 2016

Get a timestamp in JavaScript?

new Date().getTime();
Math.floor(Date.now() / 1000)


http://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript

Monday 10 October 2016

Tricky IAS interview questions answer

Q1. Can you tell 3 consecutive days without Monday, Wednesday and Friday?

Ans1: Yesterday, Today and Tomorrow



Sunday 2 October 2016

How to remove the profile picture from google accounts

Go to Setting --> General --> My Picture --> Change Picture --> No Picture --> Apply Changes


How to remove the profile picture from Google+

Go to Profile--> About --> Click your Profile photo --> Select No Photo



Tuesday 6 September 2016

Obtaining canonical URL using JavaScript

<!DOCTYPE html>
<html>
    <head>
        <link href="http://www.example.com/" rel="canonical" />
        <title>Canonical</title>
        <script type="text/javascript">
            window.onload = function () {
                var canonical = "";
                var links = document.getElementsByTagName("link");
                for (var i = 0; i < links.length; i ++) {
                    if (links[i].getAttribute("rel") === "canonical") {
                        canonical = links[i].getAttribute("href")
                    }
                }
                alert(canonical);
            };
        </script>
    </head>
    <body>
        <h1>Canonical</h1>
    </body>
</html>



Monday 5 September 2016

C# Reading and writing to console

Reading from the console => Console.ReadLine
Writing to the console => Console.WriteLine
       Two ways to write a console
            1. Concatenation
            2. Place holder which is most preferred


Example with Concatenation

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Enter First Name");
        string FirstName = Console.ReadLine();
        Console.WriteLine("Enter Last Name");        
        string LastName = Console.ReadLine();
        Console.WriteLine("Hello "+FirstName +LastName);
        Console.ReadLine();
    }

}

Output:
Enter First Name
Balamurugan
Enter Last Name
Ganesan
Hello BalamuruganGanesan



Example with Place holder

using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Enter First Name");
        string FirstName = Console.ReadLine();
        Console.WriteLine("Enter Last Name");        
        string LastName = Console.ReadLine();
        Console.WriteLine("Hello {0} {1}", FirstName, LastName);
        Console.ReadLine();
    }

}

Output







Note1:
C# is a case sensitive

Note2:
Difference between Write and WriteLine

Write() method => Output values to the screen without newline character
WriteLine() method => Output will start on a new line



Run comments

How to get the run comment?
Press windows+r

Some useful Run comments 
Microsoft Paint- mspaint
Notepad- notepad
Calculator- calc
Microsoft Word- winword



Attach Event vs add Event Listener

Attach Event is only works on Opera and Internet Explore
AddEvent Listener is works on Firefox, Google chrome and Safari (and Opera and Internet Explore from version 9)



Definitions

DOM- Document Object Model is a standard for how to get, change, add and delete the HTML elements






Abbreviations

DOM- Document Object Model
HTML- Hyper Text Markup Language
CSS- Cascading Style Sheets
JS- JavaScript
IIS- Internet Information Services
POC - Proof Of Concept
RSS - Rich Site Summary


Sunday 4 September 2016

Windows 8 tricks

Increase the font size in windows 8         Fn (+) +
Decrease the font size in windows 8        Fn (+) -
Open Run command widow                    Windows (+) R



How to change the background in Windows 8

Method1

Go to Start
Search Change desktop background
Select Background desktop
Browse your picture location from your local disk
If you select more than 1 pictures than, give time for change the picture
Choose your picture position
Click Save Changes


Method II

Go to Control Panel
Select Appearance and Personalization
Select Personalization
Select Background desktop
Browse your picture location from your local disk
If you select more than 1 pictures than, give time for change the pictue
Choose your picture position
Click Save Changes





Saturday 3 September 2016

Techmix

Troubleshoot Google Publisher Tags

Now most of the websites are using DFP (Doubleclick for Publisher) ad. When we open the website the DFP ad will has been render.

How to check the DFP ad render properly or not
Open your website
Add the below tag at end of your website name:
?google_force_console (or) ?google_force_console=1

Keyboard shortcut: CTRL+F10

For Example: http://csharp-sql-tutorials.in?google_force_console
                       http://csharp-sql-tutorials.in?google_force_console=1





How to reset and start IIS with iis command

Internet Information Services (IIS) is a web server.

Why?
When the connection of db server is going high, then our application that is website not responding properly. For immediate action we are go for iis reset which is the server is off and the existing connections are closed. After getting the value '0', then restart the server, the new connection will be accepted.

Procedure:
Go to Start
Type Command Prompt
Right click and select Run as administration


iisreset/stop
iis attempt to stop all services








iisreset/start
iis start all services










iisreset/restart
iis stop all services and automatically start all services.




Monday 29 August 2016

Part1 C# Introduction

How to create a project?
Open Visual studio => File => New => Project


Select visual C# in Installed Template
Select Console application
Give your project name in Name TextBox
Browse Location  for where it store this project


Sample Program

using System;   //Namespace declaration

class Program
{
    static void Main()  //Main method, The entry point of the project
    {
        //Write in console
        Console.WriteLine("Welcome to my C# blog");
        Console.ReadLine();
    }
}
Output: Welcome to my C# blog


What is Namespace?
     Namespace is collection of classes, interfaces, enums, structs and delegates.
     Namespace is used to organize your code.
For Example,
using System is tells that use of code present inside.

Note:
If we not using System then just type System.Console, but more times we are using System so we declare namespace at top


What is Main method?
     Main method is a entry point into your application

Sample Program

using System;

class Program
{
    static void MainTwo()
    {
        Console.WriteLine("Welcome to my .net blog");
    }

    static void Main()
    {
        Console.WriteLine("Welcome to my C# blog");
        MainTwo();
        Console.ReadLine();
    }
}

Output: 
Welcome to my C# blog
Welcome to my .net blog