C # Car Rental Automation || C # Rent a car || C # Car Rental

 C # Car Rental Automation || C # Rent a car || C # Car Rental
Okunuyor C # Car Rental Automation || C # Rent a car || C # Car Rental

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Bilgi;

using System.Drawing;

using System.Linq;

using System.text;

using System.Windows.Forms;

using System.Bilgi.OleDB;

namespace oto_kiralama_otomasyo the

{

the public partial class Rent a car : Biçim

{

the public Rent a car()

{

InitializeComponent();

}

the oledbconnection connection = new the oledbconnection("Provider = Microsoft.ACE.OLEDB.12.0; Bilgi Source = auto_rental.accdb; Persist Security Info = True");

DataTable dt = new DataTable();

private void arac_kiralama_load(oBJECT cents, eventArgs to)

{

it is musteridol();

it is uygunaracdol();

fill();

}

void fill()

{

try

{

iF (connection.State == connectionstat to.Closed)

{

connection.Open();

}

dt.Clear();

OleDbDataAdapter lists = new OleDbDataAdapter("select * from rental", connection);

lists.fill(dt);

datagridview1.DataSource = dt;

lists.Dispose();

datagridview1.SelectionMode = in datagridviewselectionmo.FullRowSelect;

datagridview1.Columns(0).Visible = false;

datagridview1.rowheadersvisibl to = false;

datagridview1.Columns(one).width = 80;

datagridview1.Columns(2nd).width = 120;

datagridview1.Columns(3).width = 77;

datagridview1.Columns(4).width = 76;

datagridview1.Columns(5).width = 76;

connection.Close();

combobox2.text = "";

TextBox3.text = "";

TextBox4.text = "";

TextBox5.text = "";

comboBox1.text = "";

}

catcher (Exception error)

{

MessageBox.show(error.Message);

}

}

void it is musteridol()

{

comboBox1.items.Clear();

iF (connection.State == connectionstat to.Closed)

{

connection.Open();

}

OleDbCommand command = new OleDbCommand("select tc from musteri",connection);

OleDbDataReader read = command.ExecuteReader();

while (read.Reader())

{

comboBox1.items.Adder(read("Tc").toString());

}

connection.Close();

}

void it is uygunaracdol()

{

combobox2.items.Clear();

iF (connection.State == connectionstat to.Closed)

{

connection.Open();

}

OleDbCommand command = new OleDbCommand("select plate from tool where status = '"+ "Appropriate" + " '", connection);

OleDbDataReader read = command.ExecuteReader();

while (read.Reader())

{

combobox2.items.Adder(read("plate").toString());

}

connection.Close();

}

private void Button5_Click(oBJECT cents, eventArgs to)

{

menu menu = new menu();

menu.show();

this.Hida();

}

private void datetimepicker1_valuechanged(oBJECT cents, eventArgs to)

{

TextBox3.text = DateTimePicker1.value.toshortdatestring();

}

private void datetimepicker2_valuechanged(oBJECT cents, eventArgs to)

{

TextBox4.text = datetimepicker2.value.toshortdatestring();

}

private void Button2_Click(oBJECT cents, eventArgs to)

{

try

{

OleDbCommand command = new OleDbCommand("insert into rental (tc, plate, shop_date, data_date, fee) values ​​('" + comboBox1.text + " ','" + combobox2.text + " ','" + TextBox3.text + " ','" + TextBox4.text + " ','" + TextBox5.text + " ')", connection);

//

//

iF (connection.State == connectionstat to.Closed)

{

connection.Open();

}

command.ExecuteNonQuery();

try

{

iF (connection.State == connectionstat to.Closed)

{

connection.Open();

}

OleDbCommand update = new OleDbCommand("update tool set status = '"+"Loan"+"'where plate ='"+combobox2.text+"'",connection);

update.ExecuteNonQuery();

it is uygunaracdol();

}

catcher (Exception)

{

throw;

}

MessageBox.show("Your Add Was Successful");

connection.Close();

fill();

}

catcher (Exception error)

{

MessageBox.show(error.Message);

}

}

private void button3_Click(oBJECT cents, eventArgs to)

{

DialogResult reply;

reply = MessageBox.show("Are you sure you want to delete the record", "Warning", messageboxbuttons.yesno, the messageboxıco.Question);

iF (reply == DialogResult.Yes && datagridview1.currentrow.Cells(0).value.toString().Agriculture() ! = "")

{

try

{

iF (connection.State == connectionstat to.Closed)

{

connection.Open();

}

OleDbCommand delete = new OleDbCommand("delete from rental where license plate = '" + datagridview1.currentrow.Cells(2nd).value.toString() + " '", connection);

delete.ExecuteNonQuery();

it is uygunaracdol();

it is musteridol();

MessageBox.show("Your Delete Was Successful");

fill();

connection.Close();

}

catcher

{

;

}

}

}

private void textbox7_textchanged(oBJECT cents, eventArgs to)

{

iF (connection.State==connectionstat to.Closed)

{

connection.Open();

}

dt.Clear();

OleDbDataAdapter adtr = new OleDbDataAdapter("select * From rental where tc like '%" + textbox7.text + "% 'or plate like'%" + textbox7.text + "% 'or shop_date like'%" + textbox7.text + "% 'or data_like like'%" + textbox7.text + "% 'or fee like'%" + textbox7.text + "%", connection);

adtr.fill(dt);

datagridview1.DataSource = dt;

adtr.Dispose();

datagridview1.SelectionMode = in datagridviewselectionmo.FullRowSelect;

datagridview1.Columns(0).Visible = false;

datagridview1.rowheadersvisibl to = false;

datagridview1.Columns(one).width = 80;

datagridview1.Columns(2nd).width = 120;

datagridview1.Columns(3).width = 77;

datagridview1.Columns(4).width = 76;

datagridview1.Columns(5).width = 76;

connection.Close();

combobox2.text = "";

TextBox3.text = "";

TextBox4.text = "";

TextBox5.text = "";

comboBox1.text = "";

}

private void button4_Click(oBJECT cents, eventArgs to)

{

OleDbCommand command = new OleDbCommand("update rental set tc = '"+comboBox1.text+"Plate = '"+combobox2.text+", Alis_tarih U = '"+TextBox3.text+", Veris_tarih U = '"+TextBox4.text+", Wages'"+TextBox5.text+ "'where plate ='" + datagridview1.currentrow.Cells(2nd).value.toString() + " '",connection);

//

iF (connection.State == connectionstat to.Closed)

{

connection.Open();

}

command.ExecuteNonQuery();

connection.Close();

MessageBox.show("Update Successful");

fill();

}

private void datagridview1_cellclick(oBJECT cents, DataGridViewCellEventArgs to)

{

comboBox1.text = datagridview1.currentrow.Cells(one).value.toString();

combobox2.text = datagridview1.currentrow.Cells(2nd).value.toString();

TextBox3.text = datagridview1.currentrow.Cells(3).value.toString();

TextBox4.text = datagridview1.currentrow.Cells(4).value.toString();

TextBox5.text = datagridview1.currentrow.Cells(5).value.toString();

}

private void textbox5_textchanged(oBJECT cents, eventArgs to)

{

}

private void textbox4_textchanged(oBJECT cents, eventArgs to)

{

try

{

datetime dt = datetime.Purse(TextBox4.text);

datetime dt2 = datetime.Purse(TextBox3.text);

Timespan difference = dt dt2;

TextBox5.text = (difference.totaldays * 150).toString();

}

catcher

{

;

}

}

}

}

download bağlantı

Haberin Kaynak Linki

Yapılan Yorumlar

Bir Cevap Yazın

This site uses Akismet to reduce spam. Learn how your comment data is processed.