public void saveBomModel(BOM_Model_Model model) { if (model.component_id < 1) { throw new Exception("Please select component first"); } BomModelModelDAO.getInstance().add(model); }
BOM_Model_Model getBomDetail() { BOM_Model_Model model = new BOM_Model_Model { component_id = getDecimalFromTextBox(txtComponentId), model_name = txtComponentModelName.Text, model_value = getDecimalFromTextBox(txtComponentModelQuantity) }; return(model); }
async Task updateBomModel(BOM_Model_Model model) { String message = "Update bom model successfully"; try { BomModelService.getInstance().updateBomModel(model); await reloadBomModel(); }catch (Exception e) { message = e.Message; } MessageBox.Show(message); }
async Task deleteBomModelAsync(BOM_Model_Model model) { string message = "model delete successfully"; try { //BomModelModelDAO.getInstance().delete(model); BomModelService.getInstance().delete(model); await reloadBomModel(); }catch (Exception e) { message = e.Message; } MessageBox.Show(message); }
public void delete(BOM_Model_Model model) { if (model.component_id < 1) { throw new Exception("Please select component first"); } if (String.IsNullOrEmpty(model.model_name) || String.IsNullOrWhiteSpace(model.model_name)) { throw new Exception("No model was delete"); } if (!BomModelModelDAO.getInstance().delete(model)) { throw new Exception("Cannot delete model"); } }
public void updateBomModel(BOM_Model_Model model) { if (model.component_id < 1) { throw new Exception("Invalid component"); } if (String.IsNullOrEmpty(model.model_name) || String.IsNullOrWhiteSpace(model.model_name)) { throw new Exception("Invalid model name"); } if (model.model_value < 0) { throw new Exception("Model value must greater than 0"); } BomModelModelDAO.getInstance().update(model); }
private async void btnUpdateModel_Click(object sender, EventArgs e) { BOM_Model_Model model = getBomDetail(); await updateBomModel(model); }