C assignment process in Windows IDE Create a Windows Form Ap

C# assignment process in Windows IDE.

Create a Windows Form Application project.

Create a Form for a car rental company and set the form text property to Car Rental and the form backcolor to GradientInactiveCaption.

Allow the user to select from a list of car styles: Compact, Standard, or Luxury.

Use a calendar that defaults to the current day and allows the user to select a future date when the car will be returned.

Add a Selection Complete button.

After these two selections are made, the user will click the Selection Complete button that will compute the total price of rental.

The number of days that the customer will have the car will be determined by the difference between the current date and the future date selected on the calendar.

The total price will be the number of computed rental days times the cost for the model of car selected ($19.95/day for Compact, $24.95/day for Standard and $39/day for Luxury).

Display the Number of Rental Days: and Total Price is: values on the form in two separate non-updateable controls.

Add an Exit button that will close the application.

Each button will have a Light Cyan backcolor property.

Internal documentation.

Solution

car_rent.csproj       //this is a code to develop a window application form it includes creation of platform, configuration design and it is where we include all the other code files...

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
<PropertyGroup>
    <Configuration Condition=\" \'$(Configuration)\' == \'\' \">Debug</Configuration>
    <Platform Condition=\" \'$(Platform)\' == \'\' \">x86</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{B99C8BCA-5727-47E1-9D4C-404593817B0D}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>car_rent</RootNamespace>
    <AssemblyName>car_rent</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=\" \'$(Configuration)|$(Platform)\' == \'Debug|x86\' \">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\\Debug\\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=\" \'$(Configuration)|$(Platform)\' == \'Release|x86\' \">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\\Release\\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
    <Reference Include=\"ComponentFactory.Krypton.Docking, Version=4.4.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e\" />
    <Reference Include=\"ComponentFactory.Krypton.Navigator, Version=4.4.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e\" />
    <Reference Include=\"ComponentFactory.Krypton.Toolkit, Version=4.4.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e\" />
    <Reference Include=\"ComponentFactory.Krypton.Workspace, Version=4.4.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e\" />
    <Reference Include=\"MySql.Data, Version=6.9.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL\">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\\..\\..\\..\\..\\..\\..\\Program Files\\MySQL\\MySQL Connector Net 6.9.4\\Assemblies\\v4.0\\MySql.Data.dll</HintPath>
    </Reference>
    <Reference Include=\"MySql.Data.Entity.EF5\">
      <HintPath>..\\..\\..\\..\\..\\..\\..\\Program Files\\MySQL\\MySQL Connector Net 6.9.4\\Assemblies\\v4.5\\MySql.Data.Entity.EF5.dll</HintPath>
    </Reference>
    <Reference Include=\"System\" />
    <Reference Include=\"System.Core\" />
    <Reference Include=\"System.Xml.Linq\" />
    <Reference Include=\"System.Data.DataSetExtensions\" />
    <Reference Include=\"Microsoft.CSharp\" />
    <Reference Include=\"System.Data\" />
    <Reference Include=\"System.Deployment\" />
    <Reference Include=\"System.Drawing\" />
    <Reference Include=\"System.Windows.Forms\" />
    <Reference Include=\"System.Xml\" />
</ItemGroup>
<ItemGroup>
    <Compile Include=\"viewrent.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"viewrent.Designer.cs\">
      <DependentUpon>viewrent.cs</DependentUpon>
    </Compile>
    <Compile Include=\"carregistration.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"carregistration.Designer.cs\">
      <DependentUpon>carregistration.cs</DependentUpon>
    </Compile>
    <Compile Include=\"carreturn.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"carreturn.Designer.cs\">
      <DependentUpon>carreturn.cs</DependentUpon>
    </Compile>
    <Compile Include=\"Customer.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"Customer.Designer.cs\">
      <DependentUpon>Customer.cs</DependentUpon>
    </Compile>
    <Compile Include=\"Form1.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"Form1.Designer.cs\">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <Compile Include=\"mainform.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"mainform.Designer.cs\">
      <DependentUpon>mainform.cs</DependentUpon>
    </Compile>
    <Compile Include=\"Program.cs\" />
    <Compile Include=\"Properties\\AssemblyInfo.cs\" />
    <Compile Include=\"rent.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"rent.Designer.cs\">
      <DependentUpon>rent.cs</DependentUpon>
    </Compile>
    <Compile Include=\"viewcustomer.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"viewcustomer.Designer.cs\">
      <DependentUpon>viewcustomer.cs</DependentUpon>
    </Compile>
    <Compile Include=\"searchvehicle.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"searchvehicle.Designer.cs\">
      <DependentUpon>searchvehicle.cs</DependentUpon>
    </Compile>
    <Compile Include=\"updatecustomer.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"updatecustomer.Designer.cs\">
      <DependentUpon>updatecustomer.cs</DependentUpon>
    </Compile>
    <Compile Include=\"viewreturn.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"viewreturn.Designer.cs\">
      <DependentUpon>viewreturn.cs</DependentUpon>
    </Compile>
    <Compile Include=\"viewvehicle.cs\">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include=\"viewvehicle.Designer.cs\">
      <DependentUpon>viewvehicle.cs</DependentUpon>
    </Compile>
    <EmbeddedResource Include=\"viewrent.resx\">
      <DependentUpon>viewrent.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"carregistration.resx\">
      <DependentUpon>carregistration.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"carreturn.resx\">
      <DependentUpon>carreturn.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"Customer.resx\">
      <DependentUpon>Customer.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"Form1.resx\">
      <DependentUpon>Form1.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"mainform.resx\">
      <DependentUpon>mainform.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"Properties\\Resources.resx\">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <Compile Include=\"Properties\\Resources.Designer.cs\">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
      <DesignTime>True</DesignTime>
    </Compile>
    <EmbeddedResource Include=\"rent.resx\">
      <DependentUpon>rent.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"viewcustomer.resx\">
      <DependentUpon>viewcustomer.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"searchvehicle.resx\">
      <DependentUpon>searchvehicle.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"updatecustomer.resx\">
      <DependentUpon>updatecustomer.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"viewreturn.resx\">
      <DependentUpon>viewreturn.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include=\"viewvehicle.resx\">
      <DependentUpon>viewvehicle.cs</DependentUpon>
    </EmbeddedResource>
    <None Include=\"Properties\\Settings.settings\">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include=\"Properties\\Settings.Designer.cs\">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
</ItemGroup>
<ItemGroup>
    <None Include=\"Resources\\cd.jpg\" />
</ItemGroup>
<Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
<Target Name=\"BeforeBuild\">
</Target>
<Target Name=\"AfterBuild\">
</Target>
-->
</Project>

veiwrent.cs //this code is used to allow the user to check out for the car details that they are interested to take for the rent

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace car_rent
{
    public partial class viewrent : Form
    {
        public viewrent()
        {
            InitializeComponent();
            fillcom();
        }

         void fillcom()
        {

            string constring = \"server=HAYKAY470-PC\\\\PELUMI;Initial Catalog=car;Integrated Security=True;\";
            string Query = \"select * from rent\";
            SqlConnection conDataBase = new SqlConnection(constring);
            SqlCommand cmdDataBase = new SqlCommand(Query, conDataBase);
            SqlDataReader myreader;
            try
            {

                conDataBase.Open();
                myreader = cmdDataBase.ExecuteReader();
                while (myreader.Read())
                {
                    string sName = myreader.GetString(12);

                    comboBox7.Items.Add(sName);

                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
        }
        private void kryptonButton1_Click(object sender, EventArgs e)
        {
            //string sqlpath = \"server = HAYKAY470-PC\\\\PELUMI;Initial Catalog=car;Integrated Security=True\";
            ////making the sql connection by creating an object of the sqlconnection class
            //SqlConnection sqlconnect = new SqlConnection(sqlpath);
            ////code for student bio data
            //string command = \"select * from rent\";
            ////Dim sql_insert_command As SqlCommand = New SqlCommand(command, sqlconnect)
            //SqlDataAdapter data = new SqlDataAdapter(command, sqlconnect);
            //DataSet data1 = new DataSet();
            //sqlconnect.Open();
            //data.Fill(data1, \"rent\");
            //sqlconnect.Close();
            //kryptonDataGridView1.DataSource = data1;
            //kryptonDataGridView1.DataMember = \"rent\";
     
        }

        private void kryptonTextBox10_Click(object sender, EventArgs e)
        {
                        if (comboBox7.Text == \"\")
            {
                MessageBox.Show(\"Please select car \", \"Message\", MessageBoxButtons.OK);
                comboBox7.Focus();
            }
            else
            {

                string sqlpath = \"server = HAYKAY470-PC\\\\PELUMI;Initial Catalog=car;Integrated Security=True;\";

                SqlConnection sqlconnect_search = new SqlConnection(sqlpath);
                string search = \"select * from rent where vname =\\\'\" + comboBox7.Text.ToString() + \"\\\'\";
                SqlCommand sql_search = new SqlCommand(search, sqlconnect_search);
                sqlconnect_search.Open();
                try
                {

                    SqlDataReader sqlReader = default(SqlDataReader);
                    sqlReader = sql_search.ExecuteReader();
                    while (sqlReader.HasRows)
                    {
                        if (sqlReader.Read())
                        {


                            comboBox1.Text = (string)(sqlReader[\"vmodel\"].ToString());
                            comboBox2.Text = (string)(sqlReader[\"vproduct\"].ToString());
                            comboBox3.Text = (string)(sqlReader[\"vname\"].ToString());
                            comboBox4.Text = (string)(sqlReader[\"vmaker\"].ToString());
                            comboBox5.Text = (string)(sqlReader[\"plateno\"].ToString());
                            comboBox6.Text = (string)(sqlReader[\"vcolor\"].ToString());
                            textBox1.Text = (string)(sqlReader[\"date_rent\"].ToString());
                            textBox2.Text = (string)(sqlReader[\"date_return\"].ToString());
                          
                            //kryptonDateTimePicker1

             //               var filePath = sqlReader.GetString(0);
                           
                            byte[] pic = (byte[])(sqlReader[\"pic\"]);
                            System.IO.MemoryStream loadPic = new System.IO.MemoryStream(pic);
                            pictureBox1.Image = Image.FromStream(loadPic);

                            //kryptonTextBox16.Text = Image;
                            break;
                        }
                    }
                    sqlconnect_search.Close();
                }
                catch (Exception)
                {
                    sqlconnect_search.Close();
                }

            }
        }

        private void kryptonGroupBox1_Panel_Paint(object sender, PaintEventArgs e)
        {

        }

        private void viewrent_Load(object sender, EventArgs e)
        {

        }
        }
    }

viewrent.designer.cs //this code is used to design the viewrent window

as answer length is limited i would be posting only main codes , as above write the designer.cs code on own

carregistration.cs //this code is used to register for the particular car by the customer . in these code instead of naming the car selection is done by veiwing the pictures

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace car_rent
{
    public partial class carregistration : Form
    {
        public carregistration()
        {
            InitializeComponent();
        }

        private void kryptonColorButton1_SelectedColorChanged(object sender, ComponentFactory.Krypton.Toolkit.ColorEventArgs e)
        {
          

                    //the sql server path addresst
           string sqlpath = \"server = HAYKAY470-PC\\\\AKIN;Initial Catalog=car;Integrated Security=True\";
           //making the sql connection by creating an object of the sqlconnection class
           SqlConnection sqlconnect = new SqlConnection(sqlpath);
           //sql insert statement for the member table
           //string dateOfBirth = \"\";
            string command = \"insert into registration(vmodel,vproduct,vname,vmaker,plate,vcolor,vdoor,vrim,vcategory,pics)\";
            command = command + \"values(@vmodel,@vproduct,@vname,@vmaker,@plate,@vcolor,@vdoor,@vrim,@vcategory,@pics)\";
          
           SqlCommand sql_insert_command = new SqlCommand(command, sqlconnect);
           sqlconnect.Open();
            try
            {
                sql_insert_command.Parameters.AddWithValue(\"@vmodel\", kryptonTextBox1.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vproduct\", kryptonTextBox2.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vname\", kryptonTextBox3.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vmaker\", kryptonTextBox4.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@plate\", kryptonTextBox5.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vcolor\", kryptonTextBox6.Text.ToString());

                sql_insert_command.Parameters.AddWithValue(\"@vdoor\", kryptonComboBox1.SelectedItem.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vrim\", kryptonComboBox2.SelectedItem.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vcategory\", kryptonComboBox3.SelectedItem.ToString());
                //sql_insert_command.Parameters.AddWithValue(\"@pics\", cmbMaritalStatus.SelectedItem.ToString());
                //sql_insert_command.Parameters.AddWithValue(\"@dateOfBirth\", cmbDay.SelectedItem.ToString() + \"/\" + cmbMonth.SelectedItem.ToString() + \"/\" + cmbYear.SelectedItem.ToString());
                //sql_insert_command.Parameters.AddWithValue(\"@school\", txtSchool.Text.ToString());
                //sql_insert_command.Parameters.AddWithValue(\"@department\", txtDepartment.Text.ToString());
                //sql_insert_command.Parameters.AddWithValue(\"@designation\", cmbDesignation.SelectedItem.ToString());
                //sql_insert_command.Parameters.AddWithValue(\"@nextOfKinName\", txtKinName.Text.ToString());
                //sql_insert_command.Parameters.AddWithValue(\"@nextOfKinAddress\", txtKinAddress.Text.ToString());
                //sql_insert_command.Parameters.AddWithValue(\"@nextOfKinPhone\", txtKinPhone.Text.ToString());
                //sql_insert_command.Parameters.AddWithValue(\"@nextOfKinRelationship\", cmbRelationship.SelectedItem.ToString());
                System.IO.FileStream fs = new System.IO.FileStream(kryptonTextBox8.Text.ToString(), System.IO.FileMode.Open, System.IO.FileAccess.Read);
                long y = fs.Length;
                byte[] img = null;
                System.IO.BinaryReader f = new System.IO.BinaryReader(fs);
                img = f.ReadBytes(Convert.ToInt32(fs.Length));
                sql_insert_command.Parameters.AddWithValue(\"@pics\", img);
                int status = sql_insert_command.ExecuteNonQuery();
                if (status != 0)
                {
                    MessageBox.Show(\"Data Sucessful\", \"Member Information\", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    sqlconnect.Close();
                }
                else
                {
                    MessageBox.Show(\"wrong\", \"\", MessageBoxButtons.OK, MessageBoxIcon.Error);
              
                }
            }
              catch (Exception)
                     {
             
              }
     
        }
        private void kryptonButton1_Click(object sender, EventArgs e)
        {
            OpenFileDialog pictureUpload = new System.Windows.Forms.OpenFileDialog();
            pictureUpload.Title = \"Picture Upload\";
            pictureUpload.InitialDirectory = \"C:\\\\\";
            pictureUpload.CheckFileExists = true;
            pictureUpload.CheckPathExists = true;
            pictureUpload.Filter = \"All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg;*.png\";
            pictureUpload.FilterIndex = 2;
            pictureUpload.ShowReadOnly = true;
            if (pictureUpload.ShowDialog() == DialogResult.OK)
            {
                kryptonTextBox8.Text = pictureUpload.FileName;
                //pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
                pictureBox1.ImageLocation = kryptonTextBox8.Text;
                //PictureBox1.ImageLocation = txtPicturePath.Text;
            }
        }

        private void kryptonButton3_Click(object sender, EventArgs e)
        {


//the sql server path addresst
            try
            {

                string sqlpath = \"server = HAYKAY470-PC\\\\PELUMI;Initial Catalog=car;Integrated Security=True\";
                //making the sql connection by creating an object of the sqlconnection class
                SqlConnection sqlconnect = new SqlConnection(sqlpath);

                string command = \"insert into registration(vmodel,vproduct,vname,vmaker,plate,vcolor,vdoor,vrim,vcategory,pics)\";
                command = command + \"values(@vmodel,@vproduct,@vname,@vmaker,@plate,@vcolor,@vdoor,@vrim,@vcategory,@pics)\";

                SqlCommand sql_insert_command = new SqlCommand(command, sqlconnect);
                sqlconnect.Open();

                sql_insert_command.Parameters.AddWithValue(\"@vmodel\", kryptonTextBox1.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vproduct\", kryptonTextBox2.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vname\", kryptonTextBox3.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vmaker\", kryptonTextBox4.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@plate\", kryptonTextBox5.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vcolor\", kryptonTextBox6.Text.ToString());

                sql_insert_command.Parameters.AddWithValue(\"@vdoor\", kryptonComboBox1.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vrim\", kryptonComboBox3.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@vcategory\", kryptonComboBox2.Text.ToString());
             
                System.IO.FileStream fs = new System.IO.FileStream(kryptonTextBox8.Text.ToString(), System.IO.FileMode.Open, System.IO.FileAccess.Read);
                long y = fs.Length;
                byte[] img = null;
                System.IO.BinaryReader f = new System.IO.BinaryReader(fs);
                img = f.ReadBytes(Convert.ToInt32(fs.Length));
                sql_insert_command.Parameters.AddWithValue(\"@pics\", img);
                int status = sql_insert_command.ExecuteNonQuery();
                if (status != 0)
                {
                    MessageBox.Show(\"Data Sucessful\", \"Member Information\", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    sqlconnect.Close();

                }

            }

            catch (Exception msg)

            {
                MessageBox.Show( msg.Message);
            }
      
        }

        private void kryptonColorButton2_SelectedColorChanged(object sender, ComponentFactory.Krypton.Toolkit.ColorEventArgs e)
        {

        }

        private void kryptonButton1_Click_1(object sender, EventArgs e)
        {
            OpenFileDialog pictureUpload = new System.Windows.Forms.OpenFileDialog();
            pictureUpload.Title = \"Picture Upload\";
            pictureUpload.InitialDirectory = \"C:\\\\\";
            pictureUpload.CheckFileExists = true;
            pictureUpload.CheckPathExists = true;
            pictureUpload.Filter = \"All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg;*.png\";
            pictureUpload.FilterIndex = 2;
            pictureUpload.ShowReadOnly = true;
            if (pictureUpload.ShowDialog() == DialogResult.OK)
            {
                kryptonTextBox8.Text = pictureUpload.FileName;
                //pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
                pictureBox1.ImageLocation = kryptonTextBox8.Text;
                //PictureBox1.ImageLocation = txtPicturePath.Text;
            }
        }

        private void kryptonComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}

carregistration.designer.cs // write by own

customer.cs //to collect the detail of customer

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace car_rent
{
    public partial class Customer : Form
    {
        public Customer()
        {
            InitializeComponent();
        }

        private void Customer_Load(object sender, EventArgs e)
        {

        }

        private void kryptonButton1_Click(object sender, EventArgs e)
        {
            OpenFileDialog pictureUpload = new System.Windows.Forms.OpenFileDialog();
            pictureUpload.Title = \"Picture Upload\";
            pictureUpload.InitialDirectory = \"C:\\\\\";
            pictureUpload.CheckFileExists = true;
            pictureUpload.CheckPathExists = true;
            pictureUpload.Filter = \"All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg;*.png\";
            pictureUpload.FilterIndex = 2;
            pictureUpload.ShowReadOnly = true;
            if (pictureUpload.ShowDialog() == DialogResult.OK)
            {
                kryptonTextBox10.Text = pictureUpload.FileName;
                //pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
                pictureBox1.ImageLocation = kryptonTextBox10.Text;
                //PictureBox1.ImageLocation = txtPicturePath.Text;
            }
        }

        private void kryptonButton2_Click(object sender, EventArgs e)
        {

            //the sql server path addresst
            string sqlpath = \"server = HAYKAY470-PC\\\\PELUMI;Initial Catalog=car;Integrated Security=True\";
            //making the sql connection by creating an object of the sqlconnection class
            SqlConnection sqlconnect = new SqlConnection(sqlpath);
            //sql insert statement for the member table
           // string dateOfBirth = \"\";
            string command = \"insert into customer(surname,othernames,phone,gender,DOB,nationalcard,state,lga,address,pic)\";
            command = command + \"values(@surname,@othernames@,@phone,@gender,@DOB,@nationalcard,@state,@lga,@address,@pic)\";

            SqlCommand sql_insert_command = new SqlCommand(command, sqlconnect);
            sqlconnect.Open();
            try
            {
                sql_insert_command.Parameters.AddWithValue(\"@surname\", kryptonTextBox2.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@othernames@\", kryptonTextBox3.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@phone\", kryptonTextBox4.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@gender\", kryptonTextBox5.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@DOB\", kryptonTextBox6.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@nationalcard\", kryptonTextBox7.Text.ToString());       
                sql_insert_command.Parameters.AddWithValue(\"@state\", kryptonTextBox8.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@lga\", kryptonTextBox9.Text.ToString());
                sql_insert_command.Parameters.AddWithValue(\"@address\", kryptonTextBox11.Text.ToString());
                System.IO.FileStream fs = new System.IO.FileStream(kryptonTextBox10.Text.ToString(), System.IO.FileMode.Open, System.IO.FileAccess.Read);
                long y = fs.Length;
                byte[] img = null;
                System.IO.BinaryReader f = new System.IO.BinaryReader(fs);
                img = f.ReadBytes(Convert.ToInt32(fs.Length));
                sql_insert_command.Parameters.AddWithValue(\"@pic\", img);
                int status = sql_insert_command.ExecuteNonQuery();
                if (status != 0)
                {
                    MessageBox.Show(\"Data Sucessful\", \"Customer Information\", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    sqlconnect.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, \"Incomplete Value Error\", MessageBoxButtons.OK, MessageBoxIcon.Error);
                sqlconnect.Close();
            }
            int nu = default(int);
            string name = \"CusP/NO/\";
            SqlConnection sqlconnect_search = new SqlConnection(sqlpath);
            string search = \"select id from customer where phone =\\\'\" + kryptonTextBox4.Text.ToString() + \"\\\'\";
            SqlCommand sql_search = new SqlCommand(search, sqlconnect_search);
            sqlconnect_search.Open();
            try
            {
                SqlDataReader sqlReader = default(SqlDataReader);
                sqlReader = sql_search.ExecuteReader();
                while (sqlReader.HasRows)
                {
                    if (sqlReader.Read())
                    {
                        name = name + sqlReader[\"id\"];
                        kryptonTextBox1.Text = name;
                        nu = Convert.ToInt32(sqlReader[\"id\"].ToString());
                        break;
                    }
                }
                sqlconnect_search.Close();
            }
            catch (Exception)
            {
                sqlconnect_search.Close();
            }
            SqlConnection con = new SqlConnection(\"server = HAYKAY470-PC\\\\PELUMI;Initial Catalog=car;Integrated Security=True\");
            string comm = \"update customer set cid=@cid where id =\" + nu.ToString();
            SqlCommand up = new SqlCommand(comm, con);
            con.Open();
            up.Parameters.AddWithValue(\"@cid\", name);
            up.ExecuteNonQuery();
            con.Close();
        }

      
        }
    }


customer.design.cs //to design the window

carreturn.cs // to code return

carreturn.design.cs //to design return window

form1.designer.cs

mainform.cs // this is used to code the main window consisting of all buttons

rent.cs
rent.designer.cs

//write on own

searchvehical.cs

updatecustomer.csviewreturn.cs

veiwreturn.designer.cs

viewvheicle.cs

//sorry not able to upload complete code due to limit in length of code

C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re
C# assignment process in Windows IDE. Create a Windows Form Application project. Create a Form for a car rental company and set the form text property to Car Re

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site