Tuesday, 1 September 2015

Free ASP.NET MVC project to learn for beginners

Free ASP.NET MVC project to learn for beginners.

Download Learn And Share.

Download files from given link below.

https://onedrive.live.com/?cid=3d35297f653c11f2&id=3D35297F653C11F2%21190&ithint=folder,7z&authkey=!AIAUCC0SmdoCxDM

Please read the documents and then you can run the project on your system.


Saturday, 15 March 2014

How to remove the .aspx from ASP.NET url's ? How to cut the URL's in short form

Solution:-


Just put this piece of code in the Web Config file and be happy !!!!!!

<system.webServer>
    <rewrite>
        <rules>
            <rule name="RewriteASPX">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="{R:1}.aspx" />
            </rule>
        </rules>
    </rewrite>
  </system.webServer>


And just the page name in the link as it is for Example see this:-

<a href="Index.aspx">Sign in</a>  1.Don't use this

<a href="Index">Sign in</a>  1.Use  this

Thanks ..:)

The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)

Problem in Web Config File :-

The type or namespace name 'Linq' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)

Solution:-

Put this piece of code in the Configuration file and it will be solved..

 <compilation debug="false">
          <assemblies>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
           </assemblies>
        </compilation>

Saturday, 12 October 2013

FreeProgrammingChapters Lucknow

FreeProgrammingChapters Lucknow

https://www.facebook.com/groups/FreeProgrammingChapters/

Join us if you want to learn something new with us.

Contact us as:-

anuragsarkar19@gmail.com or Join our Facebook Group.

Sending Mail from Website Using PHP & HTML

Here is the HTML Page Code:-

You can change the design of the HTML page since i am not providing you the CSS code of my page so you need to redisgn it.

<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
          <link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
       
<body>

<div class="" >
                                    <form name="contact" method="post" action="sendmail.php" id="form1" style="float:left; padding:0px" >
                                    <h2>Book a Room</h2>
                                        <fieldset>
                                            <div class="row">
                                                <input type="text" class="input" name="name">
                                                Your Name:
                                               
                                            </div>   
                                            <div class="row">
                                                <input type="text" class="input" name="email">
                                                E-Mail Address:
                                            </div>   
                                            <div class="row">
                                                <input type="text" class="input" name="telephone">
                                                Contact No.:
                                            </div>   
                                            <div class="row">
                                                <input type="text" name="SelectedDate1" class="input" id="SelectedDate" readonly onClick="GetDate(this);" />
                                                Check In:
                                            </div>   
                                            <div class="row">
                                                <input type="text" name="SelectedDate2" class="input" id="Text1" readonly onClick="GetDate(this);" />
                                                Check Out:
                                            </div>   
                                            <div class="row">
                                                <input type="text" class="input" name="Place">
                                                Pick Up/Drop:
                                            </div>   
                                            <div class="row_textarea">
                                                Additional Comments:
                                                <textarea cols="1" rows="1" name="comments"></textarea>   
                                            </div>   
                                            <div class="wrapper">
                                                <a href="#" class="button1" onClick="document.getElementById('form1').submit()">Send</a>
                                                <a href="#" class="button1" onClick="document.getElementById('form1').reset()">Clear</a>
                                            </div>
                                        </fieldset>
                                    </form>
                                                                    </div>
</form>

PHP Code:-

<?php
if(isset($_POST['email'])) {
    
    // EDIT THE 2 LINES BELOW AS REQUIRED
    $email_to = "hotelflightpath@gmail.com";
    $email_subject = "Booking Received";
    
    
    function died($error) {
        // your error code can go here
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
        die();
    }
    
    // validation expected data exists
    if(!isset($_POST['name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['telephone']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted.');     
    }
    
    $name = $_POST['name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $comments = $_POST['comments']; // required
    $checkin=$_POST['SelectedDate1'];// required
    $checkout=$_POST['SelectedDate2'];// required
    $Place=$_POST['Place'];// required
    
    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  }
   if(strlen($comments) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";
    
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
    
    $email_message .= "First Name: ".clean_string($name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
    $email_message .= "Comments: ".clean_string($comments)."\n";
    $body="Mail Send";
    $msg='Name:-'. $_POST['name']."\n"
    .'Email:-'. $_POST['email']."\n"
    .'Contact No:-'.$_POST['telephone']."\n"
    .'Check In:-'.$_POST['SelectedDate1']."\n"
    .'Check Out:-'.$_POST['SelectedDate2']."\n"
    .'Place:-'.$_POST['Place']."\n"
    .'cOMMENTS:-'.$_POST['comments'];
    mail($email_to,$email_subject,$msg);
                                          
  echo '<span style="color:#FFFFFF">Your E-mail has been sent !Thank you for contacting us. We will be in touch with you very soon.</span>';
   ?>                                    
<!-- include your own success html here 
if($send_email)
  {
  echo "Your E-mail has been sent !Thank you for contacting us. We will be in touch with you very soon.";
  }
   else
   {
   echo "E-mail sent was failed !";
   } -->
<?php
}
?>
This is the PHP Code. You need to create a file and name it as sendmail.php and paste the PHP code.
and create another page contact.HTML and paste the HTML code there. It will for the Web server but if you need to run it on Localhost you need to configure your SMTP server.
Thanks Any further suggestions are welcomed by you in comments.

Monday, 29 July 2013

Playing with JavaScript Adding & Dividing numbers using Java Script

<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
Enter Number One<input type="text" name="no1" id="1"><br>
Enter Number Two<input type="text" name="no2" id="2"><br>
<button onclick="myadd()">Press</button>
<p id="dem"></p>
<script>
function myadd()
{
var y=document.getElementById("1");
var x=document.getElementById("2");
var a=y.value;
var b=x.value;
if(a=="")
{
alert("Please Enter No 1");
return
}
if(b=="")
{
alert("Please Enter No 2");
return
}
if(a==b)
{
alert("No cannot be Same");
return
}
else
{
var c=parseInt(a)+parseInt(b);
document.getElementById("demo").innerHTML="On Adding"+c;
var e=parseInt(b)/parseInt(a);
document.getElementById("dem").innerHTML="On Division"+e;
}}
</script>

</body>
</html>

Thursday, 13 June 2013

Advice for Prgrammers

Hi I am a Software Developer having one year of experience from India. I would like to tell you how to crack interviews. Interview depends on many things such as:-

Interview in Small Companies

1.First and important point is which company you are going for how much it is old and does it have any experienced employees?.

2.How much experience do you have?

3. What the company needs from you ?

As in my first point i asked how the company is? There are situation where the boss is Non Technical he does not has any knowledge about software or codes. So firstly he asks the developer how much experience does he have and what qualification does he have. Then he asks about what kinds of projects he has done. If you are satisfying his needs  the you are selected and you are the first employee of the company luckily.

If he does have employees then they will take the interview they can ask anything they are good at so be prepared and be friendly them if you are able to impress them then you are selected.

In Small Companies if you can give you the output and can generate the income for them or say you can do projects at the given time then only they will give you money/salary. There are situations when small companies  don't give  salary at the time so don't get frustrated get the experience get the knowledge and then switch to  good company according to you.

Interview in MNC

 

1.How big the company?.

2.How much experience do you have?

3. What the company needs from you ?

First Round:-

To crack a interview in MNC you have to be good at Basis and at the same time you have to be good at
application development. They will test the logic first by giving you simple problems in Data Structures , Al go, Oops Arrays etc so don't forgot to revise the basics if you to work in a good company.

Second Round:-

In this round they will test that you will fulfils their work or not. If they found you suitable and cleared all the rounds you are selected.

So  to be a good programmer /developer don't ever forgot to work on basics at regular intervals Big companies will check that only the they will proceed further.





Waiting for Answers

http://onurag-dotnetfunda.blogspot.in/p/interview-questions-answers.html

Please Check Interview Question page for details.

Sunday, 26 May 2013

Send Sms from ASP.NET Website using Full On Sms

ASPX CODE
-----------------------------------------------------------------------------------------------------------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Send Sms</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text="Mobile No"></asp:Label>    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <asp:Label ID="Label2" runat="server" Text="Message"></asp:Label>
        &nbsp;&nbsp;
        <asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine"></asp:TextBox>
        <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" Text="Send Sms"
            onclick="Button1_Click" />
          
    </div>
    </form>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

CS CODE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net;

public partial class _Default : System.Web.UI.Page
{

string uid;
string password;
string message;
string no;

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public void send()
    {
    HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://ubaid.tk/sms/sms.aspx?uid=" + uid + "&pwd=" + password + "&msg=" + message + "&phone=" + no + "&provider=fullonsms");
    HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
    System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
    string responseString = respStreamReader.ReadToEnd();
    respStreamReader.Close();
    myResp.Close();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            uid = "";
            password = "";
            message = TextBox2.Text;
            no = TextBox1.Text;
            send();
            TextBox2.Text ="";
            TextBox1.Text="";
        }
        catch(Exception ex )
        {
            ex.Message.ToString();
        }
    }
}

Please Download

http://www.c-sharpcorner.com/UploadFile/ANURAGSARKAR19/send-sms-from-Asp-Net-using-way2sms

CSS3 SHAPES

You can use these shapes in any html control like text area , buttons , grids etc.

SQUARE

#square {
width: 140px; 
height: 140px; 
background: blue; 
}
CIRCLE

#circle { 
width: 140px;
height: 140px;
background: blue; 
-moz-border-radius: 70px; 
-webkit-border-radius: 70px; 
border-radius: 70px;
}

OVAL
#oval {
width: 200px; 
height: 100px; 
-moz-border-radius: 100px / 50px; 
-webkit-border-radius: 100px / 50px; 
border-radius: 100px / 50px;
}

you can use the oval shape in text area .

ROUNDED CORNER
#rc 
{
border:display:solid;
border-radius: 5px;
   border-width:1px;
 }

you can use this in text area .

SPEECH BLUE
#speech-bubble {
width: 120px; 
height: 80px; 
background: blue;
position: absolute;
-moz-border-radius: 10px; 
-webkit-border-radius: 10px; 
border-radius: 10px;
}
#speech-bubble:before {
content:"";
position: absolute;
width: 0;
height: 0;
border-top: 13px solid transparent;
border-right: 26px solid blue;
border-bottom: 13px solid transparent;
margin: 13px 0 0 -25px;
}

you can use speech blue to show messages if text boxes are left blank

Thursday, 2 May 2013

Logical vs. Physical Separation Software Development

Logical Separation refers to: 
Code organization Namespaces, classes, folders, and assembliesSoftware design pattern  
 
Physical Separation refers to:  
Infrastructure organization  Separate physical processes, machines, devicesSoftware architecture

By- Vidya Vrat Agarwal.

Saturday, 13 April 2013

Dynamically Login in Crystal Report

Here I am going to show you how to dynamically login in Crystal Reports. Sometimes developer faces the issue that he has to provide server name and etc this code will help you to remove those exceptions in applications.

TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();                 TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
Tables CrTables;
ConnectionInfo Cr = new ConnectionInfo();
Cr.ServerName = "";//here you should provide your Server Name
Cr.DatabaseName = "";//here you should provide your Database Name
Cr.UserID = "";//here you should provide your User Name
Cr.Password = "";//here you should provide your Password
CrTables = Ip.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = Cr;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
crystalReportViewer1.ReportSource = Ip;
In this code I have created a crystal report and created its object IP and used that in the report source.

Monday, 18 March 2013

Saving Data Using DataGridview and Doing Calculations in it Billing Software & Inventory Software



Introduction  

 Billing and Invoicing Software Included. Calculations in Data   Grid view for billing software and calculating total at the last.

Hi there are many programmers who face the problem into creating Invoicing and Billing Software this will help them to save the data(Items via DataGridview) in database. And this is for those basic programmers who don't know how to save data using DataGridview in Window Forms using C# and SQL SERVER. Download Sample   

Code For Saving Data In Database( MS SQL SERVER ) via DataGridview  

Here i have created a function for collecting the information entered by the use and after that he can save all that information in the database.

        void Save()
        {

            try
            {

                if (dataGridView1.Rows.Count > 1)
                {

                    for (int i = 0; i <= dataGridView1.Rows.Count - 1; i++)
                    {

                        string col1 = dataGridView1.Rows[i].Cells[0].Value.ToString();

                        string col2 = dataGridView1.Rows[i].Cells[1].Value.ToString();

                        string col3 = dataGridView1.Rows[i].Cells[2].Value.ToString();

                        string col4 = dataGridView1.Rows[i].Cells[3].Value.ToString();

                        string col5 = dataGridView1.Rows[i].Cells[4].Value.ToString();

                        using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString))
                        {

                            string insert = "INSERT INTO InvoiceItems(SNo,Quantity,Rate,Description,Total) VALUES (@SNo,@Quantity,@Rate,@Description,@Total)";

                            con.Open();

                            SqlCommand cmd = new SqlCommand(insert, con);

                            cmd.Parameters.AddWithValue("@SNo", col1.ToString());

                            cmd.Parameters.AddWithValue("Description", col2.ToString());

                            cmd.Parameters.AddWithValue("@Quantity", col3.ToString());

                            cmd.Parameters.AddWithValue("@Rate", col4.ToString());

                            cmd.Parameters.AddWithValue("Total", col5.ToString());

                            cmd.ExecuteNonQuery();

                            con.Close();

                        }

                    }

                }

            }

            catch (Exception ex)
            {

                ex.Message.ToString();

            }

        }

Code For Doing  Calculations In DataGridview 

Code will be done at the CellEndEdit Event of the Datagridview.So when user clicks on next column the value gets calculated. The total net amount also gets calculated automatically at the cellend event of the gridview.Column Index No refers the values which is to be multipled. Here i have multiplied 2nd & 3rd column and the value is achieved in 4th column. 

private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs)
        {
            try
            {     
if (e.ColumnIndex == 2 || e.ColumnIndex == 3)
{
                  
double cell1 = Convert.ToSingle(dataGridView1.CurrentRow.Cells[2].Value);
                  
double cell2 = Convert.ToSingle(dataGridView1.CurrentRow.Cells[3].Value);
                  
if (cell1.ToString() != "" && cell2.ToString() !="")
                 
{
                      
dataGridView1.CurrentRow.Cells[4].Value = cell1 * cell2;
                 
}
             
}
              
label17.Visible = true;
              
decimal tot = 0;
      
for (int i = 0; i <= dataGridView1.RowCount - 1; i++)            
{
                  
tot += Convert.ToDecimal(dataGridView1.Rows[i].Cells[4].Value);
              
}
              
txt_netamoun.Text = tot.ToString();

            }
            catch(Exception ex)
            {    
MessageBox.Show(ex.ToString());

            }
        }



All these thing i learned when i started working on Billing Software.This is all for a beginner.
Thanks Hope you will like this.