public bool ThuocInsert(ThuocEntites obj) { var dal = new ThuocDAL(); if (dal.ThuocInsert(obj)) return true; return false; }
public bool ThuocUpdate(ThuocEntites obj) { var dal = new ThuocDAL(); if (dal.ThuocUpDate(obj)) return true; return false; }
public bool ThuocInsert(ThuocEntites obj) { try { SqlConnection conn = ConnectionDB.GetConnect(); conn.Open(); SqlCommand cmd = new SqlCommand("ThuocInsert", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@MaThuoc", obj.MaThuoc)); cmd.Parameters.Add(new SqlParameter("@TenThuoc", obj.TenThuoc)); cmd.Parameters.Add(new SqlParameter("@SoLuong", obj.SoLuong)); cmd.Parameters.Add(new SqlParameter("@HanSuDung", obj.HanSuDung)); cmd.Parameters.Add(new SqlParameter("@CachSuDung", obj.CachSuDung)); cmd.Parameters.Add(new SqlParameter("@GiaThuoc", obj.GiaThuoc)); cmd.ExecuteNonQuery(); conn.Close(); } catch { return false; } return true; }
ThuocEntites NewThuoc() { ThuocEntites obj = new ThuocEntites(); obj.MaThuoc = txtMaThuoc.Text; obj.TenThuoc = txtTenThuoc.Text; obj.SoLuong = txtSoLuong.Text; obj.HanSuDung = dtHSD.Text; obj.CachSuDung = txtCachSD.Text; obj.GiaThuoc = Convert.ToInt32(txtGia.Text); return obj; }