private bool Save() { if (!IsFieldValueValid()) { return(false); } bool success = false; try { SupplierEntity editEntity = PrepareSave(); int ret = supplierDal.Save(editEntity, isNew); if (ret == -1) { MsgBox.Warn("供应商编号已存在,请改为其他的编号。"); } else if (ret == -2) { MsgBox.Warn("更新失败,该行已经被其他人删除。"); } else { success = true; if (DataSourceChanged != null) { DataSourceChanged(editEntity, null); } } } catch (Exception ex) { MsgBox.Warn(ex.Message); } return(success); }