public void LoadComboBoxPhieuDatHang(ComboBox cmb) { cmb.DataSource = data.LayPDH(); cmb.DisplayMember = "MAPHIEUDATHANG"; cmb.ValueMember = "MAPHIEUDATHANG"; cmb.SelectedValue = "MAPHIEUDATHANG"; }
public void Luu_PhieuDatHang(TextBox MaPDH, ComboBox MaNCC, ComboBox MaNV, DateTimePicker NgayLap) { PhieuDatHangData PDHDATA = new PhieuDatHangData(); DataTable dt = PDHDATA.LayPDH(); DataRow row = dt.NewRow(); row[0] = MaPDH.Text; row[1] = MaNCC.SelectedValue.ToString(); row[2] = MaNV.SelectedValue.ToString(); row[3] = NgayLap.Value.Date; dt.Rows.Add(row); PDHDATA.Update(); }
public void HienThiListView(ListView listview) { listview.Items.Clear(); PhieuDatHangData datapdh = new PhieuDatHangData(); DataTable dtb = datapdh.LayPDH(); int n = 0; foreach (DataRow row in dtb.Rows) { ListViewItem item = new ListViewItem(); n++; item.Text = n.ToString(); item.SubItems.Add(row["MAPHIEUDATHANG"].ToString()); item.SubItems.Add(ctrlNCC.LoadListViewSubItemNhaCungCap(row["MANCC"].ToString())); item.SubItems.Add(ctrlNV.LoadListViewSubItemNhanVien(row["MANV"].ToString())); item.SubItems.Add(row["NGAYLAP"].ToString()); listview.Items.Add(item); } }