Mã:
//File này ở form 1using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;namespace Quanlydulich{ #region "Chuong trinh chinh!" public partial class Form1 : Form { public Form1() { InitializeComponent(); } Data dt = new Data(); int t ,u; private void Form1_Load(object sender, EventArgs e) { dt.ketnoi(); hien(); hiennhap(false); hienbutton(true); } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (t == 0 || t == 1) u = 1; int row = e.RowIndex; txtmatour.Text = dt.mydt.Rows[row]["MaTour"].ToString(); cbbdkh.Text = dt.mydt.Rows[row]["DiemKhoiHanh"].ToString(); cbbdkt.Text = dt.mydt.Rows[row]["DiemKetThuc"].ToString(); dtpkh.Text = dt.mydt.Rows[row]["ThoiGianKhoiHanh"].ToString(); dtpkt.Text = dt.mydt.Rows[row]["ThoiGianKetThuc"].ToString(); txtndk.Text = dt.mydt.Rows[row]["NguoiDangKy"].ToString(); txtdt.Text = dt.mydt.Rows[row]["DienThoai"].ToString(); cbbpt.Text = dt.mydt.Rows[row]["PhuongTien"].ToString(); txtsln.Text = dt.mydt.Rows[row]["SoLuongNguoi"].ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void lammoi() { txtdt.Clear(); txtmatour.Clear(); txtndk.Clear(); txtsln.Clear(); cbbdkh.Text= ""; cbbdkt.Text = ""; cbbpt.Text = ""; } private void hiennhap(bool edit) { txtmatour.Enabled = edit; txtsln.Enabled = edit; cbbpt.Enabled = edit; cbbdkt.Enabled = edit; cbbdkh.Enabled = edit; dtpkh.Enabled = edit; dtpkt.Enabled = edit; txtndk.Enabled = edit; txtdt.Enabled = edit; } private void hienbutton(bool edit) { btnthem.Visible = edit; btnsua.Visible = edit; btnxoa.Visible = edit; btnluu.Visible = !edit; btnhuy.Visible = !edit; } private void hien() { dt.datagrid("SELECT * FROM Tour"); this.dataGridView1.DataSource = dt.mydt; this.dataGridView1.AutoGenerateColumns = false; } private void btnthem_Click(object sender, EventArgs e) { lammoi(); hiennhap(true); hienbutton(false); txtmatour.Focus(); t = 0; } private void btnsua_Click(object sender, EventArgs e) { hienbutton(false); hiennhap(true); txtmatour.Enabled = false; t = 1; } private void btnxoa_Click(object sender, EventArgs e) { if (u != 1) MessageBox.Show("Chưa chọn dữ liệu!", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); else if (MessageBox.Show("Bạn có muốn xóa không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { dt.command("DELETE FROM Tour WHERE MaTour='" + txtmatour.Text + "'"); dt.xoamyds(); hien(); lammoi(); } } private void btnluu_Click(object sender, EventArgs e) { if(t==0) { dt.command("INSERT INTO Tour(MaTour,DiemKhoiHanh,DiemKetThuc,ThoiGianKhoiHanh,ThoiGianKetThuc,NguoiDangKy,DienThoai,PhuongTien,SoLuongNguoi)" + "VALUES('" + txtmatour.Text + "','" + cbbdkh.Text + "','" + cbbdkt.Text + "','" + dtpkh.Value.Date + "','" + dtpkt.Value.Date + "','" + txtndk.Text + "','" + txtdt.Text + "','" + cbbpt.Text + "','" + txtsln.Text + "')"); dt.xoamyds(); hien(); hienbutton(true); hiennhap(false); } else if(t==1) { dt.command("UPDATE Tour SET Matour='" + txtmatour.Text + "',DiemKhoiHanh='" + cbbdkh.Text + "',DiemKetThuc='" + cbbdkt.Text + "',ThoiGianKhoiHanh='" + dtpkh.Value.Date + "',ThoiGianKetThuc='" + dtpkt.Value.Date + "',NguoiDangKy='" + txtndk.Text + "',DienThoai='" + txtdt.Text + "',PhuongTien='" + cbbpt.Text + "',SoLuongNguoi='" + txtsln.Text + "' WHERE MaTour='"+txtmatour.Text+"' "); dt.xoamyds(); hien(); hienbutton(true); hiennhap(false); t = -1; } } private void btnhuy_Click(object sender, EventArgs e) { lammoi(); hiennhap(false); hienbutton(true); } } #endregion} //File này ở Class Data của mìnhusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data;using System.Data.OleDb;using System.Windows.Forms;namespace Quanlydulich{ #region "Access" public class Data { public OleDbConnection mycon; public OleDbDataAdapter myda; public DataSet myds; public DataTable mydt; private OleDbCommand mycom; public void ketnoi() { try { mycon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=abc.mdb"); mycon.Open(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } public void ngatketnoi() { mycon.Close(); } public void command(string luusql) { mycom = new OleDbCommand(luusql, mycon); mycom.ExecuteNonQuery(); } public void xoamyds() { myds.Clear(); } public void datagrid(string all) { myda = new OleDbDataAdapter(all, mycon); myds = new DataSet(); myda.Fill(myds, "Tour"); mydt = myds.Tables["Tour"]; } }#endregion}
Rocket 1h là thực phẩm chức năng giúp tăng cường sinh lý nam có nguồn gốc hoàn toàn từ dược liệu tự nhiên. Rất nhiều nam giới đã tuyển lựa Rocket 1h như một phương thuốc hữu hiệu để cải thiện tình...
Nguyên nhân của cặp đôi nam nữ mua...