public void RemoveBreakpoint(NuGenBreakpointInformation breakpoint) { GridEXRow row = FindRow(breakpoint); RowDelete(row); row.Delete(); NuGenProject.Instance.IsSaved = false; }
private void btnDeleteItem_Click(object sender, EventArgs e) { GridEXRow currentRow = gridEX1.GetRow(); if (currentRow == null || currentRow.RowType != RowType.Record) { MessageBox.Show("Select the row to delete", "UnboundMode Sample", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } currentRow.Delete(); }
private void btnRemoveItem_Click(object sender, EventArgs e) { //Get selected row GridEXRow item = gridEX1.CurrentRow; if (item != null && item.RowType == RowType.Record) { //Delete the row. item.Delete(); } else { MessageBox.Show("Select an item to delete."); } }
private void RemoveDetails(GridEXRow gridExRow) { string manhacungcap = ""; string NgayHethan = ""; string solo = ""; int id_thuoc = -1; decimal Dongia = 0m; decimal Gianhap = 0m; decimal Giaban = 0m; Int32 soluong = 0; decimal vat = 0m; int isHetHan = 0; long IdThuockho = 0; string ten_thuoc = ""; try { DateTime NgayNhap = Convert.ToDateTime(gridExRow.Cells[TThuockho.Columns.NgayNhap].Value).Date; decimal GiaBhyt = Utility.DecimaltoDbnull(gridExRow.Cells[TThuockho.Columns.GiaBhyt].Value, 0); ten_thuoc = Utility.sDbnull(gridExRow.Cells["TEN_THUOC"].Value); NgayHethan = Utility.sDbnull(gridExRow.Cells["NGAY_HET_HAN"].Value); solo = Utility.sDbnull(gridExRow.Cells[TPhieuNhapxuatthuocChitiet.Columns.SoLo].Value); id_thuoc = Utility.Int32Dbnull(gridExRow.Cells[TThuockho.Columns.IdThuoc].Value, -1); IdThuockho = Utility.Int32Dbnull(gridExRow.Cells[TThuockho.Columns.IdThuockho].Value, -1); Dongia = Utility.DecimaltoDbnull(gridExRow.Cells[TPhieuNhapxuatthuocChitiet.Columns.DonGia].Value, 0); Gianhap = Utility.DecimaltoDbnull(gridExRow.Cells[TThuockho.Columns.GiaNhap].Value, 0); Giaban = Utility.DecimaltoDbnull(gridExRow.Cells[TThuockho.Columns.GiaBan].Value, 0); soluong = Utility.Int32Dbnull(gridExRow.Cells["SO_LUONG"].Value, 0); vat = Utility.DecimaltoDbnull(gridExRow.Cells[TThuockho.Columns.Vat].Value, 0); isHetHan = Utility.Int32Dbnull(gridExRow.Cells["IsHetHan"].Value, 0); manhacungcap = Utility.sDbnull(gridExRow.Cells[TThuockho.Columns.MaNhacungcap].Value, 0); DataRow[] arrDr = m_dtDataThuocKho.Select(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho + "=" + IdThuockho.ToString()); if (arrDr.Length <= 0) { DataRow drv = m_dtDataThuocKho.NewRow(); drv[TPhieuNhapxuatthuocChitiet.Columns.IdThuoc] = id_thuoc; drv["ten_donvitinh"] = Utility.sDbnull(gridExRow.Cells["ten_donvitinh"].Value); drv["IsHetHan"] = isHetHan; DmucThuoc objLDrug = DmucThuoc.FetchByID(id_thuoc); if (objLDrug != null) { drv[DmucThuoc.Columns.TenThuoc] = Utility.sDbnull(objLDrug.TenThuoc); drv[DmucThuoc.Columns.HamLuong] = Utility.sDbnull(objLDrug.HamLuong); drv[DmucThuoc.Columns.HoatChat] = Utility.sDbnull(objLDrug.HoatChat); drv[DmucThuoc.Columns.NuocSanxuat] = Utility.sDbnull(objLDrug.NuocSanxuat); drv[DmucThuoc.Columns.HangSanxuat] = Utility.sDbnull(objLDrug.HangSanxuat); } drv[TPhieuNhapxuatthuocChitiet.Columns.Vat] = vat; drv[TPhieuNhapxuatthuocChitiet.Columns.GiaNhap] = Gianhap; drv[TPhieuNhapxuatthuocChitiet.Columns.MaNhacungcap] = manhacungcap; drv[TPhieuNhapxuatthuocChitiet.Columns.SoLo] = solo; drv[TPhieuNhapxuatthuocChitiet.Columns.IdThuockho] = IdThuockho; drv[TPhieuNhapxuatthuocChitiet.Columns.GiaBan] = Giaban; drv[TPhieuNhapxuatthuocChitiet.Columns.DonGia] = Dongia; drv[TPhieuNhapxuatthuocChitiet.Columns.NgayNhap] = NgayNhap; drv[TPhieuNhapxuatthuocChitiet.Columns.GiaBhyt] = GiaBhyt; drv[TPhieuNhapxuatthuocChitiet.Columns.SoLuong] = soluong; drv[TPhieuNhapxuatthuocChitiet.Columns.ThanhTien] = Gianhap * soluong; drv[TPhieuNhapxuatthuocChitiet.Columns.ChietKhau] = 0; drv[TPhieuNhapxuatthuocChitiet.Columns.NgayHethan] = NgayHethan; drv[TPhieuNhapxuatthuocChitiet.Columns.IdPhieu] = -1; m_dtDataThuocKho.Rows.Add(drv); } else { arrDr[0]["SO_LUONG"] = Utility.Int32Dbnull(arrDr[0]["SO_LUONG"]) + soluong; arrDr[0]["SO_LUONG_THAT"] = arrDr[0]["SO_LUONG"]; m_dtDataThuocKho.AcceptChanges(); } gridExRow.Delete(); grdPhieuXuatChiTiet.UpdateData(); grdPhieuXuatChiTiet.Refresh(); m_dtDataPhieuChiTiet.AcceptChanges(); m_dtDataThuocKho.AcceptChanges(); ModifyCommand(); } catch (Exception ex) { Utility.CatchException(string.Format("Lỗi khi thanh lý thanh lý thuốc {0}:\n", ten_thuoc) , ex); } }
private void RemoveDetails(GridEXRow gridExRow) { string manhacungcap = ""; string NgayHethan = ""; string solo = ""; int id_thuoc = -1; decimal Dongia = 0m; decimal Gianhap = 0m; decimal Giaban = 0m; Int32 soluong = 0; decimal vat = 0m; int isHetHan = 0; long IdThuockho = 0; string ten_thuoc = ""; try { DateTime NgayNhap = Convert.ToDateTime(gridExRow.Cells[TThuockho.Columns.NgayNhap].Value).Date; decimal GiaBhyt = Utility.DecimaltoDbnull(gridExRow.Cells[TThuockho.Columns.GiaBhyt].Value, 0); ten_thuoc = Utility.sDbnull(gridExRow.Cells["TEN_THUOC"].Value); NgayHethan = Utility.sDbnull(gridExRow.Cells["NGAY_HET_HAN"].Value); solo = Utility.sDbnull(gridExRow.Cells[TPhieuNhapxuatthuocChitiet.Columns.SoLo].Value); id_thuoc = Utility.Int32Dbnull(gridExRow.Cells[TThuockho.Columns.IdThuoc].Value, -1); IdThuockho = Utility.Int32Dbnull(gridExRow.Cells[TThuockho.Columns.IdThuockho].Value, -1); Dongia = Utility.DecimaltoDbnull(gridExRow.Cells[TPhieuNhapxuatthuocChitiet.Columns.DonGia].Value, 0); Gianhap = Utility.DecimaltoDbnull(gridExRow.Cells[TThuockho.Columns.GiaNhap].Value, 0); Giaban = Utility.DecimaltoDbnull(gridExRow.Cells[TThuockho.Columns.GiaBan].Value, 0); soluong = Utility.Int32Dbnull(gridExRow.Cells["SO_LUONG"].Value, 0); vat = Utility.DecimaltoDbnull(gridExRow.Cells[TThuockho.Columns.Vat].Value, 0); isHetHan = Utility.Int32Dbnull(gridExRow.Cells["IsHetHan"].Value, 0); manhacungcap = Utility.sDbnull(gridExRow.Cells[TThuockho.Columns.MaNhacungcap].Value, 0); DataRow[] arrDr = m_dtDataThuocKho.Select(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho + "=" + IdThuockho.ToString()); if (arrDr.Length <= 0) { DataRow drv = m_dtDataThuocKho.NewRow(); drv[TPhieuNhapxuatthuocChitiet.Columns.IdThuoc] = id_thuoc; drv["ten_donvitinh"] = Utility.sDbnull(gridExRow.Cells["ten_donvitinh"].Value); drv["IsHetHan"] = isHetHan; DmucThuoc objLDrug = DmucThuoc.FetchByID(id_thuoc); if (objLDrug != null) { drv[DmucThuoc.Columns.TenThuoc] = Utility.sDbnull(objLDrug.TenThuoc); drv[DmucThuoc.Columns.HamLuong] = Utility.sDbnull(objLDrug.HamLuong); drv[DmucThuoc.Columns.HoatChat] = Utility.sDbnull(objLDrug.HoatChat); drv[DmucThuoc.Columns.NuocSanxuat] = Utility.sDbnull(objLDrug.NuocSanxuat); drv[DmucThuoc.Columns.HangSanxuat] = Utility.sDbnull(objLDrug.HangSanxuat); } drv[TPhieuNhapxuatthuocChitiet.Columns.Vat] = vat; drv[TPhieuNhapxuatthuocChitiet.Columns.GiaNhap] = Gianhap; drv[TPhieuNhapxuatthuocChitiet.Columns.MaNhacungcap] = manhacungcap; drv[TPhieuNhapxuatthuocChitiet.Columns.SoLo] = solo; drv[TPhieuNhapxuatthuocChitiet.Columns.SoDky] = Utility.sDbnull(gridExRow.Cells[TPhieuNhapxuatthuocChitiet.Columns.SoDky].Value); drv[TPhieuNhapxuatthuocChitiet.Columns.SoQdinhthau] = Utility.sDbnull(gridExRow.Cells[TPhieuNhapxuatthuocChitiet.Columns.SoQdinhthau].Value); drv[TPhieuNhapxuatthuocChitiet.Columns.IdThuockho] = IdThuockho; drv[TPhieuNhapxuatthuocChitiet.Columns.GiaBan] = Giaban; drv[TPhieuNhapxuatthuocChitiet.Columns.DonGia] = Dongia; drv[TPhieuNhapxuatthuocChitiet.Columns.NgayNhap] = NgayNhap; drv[TPhieuNhapxuatthuocChitiet.Columns.GiaBhyt] = GiaBhyt; drv[TPhieuNhapxuatthuocChitiet.Columns.SoLuong] = soluong; drv[TPhieuNhapxuatthuocChitiet.Columns.ThanhTien] = Dongia * soluong; drv[TPhieuNhapxuatthuocChitiet.Columns.ChietKhau] = 0; drv[TPhieuNhapxuatthuocChitiet.Columns.NgayHethan] = NgayHethan; drv[TPhieuNhapxuatthuocChitiet.Columns.IdPhieu] = -1; m_dtDataThuocKho.Rows.Add(drv); } else { arrDr[0]["SO_LUONG"] = Utility.Int32Dbnull(arrDr[0]["SO_LUONG"]) + soluong; arrDr[0]["SO_LUONG_THAT"] = arrDr[0]["SO_LUONG"]; m_dtDataThuocKho.AcceptChanges(); } gridExRow.Delete(); grdPhieuXuatChiTiet.UpdateData(); grdPhieuXuatChiTiet.Refresh(); m_dtDataPhieuChiTiet.AcceptChanges(); m_dtDataThuocKho.AcceptChanges(); ModifyCommand(); } catch (Exception ex) { Utility.CatchException(string.Format("Lỗi khi thanh lý thanh lý thuốc {0}:\n", ten_thuoc), ex); } }