public int delete(Customer customer) { try { bool result = false; customer = customerService.GetByPrimaryKey(customer.CustomerID); tblOrderService.DeleteByCustomerID(customer.CustomerID); addressBookService.DeleteByCustomerID(customer.CustomerID); result = customerService.DeleteByPrimary(customer.CustomerID); if (result) { string customerName = customer.CustomerFirstName + " " + customer.CustomerLastName; LogService.WriteLog2DB(accountService.GetUserId(User.Identity.GetUserName()), (int)Common.ActionID.Delete, 0, SDateTime.GetYYYYMMddHmmSSNow(), General.GetIPAddress(), TableNameID, customerName); return(1); } } catch (Exception ex) { LogService.WriteException(ex); } return(0); }