Пример #1
0
 public void AddData(clsChiTietDonDatHang chiTietDonDatHang)
 {
     if (!_mdlChiTietDonDatHang.AddData(chiTietDonDatHang))
     {
         MessageBox.Show("Thêm chi tiết hóa đơn lỗi", "Thêm chi tiết đơn đặt hàng", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
        ConnectToSQL _conn = new ConnectToSQL();//Initialize connectoSQl class

        public bool AddData(clsChiTietDonDatHang chiTietDonDatHang)
        {
            _conn.CMD.CommandText = String.Format("INSERT [dbo].[tbChiTietDonDatHang] (idDonDatHang,idMaVachSanPham,SoLuong,DonGia,GhiChu)"
                                                  + " VALUES (N'{0}',N'{1}',N'{2}',N'{3}',N'{4}')"
                                                  , chiTietDonDatHang.IdDonDatHang, chiTietDonDatHang.IdMaVachSanPham, chiTietDonDatHang.SoLuong
                                                  , chiTietDonDatHang.DonGia, chiTietDonDatHang.GhiChu);
            return(_conn.ExecuteCMD());
        }
Пример #3
0
        private void AssignChiTietDonDatHang(DataRow row)
        {
            _chiTietDonDatHang = new clsChiTietDonDatHang();

            ///lấy id MaVach SanPham từ view
            int idMaVach = Convert.ToInt32(row["id"].ToString());

            //ChiTietDonDatHang
            _chiTietDonDatHang.IdMaVachSanPham = idMaVach;

            _chiTietDonDatHang.IdDonDatHang = _ctrlDonDatHang.GetIdDonDatHang();

            _chiTietDonDatHang.SoLuong = Convert.ToInt32(row["SoLuong"].ToString());

            _chiTietDonDatHang.DonGia = Convert.ToInt32(row["DonGia"].ToString());

            _chiTietDonDatHang.GhiChu = txtGhiChuDonDatHang.Text;
        }