private void them(object sender, EventArgs e) { if (condition()) { SANPHAM sp = new SANPHAM(); sp.MaDM = Convert.ToInt32(kind.SelectedValue.ToString()); sp.TenSP = tenthuoc.Text; sp.ThanhPhan = thanhphan.Text; sp.CongDung = congdung.Text; sp.LieuLuong = lieuluong.Text; sp.DonVi = donvi.Text; sp.DangThuoc = dangthuoc.Text; sp.HinhAnh = urlanh.Text; sp.MoTa = mota.Text; sp.GiaBan = Convert.ToInt32(dongia.Text); Function.Add("product/addthuoc", sp); clear(); loadGridview(); } }
private void but_edit_Click(object sender, EventArgs e) { if (condition()) { SANPHAM sp = new SANPHAM(); sp.MaSP = Product.data.Rows[Product.iTemp]["MaSP"].ToString(); sp.MaDM = Convert.ToInt32(comboBox1.SelectedValue.ToString()); sp.TenSP = tenthuoc.Text; sp.ThanhPhan = thanhphan.Text; sp.CongDung = congdung.Text; sp.LieuLuong = lieuluong.Text; sp.DonVi = donvi.Text; sp.DangThuoc = dangthuoc.Text; sp.HinhAnh = urlanh.Text; sp.MoTa = mota.Text; sp.GiaBan = Convert.ToInt32(dongia.Text); Function.Edit("product/updatethuoc", sp); MessageBox.Show("Update thành công"); this.Close(); } }