private void btnOk_Click(object sender, EventArgs e) { this.Dispose(); frmCar view = new frmCar(); view.Show(); }
private void btnOk_Click(object sender, EventArgs e) { SqlConnection conn = connect.Getconect(); conn.Open(); //if (txtCarname.Text != "" && txtCompensAmout.Text != "" && txtRentPrice.Text != "" && txtSuplier.Text != "" && txtUnitPrice.Text != "" && txtRentPrice.Text != "") //{ if (dtpLiquidationDate.Enabled == true) { string sql = "update tblCars set Car_name='" + txtCarname.Text + "',suplier='" + txtSuplier.Text + "',Compens_amout='" + txtCompensAmout.Text + "',Bought_Date='" + dtpBoughtDate.Text + "',UnitPrice='" + txtUnitPrice.Text + "',RentPrice='" + txtRentPrice.Text + "',Liquidation_date='" + dtpLiquidationDate + "',liqidation_reason='" + txtLiquidationreason + "' where car_code='" + frmCar.Code + "'"; SqlCommand cmd = new SqlCommand(sql, conn); SqlDataReader sdr = cmd.ExecuteReader(); MessageBox.Show("Update successfull"); frmCar view = new frmCar(); view.Show(); this.Dispose(); } else { string sql = "update tblCars set Car_name='" + txtCarname.Text + "',suplier='" + txtSuplier.Text + "',Compens_amout='" + txtCompensAmout.Text + "',Bought_Date='" + dtpBoughtDate.Text + "',UnitPrice='" + txtUnitPrice.Text + "',RentPrice='" + txtRentPrice.Text + "'where car_code='" + frmCar.Code + "'"; SqlCommand cmd = new SqlCommand(sql, conn); SqlDataReader sdr = cmd.ExecuteReader(); MessageBox.Show("Update successfull"); frmCar view = new frmCar(); view.Show(); this.Dispose(); } }
private void btnAdd_Click(object sender, EventArgs e) { string carcode = txtCarcode.Text; string carname = txtCarname.Text; string suplier = txtSuplier.Text; string compens = txtCompens.Text; string boughtdate = boughtDate.Text; string Unitprice = txtUnitprice.Text; string rentprice = txtRentprice.Text; SqlConnection conn = connect.Getconect(); conn.Open(); try { if (txtCarcode.Text == "" || txtCarname.Text == "" || txtCompens.Text == "" || txtSuplier.Text == "" || txtUnitprice.Text == "" || txtRentprice.Text == "") { MessageBox.Show("You must enter full information"); } else { string sql = "insert into tblCars values ('" + carcode + "','" + carname + "','" + suplier + "','" + compens + "','" + boughtdate + "','" + Unitprice + "','" + rentprice + "',null,null)"; SqlCommand cmd = new SqlCommand(sql, conn); cmd.ExecuteNonQuery(); MessageBox.Show("Add successfull"); frmCar frm = new frmCar(); frm.Show(); this.Dispose(); } } catch (SqlException ex) { MessageBox.Show(ex.Message); } }
private void managerCarToolStripMenuItem_Click(object sender, EventArgs e) { frmCar car = new frmCar(); car.Show(); this.Hide(); }
private void btnCancel_Click(object sender, EventArgs e) { this.Dispose(); frmCar car = new frmCar(); car.Show(); }