Beispiel #1
0
        private void lbDHC_Click(object sender, EventArgs e)
        {
            string DHC_Ma = lbDHC.SelectedValue.ToString();

            dgvdsTD2.DataSource = XuLyDuLieu.docBang("Select MDC_Loai,MDC_TenMon,MDC_SoLuong,MDC_Gia from MonDaChon,dsDonHangCho where (DHC_Ma=MDC_Ma and MDC_Ma='" + DHC_Ma + "')");
            //dgvdsMonAn.DataSource = XuLyDuLieu.docBang("Select MDC_Loai,MDC_TenMon,MDC_SoLuong,MDC_Gia from HoaDon,MonDaChon where (HD_MaHD=MDC_Ma and HD_MaHD='" + HD_MaHD + "')");
        }
Beispiel #2
0
        private void lbdsMaHD_Click(object sender, EventArgs e)
        {
            string HD_MaHD = lbdsMaHD.SelectedValue.ToString();

            dgvdsDSHonHang.DataSource = XuLyDuLieu.docBang("Select * from HoaDon where (HD_MaHD='" + HD_MaHD + "')");
            dgvdsMonAn.DataSource     = XuLyDuLieu.docBang("Select MDC_Loai,MDC_TenMon,MDC_SoLuong,MDC_Gia from HoaDon,MonDaChon where (HD_MaMDC=MDC_Ma and HD_MaHD='" + HD_MaHD + "')");
        }
Beispiel #3
0
        private void QuanLyDatHang_Load(object sender, EventArgs e)
        {
            lbdsMaHD.DataSource = XuLyDuLieu.docBang("Select * from HoaDon");
            //lbdsMaHD.DataSource = dsChiNhanh;
            lbdsMaHD.DisplayMember = "HD_MaMDC";
            lbdsMaHD.ValueMember   = "HD_MaHD";

            lbDHC.DataSource    = XuLyDuLieu.docBang("Select *from dsDonHangCho");
            lbDHC.DisplayMember = "DHC_Ma";
            lbDHC.ValueMember   = "DHC_MaTD";

            /*dsDonHang = XuLyDuLieu.docBang("Select * from ThongTinHoaDon");
             * dsDonHangView = new DataView(dsDonHang);
             * dgvdsDSHonHang.DataSource = dsDonHangView;*/
            //dsMonAn = XuLyDuLieu.docBang("Select * from dsMon");
            //dsMonAnView = new DataView(dsMonAn);
            //dgvdsMonAn.DataSource = dsMonAnView;
            //dsChiNhanh = XuLyDuLieu.docBang("Select * from CHINHANH");
            //dsChiNhanhView = new DataView(dsChiNhanh);
            //dgvdsChiNhanh.DataSource = dsChiNhanhView;
            dsKhach     = XuLyDuLieu.docBang("Select * from ThongTinKhach");
            dsKhachView = new DataView(dsKhach);
            dgvdsKhachHang.DataSource = dsKhachView;
            dgvdsKhach2.DataSource    = dsKhachView;

            Bingding();



            dsMonAn               = XuLyDuLieu.docBang("Select * from dsMon");
            dsMonAnView           = new DataView(dsMonAn);
            dgvThucDon.DataSource = dsMonAnView;

            dsMonChon = XuLyDuLieu.docBang("Select *from MonDaChon");
            dgvCacMonChon.DataSource = dsMonChon;

            dsDonHang = XuLyDuLieu.docBang("Select *from HoaDon");
            dgvdsDonHang2.DataSource = dsDonHang;
            dgvdsDonHang3.DataSource = dsDonHang;
            dgvdsDonHang5.DataSource = dsDonHang;



            dsDonHangChoDuyet        = XuLyDuLieu.docBang("Select HD_MaHD,HD_MaCN,HD_DiaCHi from HoaDon");
            dgvdsDonHang4.DataSource = dsDonHangChoDuyet;

            dsChiNhanh = XuLyDuLieu.docBang("Select *from dsChiNhanh");
            dgvdsChiNhanh2.DataSource = dsChiNhanh;


            BindingDHC();

            /*int sum = 0;
             * for (int i = 0; i < lvCMDC.Rows.Count; i++)
             * {
             *  sum += Convert.ToInt32(lvCMDC.Rows[i].Cells[3].Value);
             * }
             * textBox1.Text = sum.ToString();*/
        }
Beispiel #4
0
 private void bt_xoaThongtin_Click(object sender, EventArgs e)
 {
     if (dgvdsKhach2.SelectedRows.Count > 0)
     {
         DataRow dh = ((DataRowView)dgvdsKhach2.SelectedRows[0].DataBoundItem).Row;
         dh.Delete();
         XuLyDuLieu.ghiBang("ThongTinKhach", dsKhach);
     }
 }
Beispiel #5
0
        private void bt_themThongtin_Click(object sender, EventArgs e)
        {
            DataRow dh = dsKhach.NewRow();

            dh["HoTenKhach"] = TT_Ten.Text;
            dh["DiaCHi"]     = TT_DiaChi.Text;
            dh["SDT"]        = TT_SDT.Text;
            dh["SoLanDat"]   = TT_SoLan.Text;

            dsKhach.Rows.Add(dh);

            XuLyDuLieu.ghiBang("ThongTinKhach", dsKhach);
        }
Beispiel #6
0
 private void dsMonan_Load(object sender, EventArgs e)
 {
     ds = DocDSLOP();
     dataGridView1.DataSource = ds;
     MonBo      = Docmon();
     MonChay    = DocMonchay();
     DoanhthuCN = Doanhthucn();
     SLDH       = Donhang();
     //-----
     dsKhach     = XuLyDuLieu.docBang("select * from thongtinkhach");
     dsKhachView = new DataView(dsKhach);
     dgvdsKhachHang.DataSource = dsKhachView;
 }
Beispiel #7
0
        private void bt_DuyetDH_Click(object sender, EventArgs e)
        {
            DataRow dh = dsDonHang.NewRow();

            dh["HD_MaHD"]      = DHC_Ma.Text;
            dh["HD_TenKhach"]  = DHC_tbTen.Text;
            dh["HD_DiaCHi"]    = DHC_tbDiaChi.Text;
            dh["HD_SDT"]       = DHC_tbSDT.Text;
            dh["HD_MaMDC"]     = DHC_MaTD.Text;
            dh["HD_TinhTrang"] = DHC_TinhTrang.Text;

            dsDonHang.Rows.Add(dh);

            XuLyDuLieu.ghiBang("HoaDon", dsDonHang);
        }
Beispiel #8
0
 private void bt_suaThongTin_Click(object sender, EventArgs e)
 {
     if (dgvdsKhach2.SelectedRows.Count > 0)
     {
         DataRow dh = ((DataRowView)dgvdsKhach2.SelectedRows[0].DataBoundItem).Row;
         dh["HoTenKhach"] = TT_Ten.Text;
         dh["DiaCHi"]     = TT_DiaChi.Text;
         dh["SDT"]        = TT_SDT.Text;
         dh["SoLanDat"]   = TT_SoLan.Text;
         XuLyDuLieu.ghiBang("ThongTinKhach", dsKhach);
     }
     else
     {
         MessageBox.Show("Chua Chon Don Hang", "Thong Bao", MessageBoxButtons.OK);
     }
 }
Beispiel #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataRow dh = dsDonHang.NewRow();

            dh["HD_MaHD"]     = tbMa.Text;
            dh["HD_DiaCHi"]   = tbDiaChi.Text;
            dh["HD_TenKhach"] = tbTenKhach.Text;
            dh["HD_SDT"]      = tbSDT.Text;
            dh["HD_Gia"]      = tbTongTien.Text;


            dsDonHang.Rows.Add(dh);

            XuLyDuLieu.ghiBang("HoaDon", dsDonHang);

            MessageBox.Show("Bạn Đã Tạo Đơn Hàng Thành Công!!", "Thong Bao", MessageBoxButtons.OK);
        }
Beispiel #10
0
        /*private void btThemDHC_Click(object sender, EventArgs e)
         * {
         *  DataRow dh = dsDonHang.NewRow();
         *  dh["HD_MaHD"] = DHC_Ma.Text;
         *  dh["HD_TenKhach"] = DHC_tbTen.Text;
         *  dh["HD_DiaCHi"] =  DHC_tbDiaChi.Text;
         *  dh["HD_SDT"] = DHC_tbSDT.Text;
         *  dh["HD_MaMDC"] = DHC_MaTD.Text;
         *  dh["HD_TinhTrang"] = DHC_TinhTrang.Text;
         *
         *  dsDonHang.Rows.Add(dh);
         *
         *  XuLyDuLieu.ghiBang("HoaDon", dsDonHang);
         * }*/

        private void CDH_btSua_Click(object sender, EventArgs e)
        {
            if (dgvdsDonHang3.SelectedRows.Count > 0)
            {
                DataRow dh = ((DataRowView)dgvdsDonHang3.SelectedRows[0].DataBoundItem).Row;
                dh["HD_MaHD"]     = CDH_Ma.Text;
                dh["HD_DiaCHi"]   = CDH_DiaChi.Text;
                dh["HD_MaCN"]     = CDH_CN.Text;
                dh["HD_TenKhach"] = CDH_Ten.Text;
                dh["HD_SDT"]      = CDH_SDT.Text;
                dh["HD_MaMDC"]    = CDH_MaMDC.Text;
                XuLyDuLieu.ghiBang("HoaDon", dsDonHang);
            }
            else
            {
                MessageBox.Show("Chua Chon Don Hang", "Thong Bao", MessageBoxButtons.OK);
            }
        }
Beispiel #11
0
 private void btSuaDH_Click(object sender, EventArgs e)
 {
     if (dgvdsDSHonHang.SelectedRows.Count > 0)
     {
         DataRow dh = ((DataRowView)dgvdsDSHonHang.SelectedRows[0].DataBoundItem).Row;
         dh["HD_MaHD"]      = tbDHMaDH.Text;
         dh["HD_DiaCHi"]    = tbDHDiaChi.Text;
         dh["HD_MaCN"]      = tbDHMaCN.Text;
         dh["HD_TenKhach"]  = tbDHTen.Text;
         dh["HD_SDT"]       = tbDHSDT.Text;
         dh["HD_Gia"]       = tbDHTien.Text;
         dh["HD_TinhTrang"] = tbDHTinhTrang.Text;
         XuLyDuLieu.ghiBang("HoaDon", dsDonHang);
     }
     else
     {
         MessageBox.Show("Chua Chon Don Hang", "Thong Bao", MessageBoxButtons.OK);
     }
 }
Beispiel #12
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (dgvdsDonHang5.SelectedRows.Count > 0)
            {
                DataRow dh = ((DataRowView)dgvdsDonHang5.SelectedRows[0].DataBoundItem).Row;
                dh["HD_MaHD"]      = TD_MaDH.Text;
                dh["HD_DiaCHi"]    = TD_DiaChi.Text;
                dh["HD_MaCN"]      = TD_MaCN.Text;
                dh["HD_TenKhach"]  = TD_Ten.Text;
                dh["HD_SDT"]       = TD_SDT.Text;
                dh["HD_Gia"]       = TD_Gia.Text;
                dh["HD_TinhTrang"] = TD_TinhTrang.Text;
                XuLyDuLieu.ghiBang("HoaDon", dsDonHang);

                MessageBox.Show("Đã thay đổi tình trạng đơn hàng", "Thong Bao", MessageBoxButtons.OK);
            }
            else
            {
                MessageBox.Show("Chua Chon Don Hang", "Thong Bao", MessageBoxButtons.OK);
            }
        }
Beispiel #13
0
        private void lbdsMaHD_Click(object sender, EventArgs e)
        {
            string HD_MaHD = lbdsMaHD.SelectedValue.ToString();

            dgvdsDSHonHang.DataSource = XuLyDuLieu.docBang("Select * from HoaDon where (HD_MaHD='" + HD_MaHD + "')");
            //dgvdsMonAn.DataSource = XuLyDuLieu.docBang("Select MDC_Loai,MDC_TenMon,MDC_SoLuong,MDC_Gia from HoaDon,MonDaChon where (HD_MaHD=MDC_Ma and HD_MaHD='" + HD_MaHD + "')");

            tbDHMaDH.DataBindings.Clear();
            tbDHMaDH.DataBindings.Add("text", lbdsMaHD.DataSource, "HD_MaHD");
            tbDHDiaChi.DataBindings.Clear();
            tbDHDiaChi.DataBindings.Add("text", lbdsMaHD.DataSource, "HD_DiaCHi");
            tbDHMaCN.DataBindings.Clear();
            tbDHMaCN.DataBindings.Add("text", lbdsMaHD.DataSource, "HD_MaCN");
            tbDHTen.DataBindings.Clear();
            tbDHTen.DataBindings.Add("text", lbdsMaHD.DataSource, "HD_TenKhach");
            tbDHSDT.DataBindings.Clear();
            tbDHSDT.DataBindings.Add("text", lbdsMaHD.DataSource, "HD_SDT");
            tbDHTien.DataBindings.Clear();
            tbDHTien.DataBindings.Add("text", lbdsMaHD.DataSource, "HD_Gia");
            tbDHTinhTrang.DataBindings.Clear();
            tbDHTinhTrang.DataBindings.Add("text", lbdsMaHD.DataSource, "HD_TinhTrang");
        }
Beispiel #14
0
        private void lbDHC_Click(object sender, EventArgs e)
        {
            string DHC_MaTD = lbDHC.SelectedValue.ToString();

            dgvdsTD2.DataSource = XuLyDuLieu.docBang("Select MDC_Ma,MDC_Loai,MDC_TenMon,MDC_SoLuong,MDC_Gia from MonDaChon,dsDonHangCho where (MDC_Ma='" + DHC_MaTD + "')");
        }
Beispiel #15
0
 private void WebDatHang_Load(object sender, EventArgs e)
 {
     dsMon = XuLyDuLieu.docBang("Select *from MonBo");
     dgvdsMonAn3.DataSource = dsMon;
 }