private void btnSua_Click(object sender, EventArgs e) { float soTienNgay; bool isfloatNgay = float.TryParse(txtMTNgay.Text.Trim().ToString(), out soTienNgay); float soTienThang; bool isfloatThang = float.TryParse(txtMTThang.Text.Trim().ToString(), out soTienThang); if (!isfloatNgay || float.Parse(txtMTNgay.Text) < 0) { MessageBox.Show("Bạn phải nhập mục tiêu ngày", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtMTNgay.Focus(); return; } else if (!isfloatThang || float.Parse(txtMTThang.Text) < 0) { MessageBox.Show("Bạn phải nhập mục tiêu tháng", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); txtMTThang.Focus(); return; } else { DTO_MucTieu mt = new DTO_MucTieu(txtMaMT.Text, float.Parse(txtMTNgay.Text), float.Parse(txtMTThang.Text), dtpkNgay.Value, txtMoTa.Text); if (busMucTieu.InsertMucTieu(mt)) { MessageBox.Show("Sửa thành công"); ResetValues(); LoadGridView_MucTieu(); } else { MessageBox.Show("Sửa không thành công"); } } }
public bool UpdateMucTieu(DTO_MucTieu mt) { return(dalMucTieu.UpdatetMucTieu(mt)); }
public bool InsertMucTieu(DTO_MucTieu mt) { return(dalMucTieu.InsertMucTieu(mt)); }