private void btnLuu_Click(object sender, EventArgs e) { if (checkText() == true) { if (check_flag == true) { dtoPHONGBENH = new DTO_PhongBenh(txtMaphong.Text, txtVitri.Text); if (busPHONGBENH.Add(dtoPHONGBENH) == true) { XtraMessageBox.Show("Thêm phòng bệnh " + txtMaphong.Text + " thành công!"); if (addPhong != null) { addPhong(this, new EventArgs()); } } else { XtraMessageBox.Show("Thêm phòng bệnh không thành công!!!"); } } else { if (checkText() == true) { dtoPHONGBENH = new DTO_PhongBenh(txtMaphong.Text, txtVitri.Text); if (busPHONGBENH.Update(dtoPHONGBENH) == true) { XtraMessageBox.Show("Sửa phòng bệnh " + txtMaphong.Text + " thành công!"); if (updatePhong != null) { updatePhong(this, new EventArgs()); } } else { XtraMessageBox.Show("Sửa phòng bệnh không thành công!!!"); } } else { XtraMessageBox.Show("Chọn dòng cần sửa!"); } } refreshAll(); LockControls(); HienThi(); } else { XtraMessageBox.Show("Chưa nhập đủ dữ liệu!"); } }
public bool Add(DTO_PhongBenh dto) { try { string sql = string.Format("INSERT INTO[dbo].[PHONGBENH]([MAPHONG],[VITRI])" + "VALUES('{0}', N'{1}')", dto.MAPHONG1, dto.VITRI1); db.ExecuteNonQuery(sql); return(true); } catch (Exception ex) { return(false); } }
public bool Update(DTO_PhongBenh dto) { try { string sql = string.Format("UPDATE [dbo].[PHONGBENH]" + "SET[VITRI] = N'{0}'" + "WHERE MAPHONG = '{1}'", dto.VITRI1, dto.MAPHONG1); db.ExecuteNonQuery(sql); return(true); } catch (Exception ex) { return(false); } }
public bool Update(DTO_PhongBenh dto) { return(dal.Update(dto)); }
public bool Add(DTO_PhongBenh dto) { return(dal.Add(dto)); }