Friday, July 27, 2018

HOW TO DEVELOPED CAR PARKING MANAGEMENT SYSTEM IN ASP.NET | SRADHA WEBCREATIONS

HOW TO DEVELOPED CAR PARKING MANAGEMENT SYSTEM IN ASP.NET

CAR PARKING
DRIVER NAME
CAR NUMBER
ENTEY TIME
OUT TIME
DURATION OF PARKING
PAYMENT

 SAVE

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;

public partial class CarParking : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
 protected void TextBoxOUTTIME_TextChanged(object sender, EventArgs e)
    {
        double dEntryTime = Convert.ToDouble(TextBoxENTRYTIME.Text);
        double dOuttime = Convert.ToDouble(TextBoxOUTTIME.Text);
        string dCarNumber = TextBoxCARNUMBER.Text;
        string sDriverName = TextBoxDRIVERNAME.Text;
        double dDuration;
        double dPayment;
        double dExtraHours;

        dDuration = dOuttime - dEntryTime;
        TextBoxDURATION.Text = Convert.ToString(dDuration);

        if (dDuration <= 12)
        {

            dPayment = 15.00;
        }
        else
        {
            dExtraHours = dDuration - 12;
            dPayment = (dExtraHours * 1.00) + 15.00;
        }
        TextBoxPAYMENT.Text = Convert.ToString(dPayment);
    }
   

protected void ButtonSAVE_Click(object sender, EventArgs e)
    {
        string connectionstring= ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
        string insertsql = "insert into carparking (drivername,carnumber,entrytime,outtime,duration,payment)values(@drivername,@carnumber,@entrytime,@outtime,@duration,@payment)";

        using (SqlConnection myconnection = new SqlConnection(connectionstring))
       {
           myconnection.Open();
        SqlCommand mycommand=new SqlCommand(insertsql,myconnection);
  mycommand.Parameters.AddWithValue("@drivername",TextBoxDRIVERNAME.Text);
       mycommand.Parameters.AddWithValue("@carnumber",TextBoxCARNUMBER.Text);
        mycommand.Parameters.AddWithValue("@entrytime",TextBoxENTRYTIME.Text);
        mycommand.Parameters.AddWithValue("@outtime",TextBoxOUTTIME.Text);
        mycommand.Parameters.AddWithValue("@duration",TextBoxDURATION.Text);
        mycommand.Parameters.AddWithValue("@payment",TextBoxPAYMENT.Text);
       
mycommand.ExecuteNonQuery();
        myconnection.Close();
            }
}




No comments:

Post a Comment