private void BtnXoa_ItemClick(object sender, ItemClickEventArgs e) { if (XtraMessageBox.Show("Bạn có chắc chắn muốn xóa ?", "CẢNH BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } int rowIndex = gvMain.FocusedRowHandle; string colID = "Currency_ID"; string value = gvMain.GetRowCellValue(rowIndex, colID).ToString(); if (BUS_TienTe.KiemTraTienTe(value) == true) { BUS_TienTe.XoaTienTe(value); Action.Module = "Tiền Tệ"; Action.ActionName = "Xóa"; Action.Reference = value; Action.LuuThongTin(); LoadData(); } else { return; } }
private void xlThem() { CTyGia tg = new CTyGia(txtMa.Text, txtTen.Text, float.Parse(calcTyGia.Value.ToString()), ceConQL.Checked); BUS_TienTe.ThemTienTe(tg); sendTG(); Action.Module = "Tỷ Giá"; Action.ActionName = "Thêm"; Action.Reference = txtMa.Text; Action.LuuThongTin(); this.Close(); }
private void xlSua() { editTyGia.MaTienTe = txtMa.Text; editTyGia.TenTienTe = txtTen.Text; editTyGia.TyGia = float.Parse(calcTyGia.Value.ToString()); editTyGia.ConQL = ceConQL.Checked; BUS_TienTe.SuaTienTe(editTyGia); sendTG(); Action.Module = "Tỷ Giá"; Action.ActionName = "Sửa"; Action.Reference = txtMa.Text; Action.LuuThongTin(); Close(); }
private void BtnLuu_Click(object sender, EventArgs e) { if (txtTen.Text == "") { error.SetError(txtTen, "Vui lòng điền thông tin !"); } else { error.SetError(txtTen, string.Empty); } if (txtMa.Text == "") { error.SetError(txtMa, "Vui lòng điền thông tin !"); } else if (add == true && BUS_TienTe.KiemTraTienTe(txtMa.Text)) { error.SetError(txtMa, "Mã đã tồn tại, vui lòng chọn mã khác !"); } else { error.SetError(txtMa, string.Empty); } if (error.GetError(txtMa) == "" && error.GetError(txtTen) == "") { if (add == true) { xlThem(); } else { xlSua(); } } }
private void LoadData() { gcMain.DataSource = BUS_TienTe.LayTienTe(); }