private void AddOrUpdateUser(User user, bool isUpdate = false, bool generatePassword = true) { string messagePart = ""; if (generatePassword) { user.PasswordHash = GenerateRandomNumber(); messagePart = string.Format("Kullanıcı Kodunuz: {0}\nŞifreniz: {1}\n\n", user.UserName, user.PasswordHash); HashPassword(user, user.PasswordHash); } if (isUpdate) { UserDao.Update(user); } else { UserDao.Add(user); } if (generatePassword) { //send an e-mail to the user to inform a new password generated and available to enter to the system try { EmailLogic.MessageTemplate = string.Format(ConfigurationManager.AppSettings.Get("PasswordNotificationTemplate").ToString(), DateTime.Now, "{0}"); EmailLogic.SendNewPasswordNotification(user.Email, messagePart); } catch (Exception ex) { mLogger.Error(ex.ToString()); } } }