コード例 #1
0
        private void thanhToánToolStripMenuItem_Click(object sender, EventArgs e)
        {
            QuanLyHoaDon qlhd = new QuanLyHoaDon();

            this.Hide();
            qlhd.Show();
        }
コード例 #2
0
        private void btnDathang_Click(object sender, EventArgs e)
        {
            Connect conn = new Connect();

            conn.ThucThiDl("insert into hoadon values ('" + txtMaHoaDon.Text + "','" + cbkhanhhang.SelectedValue + "','" + cbNhanvien.SelectedValue + "','" + datetimeLHD.Value + "','" + 0 + "' )");
            for (int i = 0; i < lstchitiet.Items.Count; i++)
            {
                string masp = conn.XemDL("select masanpham from sanpham where tensanpham = N'" + lstchitiet.Items[i].ToString().Trim() + "' ").Rows[0][0].ToString().Trim();
                string tien = conn.XemDL("select giasanpham from sanpham where masanpham='" + masp + "'").Rows[0][0].ToString().Trim();
                conn.ThucThiDl("insert into CTHD values ('" + txtMaHoaDon.Text.ToString().Trim() + "','" + masp + "','" + 1 + "','" + Convert.ToInt32(tien) + "')");
                MessageBox.Show("Thêm thành công");
            }
            QuanLyHoaDon.MaHD = txtMaHoaDon.Text.Trim();
            QuanLyHoaDon frm = new QuanLyHoaDon();

            this.Hide();
            frm.ShowDialog();
        }