private void txtMaHangHoa_KeyDown(object sender, KeyEventArgs e) { try { switch (e.KeyCode) { case Keys.Enter: GetHangHoa(txtMaHangHoa.Text); txtSoLuongIn.Focus(); break; case Keys.F4: string tem = string.Empty; if (rdoHH.Checked) { tem = "HH"; } if (rdoTV.Checked) { tem = "TV"; } if (rdoTGT.Checked) { tem = "TGT"; } frmTimKiemHangHoaGoiHang frm = new frmTimKiemHangHoaGoiHang(tem); frm.ShowDialog(); if (Timhanghoa != null) { ThongTinMaVach temp = _dsHangHoaGoiHang.SingleOrDefault(thongTinMaVach => thongTinMaVach.MaHangHoa.ToUpper().Equals(Timhanghoa.MaHangHoa.ToUpper())); temp.GiaNhap = string.IsNullOrEmpty(temp.GiaNhap) ? "0" : temp.GiaNhap; temp.GiaBanBuon = string.IsNullOrEmpty(temp.GiaBanBuon) ? "0" : temp.GiaBanBuon; temp.GiaBanLe = string.IsNullOrEmpty(temp.GiaBanLe) ? "0" : temp.GiaBanLe; Timhanghoa.GiaNhap = string.IsNullOrEmpty(Timhanghoa.GiaNhap) ? temp.GiaNhap : Timhanghoa.GiaNhap; Timhanghoa.GiaBanBuon = string.IsNullOrEmpty(Timhanghoa.GiaBanBuon) ? temp.GiaBanBuon : Timhanghoa.GiaBanBuon; Timhanghoa.GiaBanLe = string.IsNullOrEmpty(Timhanghoa.GiaBanLe) ? temp.GiaBanLe : Timhanghoa.GiaBanLe; txtMaHangHoa.Text = Timhanghoa.MaHangHoa; txtTenHangHoa.Text = Timhanghoa.TenHangHoa; txtGia.Text = string.Format("{0}#{1}#{2}", Timhanghoa.GiaNhap, Timhanghoa.GiaBanBuon, Timhanghoa.GiaBanLe); txtSoLuongIn.Text = "1"; txtSoLuongIn.Focus(); } break; } } catch { } }
private void txtMaHangHoa_KeyDown(object sender, KeyEventArgs e) { try { switch (e.KeyCode) { case Keys.Enter: GetHangHoa(txtMaHangHoa.Text); txtSoLuongIn.Focus(); break; case Keys.F4: string tem = string.Empty; if (rdoHH.Checked) tem = "HH"; if (rdoTV.Checked) tem = "TV"; if (rdoTGT.Checked) tem = "TGT"; frmTimKiemHangHoaGoiHang frm = new frmTimKiemHangHoaGoiHang(tem); frm.ShowDialog(); if (Timhanghoa != null) { ThongTinMaVach temp = _dsHangHoaGoiHang.SingleOrDefault(thongTinMaVach => thongTinMaVach.MaHangHoa.ToUpper().Equals(Timhanghoa.MaHangHoa.ToUpper())); temp.GiaNhap = string.IsNullOrEmpty(temp.GiaNhap) ? "0" : temp.GiaNhap; temp.GiaBanBuon = string.IsNullOrEmpty(temp.GiaBanBuon) ? "0" : temp.GiaBanBuon; temp.GiaBanLe = string.IsNullOrEmpty(temp.GiaBanLe) ? "0" : temp.GiaBanLe; Timhanghoa.GiaNhap = string.IsNullOrEmpty(Timhanghoa.GiaNhap) ? temp.GiaNhap : Timhanghoa.GiaNhap; Timhanghoa.GiaBanBuon = string.IsNullOrEmpty(Timhanghoa.GiaBanBuon) ? temp.GiaBanBuon : Timhanghoa.GiaBanBuon; Timhanghoa.GiaBanLe = string.IsNullOrEmpty(Timhanghoa.GiaBanLe) ? temp.GiaBanLe : Timhanghoa.GiaBanLe; txtMaHangHoa.Text = Timhanghoa.MaHangHoa; txtTenHangHoa.Text = Timhanghoa.TenHangHoa; txtGia.Text = string.Format("{0}#{1}#{2}", Timhanghoa.GiaNhap, Timhanghoa.GiaBanBuon, Timhanghoa.GiaBanLe); txtSoLuongIn.Text = "1"; txtSoLuongIn.Focus(); } break; } } catch { } }