private void loadUserFileAndCheckGUID(Action action, IMyLog log) { string email = Data_AppUserFile.API_IdToEmail(m_RequId); if (email == null) { throw new ArgumentException("X-APIId unknown"); } DSSwitch.appUser().Update_General(email, delegate(Data_AppUserFile user, Object args) { m_User = user; if (m_User == null) { throw new ArgumentException("X-APIId unknown"); } if (!m_User.IsAccountActive(m_Message)) { throw new ArgumentException("Account not active (1). " + m_User.AccountStatusExplained()); } if (m_User.ApiGuId != m_RequId) { throw new ArgumentException("X-APIId unknown"); } action(); }, null, null, log); }
public static Data_AppUserFile_CheckerBase GetCheckerBase(this Data_AppUserFile appUserFile, bool returnDefaultChecker = false) { switch (appUserFile.AccountStatus) { case Data_AppUserFile.eUserStatus.verified_welcome_No_sent: case Data_AppUserFile.eUserStatus.verified_welcome_queued: case Data_AppUserFile.eUserStatus.free_account: return(new Data_AppUserFile_Checker_Free(appUserFile.FreeAccount)); case Data_AppUserFile.eUserStatus.verified_checkingTelNumbers: return(new Data_AppUserFile_Checker_Default()); case Data_AppUserFile.eUserStatus.commercial_monthly: return(new Data_AppUserFile_Checker_Monthly(appUserFile.MonthlyAccount, appUserFile.AddCommentLine)); case Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice: return(new Data_AppUserFile_Checker_MonthlyDifPrice(appUserFile.MonthlyDifPriceAccount, appUserFile.AddCommentLine)); case Data_AppUserFile.eUserStatus.commercial_payassent: return(new Data_AppUserFile_Checker_PayAsSent(appUserFile.PayAsSentAccount)); case Data_AppUserFile.eUserStatus.commercial_systemDuplication: return(new Data_AppUserFile_Checker_SystemDuplication(appUserFile.SystemDuplicationAccount, appUserFile.AddCommentLine)); default: if (returnDefaultChecker) { return(new Data_AppUserFile_Checker_Default()); } else { throw new ArgumentException("Account not active (2). " + appUserFile.AccountStatusExplained()); } } }
public static void CommitOrThrow_Send(this Data_AppUserFile appUserFile, string[] telList, bool isWelcomeMessage, int MessageLength, ref Data_AppUserFile.eUserStatus accountStatus, out bool sendFooter) { sendFooter = true; Data_AppUserFile_CheckerBase checker = appUserFile.GetCheckerBase(); if (checker == null) { throw new ArgumentException("Account not active (5). " + appUserFile.AccountStatusExplained()); } checker.CommitOrThrow_Send(appUserFile.MobileNumbers_AllConfirmed__, telList, isWelcomeMessage, MessageLength, ref appUserFile.AccountStatus, out sendFooter); }
public static string CommitOrThrow_TelNumberRemove(this Data_AppUserFile appUserFile, string TelList) { Data_AppUserFile_CheckerBase checker = appUserFile.GetCheckerBase(); if (checker == null) { throw new ArgumentException("Account not active (4). " + appUserFile.AccountStatusExplained()); } MobileNoHandler noToRemove = new MobileNoHandler(TelList); MobileHandleConfUnconfList existing = new MobileHandleConfUnconfList(); existing.Add(appUserFile.MobileNumbers_AllConfirmed__.getVal, true); existing.Add(appUserFile.MobileNumbers_AllUnConfirmed__.getVal, false); checker.CommitOrThrow_TelNumberRemove(existing, noToRemove); existing.Remove(TelList); string retString; existing.SortAndReturn(out appUserFile.MobileNumbers_AllConfirmed__, out appUserFile.MobileNumbers_AllUnConfirmed__, out retString); return(retString); }