private void btnDelete_Click(object sender, EventArgs e) { int id = 0; int.TryParse(tbId.Text, out id); if (id != 0) { Supplier currentSupplier = BLSupplier.GetSupplierById(APCContext, id); if (currentSupplier != null) { APCContext.DeleteObject(currentSupplier); APCContext.SaveChanges(); MessageBox.Show("Delete Successfully"); ClearContent(); } else { MessageBox.Show("Supplier Id not found"); } } else { MessageBox.Show("Supplier Id not found"); } }
private void btnUpdate_Click(object sender, EventArgs e) { int id = 0; int.TryParse(tbId.Text, out id); if (id != 0) { Supplier currentSupplier = BLSupplier.GetSupplierById(APCContext, id); if (currentSupplier != null) { currentSupplier.Name = tbName.Text; APCContext.SaveChanges(); MessageBox.Show("Supplier Details Successfully Updated"); ClearContent(); } else { MessageBox.Show("Supplier Id not found"); } } else { MessageBox.Show("Supplier Id not found"); } }
private void btnUpdate_Click(object sender, EventArgs e) { Supplier selectedSupplier = BLSupplier.GetSupplierById(APCContext, int.Parse(cbSupplier.SelectedValue.ToString())); Project selectedProject = BLProject.GetProjectById(APCContext, int.Parse(cbProject.SelectedValue.ToString())); int id = 0; int.TryParse(tbId.Text, out id); if (id != 0) { PO currentPO = BLPO.GetPOById(APCContext, id); if (currentPO != null) { currentPO.Supplier = selectedSupplier; currentPO.Project = selectedProject; APCContext.SaveChanges(); deletePO_Product(currentPO); insertPO_Product(currentPO); MessageBox.Show("PO Details Successfully Updated"); ClearContent(); SetComboToDefault(); } else { MessageBox.Show("PO Id not found"); } } else { MessageBox.Show("PO Id not found"); } }
public frmQuanLyMonAn() { InitializeComponent(); food = new BLFood(); typefood = new BLTypeFood(); supplier = new BLSupplier(); lstTypeFood = new List <cTypeFood>(); lstsupplier = new List <cSupplier>(); LoadData(); }
private void btnInsert_Click(object sender, EventArgs e) { if (BLSupplier.insertSupplier(APCContext, tbName.Text)) { MessageBox.Show("Supplier Successfully Added"); ClearContent(); } else { MessageBox.Show("Please check your input"); } }
private void btnInsert_Click(object sender, EventArgs e) { Supplier selectedSupplier = BLSupplier.GetSupplierById(APCContext, int.Parse(cbSupplier.SelectedValue.ToString())); Project selectedProject = BLProject.GetProjectById(APCContext, int.Parse(cbProject.SelectedValue.ToString())); PO po = BLPO.insertPO(APCContext, selectedSupplier, selectedProject); insertPO_Product(po); MessageBox.Show("PO Successfully Added"); ClearContent(); SetComboToDefault(); }
public List <Supplier> searchById(int id) { if (id != 0) { List <Supplier> supplierList = BLSupplier.GetSupplierListById(APCContext, id); if (supplierList != null) { tbId.Text = supplierList[0].Id.ToString(); tbName.Text = supplierList[0].Name; return(supplierList); } else { MessageBox.Show("Supplier Id not found"); } } else { MessageBox.Show("Supplier Id not found"); } return(null); }