public void deleteOrderByPurchaseOrder(int purchaseorder, int userNo, string message) { string fromemail = StoreSupplierDAO.findEmployeeByCode(userNo).employeeemail; SOrder po = StoreSupplierDAO.findUnapprovedOrderByPurchaseOrder(purchaseorder); string toemail = po.Employee.employeeemail; try { StoreSupplierDAO.deleteOrderByPurchaseOrder(purchaseorder); } catch (Exception e) { throw new SSexception("delete order failed because order not found :" + e.Message); } sendMailToEmployee(String.Format("Order no. {0} has been rejected. Reason given: {1}", purchaseorder, message), fromemail, toemail); }