//---------------------------------------------------------- #endregion #region ----------------InsertTestingDataForEmailList--------------- //---------------------------------------------------------- //InsertTestingDataForEmailList //---------------------------------------------------------- public void InsertTestingDataForEmailList() { //---------------------------------------------------------------------- MailListUsersEntity ArMailListUsers = new MailListUsersEntity(); string arEmail = "armail{0}@site.com"; ArMailListUsers.IsActive = true; ArMailListUsers.ModuleTypeID = (int)StandardItemsModuleTypes.MailList; ArMailListUsers.LangID = Languages.Ar; //---------------------------------------------------------------------- MailListUsersEntity EnMailListUsers = new MailListUsersEntity(); string enEmail = "enmail{0}@site.com"; EnMailListUsers.IsActive = true; EnMailListUsers.ModuleTypeID = (int)StandardItemsModuleTypes.MailList; EnMailListUsers.LangID = Languages.Ar; //---------------------------------------------------------------------- for (int i = 1; i <= 5; i++) { if (SiteSettings.Languages_HasArabicLanguages) { ArMailListUsers.Email = string.Format(arEmail, i.ToString()); MailListUsersFactory.Create(ArMailListUsers); } if (SiteSettings.Languages_HasEnglishLanguages) { EnMailListUsers.Email = string.Format(enEmail, i.ToString()); MailListUsersFactory.Create(EnMailListUsers); } } }
//------------------------------------------ #endregion #region ---------------------------RegisterInMailList--------------------------- //--------------------------------------------------------------------------- public static void RegisterInMailList(UsersDataEntity usersDataObject) { UsersDataGlobalOptions userDataModule = UsersDataGlobalOptions.GetType(usersDataObject.ModuleTypeID); Languages langID = (Languages)SiteSettings.Languages_DefaultLanguageID; MailListUsersFactory.RegisterInMailList(userDataModule.ModuleTypeID, usersDataObject.Email, langID, userDataModule.MailListAutomaticActivation, userDataModule.MailListSendingMailActivation); }
//------------------------------------------ #endregion #region ---------------------------RegisterInMailList--------------------------- //--------------------------------------------------------------------------- public static void RegisterInMailList(MessagesEntity msg) { MessagesModuleOptions msgModule = MessagesModuleOptions.GetType(msg.ModuleTypeID); Languages langID = (Languages)SiteSettings.Languages_DefaultLanguageID; MailListUsersFactory.RegisterInMailList(msg.ModuleTypeID, msg.EMail, langID, msgModule.MailListAutomaticActivation, msgModule.MailListSendingMailActivation); }
//------------------------------------------ #endregion //----------------------------------------------------------------------- public static ExecuteCommandStatus RegisterInMailList(int moduleID, string email, Languages langID, bool isActive, bool requiredActivationCode) { MailListUsersEntity user = new MailListUsersEntity(); user.ModuleTypeID = moduleID; user.Email = email; user.LangID = langID; user.IsActive = isActive; ExecuteCommandStatus status = MailListUsersFactory.Create(user); if (status == ExecuteCommandStatus.Done && requiredActivationCode && !isActive) { SendActivationCodeMessage(user); } return(status); }
//--------------------------------------------------------------------------- public static void UpdateMailListEmail(string oldEmail, UsersDataEntity usersDataObject) { MailListUsersEntity mlUser = MailListUsersFactory.GetObject(usersDataObject.ModuleTypeID, oldEmail); if (mlUser != null) { if (!string.IsNullOrEmpty(usersDataObject.Email)) { mlUser.Email = usersDataObject.Email; MailListUsersFactory.Update(mlUser); } else { MailListUsersFactory.Delete(mlUser.UserID); } } else { UsersDataFactory.RegisterInMailList(usersDataObject); } }
//--------------------------------------------------------------------------- public static void UpdateMailListEmail(string oldEmail, MessagesEntity msg) { MailListUsersEntity mlUser = MailListUsersFactory.GetObject(msg.ModuleTypeID, oldEmail); if (mlUser != null) { if (!string.IsNullOrEmpty(msg.EMail)) { mlUser.Email = msg.EMail; MailListUsersFactory.Update(mlUser); } else { MailListUsersFactory.Delete(mlUser.UserID); } } else { MessagesFactory.RegisterInMailList(msg); } }
//--------------------------------------------------------------------------- public static void UnRegisterInMailList(UsersDataEntity usersDataObject) { MailListUsersFactory.Delete(usersDataObject.ModuleTypeID, usersDataObject.Email); }
//--------------------------------------------------------------------------- public static void UnRegisterInMailList(MessagesEntity msg) { MailListUsersFactory.Delete(msg.ModuleTypeID, msg.EMail); }