private void btnLuu_Click(object sender, EventArgs e) { if (txtMaPhieu.Text == "") { MessageBox.Show("Bạn chưa nhập mã phiếu yêu cầu! ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (comboBox1.Text == "") { MessageBox.Show("Bạn chưa nhập khách hàng! ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } //if (dtNgayNhap.Value != DateTime.Now) //{ // MessageBox.Show("Bạn nhập sai ngày! ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error); //} PhieuMuonDao obj = new PhieuMuonDao(); obj.MaPM = txtMaPhieu.Text; obj.MaNV = comboBox1.SelectedValue.ToString(); obj.MaSV = comboBox2.SelectedValue.ToString(); obj.NgayMuon = dateTimePicker1.Value; obj.NgayTra = dateTimePicker2.Value; obj.Ghichu = txtGhichu.Text; if (txtMaPhieu.Text != "" && fluu == 0) { try { bis.InsertData(obj); MessageBox.Show("Thêm thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); HienThi(); cboNguoiViet_Load(sender, e); clearData(); DisEnl(false); fluu = 1; } catch (Exception ex) { MessageBox.Show("Lỗi" + ex.Message); } } else if (txtMaPhieu.Text != "" && fluu != 0) { try { bis.UpdateData(obj); MessageBox.Show("Sửa Thành Công ! ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); HienThi(); cboNguoiViet_Load(sender, e); clearData(); DisEnl(false); } catch (Exception ex) { MessageBox.Show("Lỗi" + ex.Message); } } }
public int UpdateData(PhieuMuonDao MA) { SqlParameter[] para = { new SqlParameter("@maphieu", MA.MaPM), new SqlParameter("@manv", MA.MaNV), new SqlParameter("@masv", MA.MaSV), new SqlParameter("@ngaytao", MA.NgayMuon), new SqlParameter("@ngaytra", MA.NgayTra), new SqlParameter("@ghichu", MA.Ghichu), }; return(conn.ExcuteSQL("Update_Phieumuon", para)); }
public int UpdateData(PhieuMuonDao BP) { return(da.UpdateData(BP)); }
public int InsertData(PhieuMuonDao MA) { return(da.InsertData(MA)); }