//Load lại thông tin trên Form private void LoadDataSauLuu(bool chinhsua) //Là True nếu thêm mới, False là chỉnh sửa. { while (dgvDaChon.RowCount > 0) { dgvDaChon.Rows.RemoveAt(0); } while (dgvChuaChon.RowCount > 0) { dgvChuaChon.Rows.RemoveAt(0); } if (chinhsua) { LoadChinhSua(); } else { if (manx.Contains("N")) //Phiếu nhập. { manx = myme.MaTuTang("N", nxBAL.MaCuoiCung("N"), 15); } else { manx = myme.MaTuTang("X", nxBAL.MaCuoiCung("X"), 15); } LoadThemMoi(); } //Load Gridview nxBAL.LoadGridViewChonHang(dgvDaChon, dgvChuaChon, manx); dgvDaChon.ClearSelection(); dgvChuaChon.ClearSelection(); AddSTT(); }
private void btnThemN_Click(object sender, EventArgs e) { FormNhapXuat.manx = myme.MaTuTang("N", nxBAL.MaCuoiCung("N"), 15); FormNhapXuat frm = new FormNhapXuat(); frm.ShowDialog(); nxBAL.LoadGridView(dgvNhap, "N"); ChonDenDong(dgvNhap, FormNhapXuat.manx); NhapBindingData(); }
private void ManagerControl(string trangthai) { if (trangthai == "binhthuong") { dgvHangHoa.Enabled = true; txtTen.ReadOnly = nmrSL.ReadOnly = txtDVT.ReadOnly = nmrGN.ReadOnly = nmrGX.ReadOnly = txtGhiChu.ReadOnly = true; nmrSL.Increment = nmrGN.Increment = nmrGX.Increment = 0; btnThem.Visible = btnSua.Visible = true; btnLuu.Enabled = false; btnXoa.Text = "XÓA"; } if (trangthai == "them") { dgvHangHoa.Enabled = false; txtTen.ReadOnly = nmrSL.ReadOnly = txtDVT.ReadOnly = nmrGN.ReadOnly = nmrGX.ReadOnly = txtGhiChu.ReadOnly = false; nmrSL.Increment = 1; nmrGN.Increment = nmrGX.Increment = 100; txtTen.Text = txtDVT.Text = txtGhiChu.Text = string.Empty; nmrSL.Value = nmrGN.Value = nmrGX.Value = 0; txtMa.Text = myme.MaTuTang("H", hhBAL.MaCuoiCung(), 10); btnThem.Visible = btnSua.Visible = false; btnLuu.Enabled = true; btnXoa.Text = "HỦY"; } if (trangthai == "sua") { dgvHangHoa.Enabled = false; txtTen.ReadOnly = nmrSL.ReadOnly = txtDVT.ReadOnly = nmrGN.ReadOnly = nmrGX.ReadOnly = txtGhiChu.ReadOnly = false; nmrSL.Increment = 1; nmrGN.Increment = nmrGX.Increment = 100; btnThem.Visible = btnSua.Visible = false; btnLuu.Enabled = true; btnXoa.Text = "HỦY"; } }
/// <summary> /// Trạng thái của các buuton và textbox. /// </summary> /// <param name="trangthai">binhthuong/them/sua</param> private void ManagerControl(string trangthai) { if (trangthai == "binhthuong") { dgvKhachHang.Enabled = true; txtTen.ReadOnly = txtSDT.ReadOnly = txtDiaChi.ReadOnly = txtGhiChu.ReadOnly = true; btnThem.Visible = btnSua.Visible = true; btnLuu.Enabled = false; btnXoa.Text = "XÓA"; } if (trangthai == "them") { dgvKhachHang.Enabled = false; txtTen.ReadOnly = txtSDT.ReadOnly = txtDiaChi.ReadOnly = txtGhiChu.ReadOnly = false; txtMa.Text = myme.MaTuTang("K", khBAL.MaCuoiCung(), 10); txtTen.Text = txtSDT.Text = txtDiaChi.Text = txtGhiChu.Text = string.Empty; btnThem.Visible = btnSua.Visible = false; btnLuu.Enabled = true; btnXoa.Text = "HỦY"; } if (trangthai == "sua") { dgvKhachHang.Enabled = false; txtTen.ReadOnly = txtSDT.ReadOnly = txtDiaChi.ReadOnly = txtGhiChu.ReadOnly = false; btnThem.Visible = btnSua.Visible = false; btnLuu.Enabled = true; btnXoa.Text = "HỦY"; } }