Example #1
0
        public string Process_CreateCheckTelFileForTestAccount(NiceSystemInfo niceSystem, MobileNoHandler XTelList, IMyLog log)
        {
            APIId = null;
            StringBuilder   sbInfo          = new StringBuilder();
            MobileNoHandler telForCheckFile = XTelList;

            try
            {
                timeNow = DateTime.UtcNow;

                string email = throw new NotImplementedException("not suitable for publication!");
                Data_Net__04CheckTelNumbers _04 = new Data_Net__04CheckTelNumbers(email, timeNow.Ticks, telForCheckFile.getVal, "");
                DSSwitch.msgFile04().Store(niceSystem, _04, log);
                sbInfo.AppendFormat("File {0} created\r\n", _04.GetFileName());
            }
            catch (ArgumentException ae)
            {
                sbInfo.Append(ae.Message);
            }
            catch (Exception)
            {
                sbInfo.Append("ERROR");
            }
            return(sbInfo.ToString());
        }
Example #2
0
        public static NiceSystemInfo GetSystemInfoFromTrayType(this string trayType)
        {
            // use null if not there
            NiceSystemInfo ret = DSSwitch.full().GetSystems(false).FirstOrDefault(_ => _.Name == trayType);

            return(ret);
        }
Example #3
0
 public static void NiceApiLibrary_StartUp(IMyLog log, bool waitUntilStartupIsDone)
 {
     if (!startupCalled)
     {
         startupCalled = true;
         DSSwitch.StartUp(log, waitUntilStartupIsDone);
     }
 }
Example #4
0
 private void processScreenShotResult(Data_Net__03ScreenshotResult _03)
 {
     trayLog.Debug("ScreenshotResult " + _03.GetFileName());
     // 1) Delete the request file
     DSSwitch.msgFile02().Delete(niceSystem, _03.FileName, trayLog);
     // 2) Update the loopback file
     this.onScreenshot(_03.B64ScreenshotData, niceSystem);
 }
Example #5
0
        public static NiceSystemInfo GetSystemInfoFromAPIId(this string apiId)
        {
            // use Default if not there
            NiceSystemInfo ret = DSSwitch.full().GetSystems(false).FirstOrDefault(_ => _.APIId == apiId);

            if (ret == null)
            {
                return(NiceSystemInfo.DEFAULT);
            }
            return(ret);
        }
Example #6
0
        private string createMessageFile(NiceSystemInfo niceSystem, int telId, string telNumber, string cleanMessage, string email, DateTime utcNow, IMyLog log, bool noCounterUpdate, bool sendFooter, Int32 MaxFailBeforeDispose)
        {
            Data_Net__00NormalMessage msg = new Data_Net__00NormalMessage(
                Data_AppUserFile.EmailSaveChars(email),
                "zapi_" + telNumber,
                utcNow.Ticks + (Int64)telId,
                sendFooter ?
                cleanMessage + "\r\nSent via NiceApi.net\r\n" :
                cleanMessage + "\r\n",
                0,
                MaxFailBeforeDispose,
                noCounterUpdate);

            DSSwitch.msgFile00().Store(niceSystem, msg, Data_Net__00NormalMessage.eLocation.Queued, log);
            return(msg.GetFileName());
        }
Example #7
0
 public static void ProcessQueuedItems(NiceSystemInfo niceSystem, dProcessOne processAction, IMyLog log)
 {
     DSSwitch.msgFile00().ForEach(niceSystem, Data_Net__00NormalMessage.eLocation.Queued, log,
                                  delegate(Data_Net__00NormalMessage msg)
     {
         processAction(msg);
     });
     DSSwitch.msgFile02().ForEach(niceSystem, log,
                                  delegate(Data_Net__02ScreenshotRequest msg)
     {
         processAction(msg);
     });
     DSSwitch.msgFile04().ForEach(niceSystem, log,
                                  delegate(Data_Net__04CheckTelNumbers msg)
     {
         processAction(msg);
     });
 }
Example #8
0
        public string Process_Registration(NiceSystemInfo niceSystem, out bool fileArleadyUsed, bool sendActivationEmail, string UserName, string MoblieAllNumbers, string Email, string Password, string CreationIp, string WhereHeardText, IMyLog log, LogForEmailSend log4Email)
        {
            StringBuilder sbInfo = new StringBuilder();

            fileArleadyUsed = true;
            try
            {
                timeNow = DateTime.UtcNow;
                Data_AppUserFile ud = Data_AppUserFile.Create(
                    UserName, true, MoblieAllNumbers, Email, Password, CreationIp);
                sbInfo.Append(ud.ApiGuId);
                DSSwitch.appUser().StoreNew(ud, out fileArleadyUsed, log);
                if (!fileArleadyUsed)
                {
                    if (sendActivationEmail)
                    {
                        EMail.SendRegisterActivation(ud, log4Email);
                    }
                    if (log != null)
                    {
                        log.Info(ud.Email + " account created");
                    }
                    if (log != null)
                    {
                        log.Info("WhereHeard " + WhereHeardText);
                    }
                }
            }
            catch (ArgumentException ae)
            {
                sbInfo.Append(ae.Message);
            }
            catch (Exception)
            {
                sbInfo.Append("ERROR");
            }
            return(sbInfo.ToString());
        }
Example #9
0
 public static void NiceApiLibrary_End()
 {
     DSSwitch.End();
 }
Example #10
0
        private void processNormalMessageResult(Data_Net__01NormalMessageResult _01)
        {
            if (_01.Success)
            {
                // Normal Message, success
                // 1) read in and delete msg file
                Data_Net__00NormalMessage msg00 = DSSwitch.msgFile00().ReadOne(niceSystem, _01.FileName, Data_Net__00NormalMessage.eLocation.Queued, trayLog);
                DSSwitch.msgFile00().Delete(niceSystem, _01.FileName, Data_Net__00NormalMessage.eLocation.Queued, trayLog);

                // 2) update counters in user file (if needed)
                DSSwitch.appUser().Update_General(
                    msg00.UserId,
                    OnProcessedHandler.OnProcessed,
                    new OnProcessedHandler(msg00.Msg.Length, log4Email, !msg00.NoCounterUpdate),
                    OnProcessedHandler.PostProcess,
                    trayLog);

                // 3) write msg file to processed folder
                DSSwitch.msgFile00().Store(niceSystem, (Data_Net__00NormalMessage)msg00, Data_Net__00NormalMessage.eLocation.Processed, trayLog);
            }
            else
            {
                // Normal Message, failed
                // 1) read in and delete msg file
                Data_Net__00NormalMessage msg00 = DSSwitch.msgFile00().ReadOne(niceSystem, _01.FileName, Data_Net__00NormalMessage.eLocation.Queued, trayLog);
                DSSwitch.msgFile00().Delete(niceSystem, _01.FileName, Data_Net__00NormalMessage.eLocation.Queued, trayLog);

                // 2) Increas failed counter and see whether we dispose of it
                msg00.FailedCounter++;
                if ((msg00.DisposeAfterNFailed != -1) && (msg00.FailedCounter >= msg00.DisposeAfterNFailed))
                {
                    // take it off the running loop
                    // 2) update counters in user file (if needed)
                    DSSwitch.appUser().Update_General(
                        msg00.UserId,
                        OnProcessedHandler.OnProcessed,
                        new OnProcessedHandler(msg00.Msg.Length, log4Email, !msg00.NoCounterUpdate),
                        OnProcessedHandler.PostProcess,
                        trayLog);

                    // 3) write msg file to disposed folder
                    DSSwitch.msgFile00().Store(niceSystem, msg00, Data_Net__00NormalMessage.eLocation.Disposed, trayLog);
                }
                else if (msg00.AliveSince().TotalHours > 12)
                {
                    // take it off the running loop after 12 hours of failure
                    // 2) update counters in user file (if needed)
                    DSSwitch.appUser().Update_General(
                        msg00.UserId,
                        OnProcessedHandler.OnProcessed,
                        new OnProcessedHandler(msg00.Msg.Length, log4Email, !msg00.NoCounterUpdate),
                        OnProcessedHandler.PostProcess,
                        trayLog);

                    // 3) write msg file to disposed folder
                    DSSwitch.msgFile00().Store(niceSystem, msg00, Data_Net__00NormalMessage.eLocation.Disposed, trayLog);

                    // 4) Inform the administrator about it
                    StringBuilder sbBody = new StringBuilder();
                    sbBody.AppendLine("Message removed after 12 hours of failure");
                    foreach (var s in msg00.ToFullString())
                    {
                        sbBody.AppendLine(s);
                    }
                    sbBody.AppendLine("You might consider blocking this user.");
                    EMail.SendGeneralEmail(null, true, "12 hours of failure", sbBody.ToString(), log4Email);
                }
                else
                {
                    // keep in running
                    DSSwitch.msgFile00().Store(niceSystem, msg00, Data_Net__00NormalMessage.eLocation.Queued, trayLog);
                }
            }
        }
Example #11
0
        private void processCheckTelNumbersResult(Data_Net__05CheckTelNumbersResult _05, bool sendEmails)
        {
            // 1) delete the triggering file
            ASPTrayBase.MsgFileParts    info  = ASPTrayBase.s_MsgFile_GetPartsFromMessageFile(_05.RequestFileName);//mg check this
            Data_Net__04CheckTelNumbers msg04 = DSSwitch.msgFile04().ReadOne(niceSystem, _05.RequestFileName, trayLog);

            DSSwitch.msgFile04().Delete(niceSystem, _05.RequestFileName, trayLog);

            string niceEmail                   = null;
            bool   sendWelcomeMessages         = false;
            string sendWelcomeMessages_GUID    = null;
            string sendWelcomeMessages_TelList = null;

            if ((_05.TelListOk == null) && (_05.TelListDoRetry == null) && (_05.TelListNotWorking == null))
            {
                // this is from directTel, so the first checked is not ok
                MobileNoHandler hOk   = new MobileNoHandler(msg04.TelListChecked);
                MobileNoHandler hToDo = new MobileNoHandler(msg04.TelList);
                hOk.AddIfNew(hToDo.RemoveAndReturnFirst());

                _05.TelListOk         = hOk.getVal;
                _05.TelListDoRetry    = hToDo.getVal;
                _05.TelListNotWorking = "";
            }

            // 2) do retry if not all worked and non failed
            if ((_05.TelListDoRetry.Length > 0) && (_05.TelListNotWorking.Length == 0))
            {
                // early retry
                Data_Net__04CheckTelNumbers _04 = new Data_Net__04CheckTelNumbers(info.Email, DateTime.UtcNow.Ticks, _05.TelListDoRetry, _05.TelListOk);
                DSSwitch.msgFile04().Store(niceSystem, _04, trayLog);
            }
            else
            {
                // open the userfile and merge
                MobileNoHandler doAgain = new MobileNoHandler(_05.TelListDoRetry);
                DSSwitch.appUser().Update_General(info.Email, delegate(Data_AppUserFile user, Object args)
                {
                    //  action
                    niceEmail = user.Email;
                    foreach (string telGood in (new MobileNoHandler(_05.TelListOk)).MobileNumberArray)
                    {
                        user.MobileNumbers_AllConfirmed__.AddIfNew(telGood);
                        user.MobileNumbers_AllUnConfirmed__.Remove(telGood);
                    }
                    foreach (string telNotWorking in (new MobileNoHandler(_05.TelListNotWorking)).MobileNumberArray)
                    {
                        user.AddCommentLine(telNotWorking + " not working", true);
                        user.MobileNumbers_AllUnConfirmed__.Remove(telNotWorking);
                        user.MobileNumbers_AllConfirmed__.Remove(telNotWorking);
                    }
                    foreach (string telAgain in user.MobileNumbers_AllUnConfirmed__.MobileNumberArray)
                    {
                        doAgain.AddIfNew(telAgain);
                    }

                    if (doAgain.MobileNumbersCount == 0)
                    {
                        // nothing elso to check, so make a desision
                        if (user.AccountStatus == Data_AppUserFile.eUserStatus.verified_checkingTelNumbers)
                        {
                            if (user.MobileNumbers_AllConfirmed__.MobileNumbersCount > 0)
                            {
                                // we have good numbers, so upgrade
                                user.AccountStatus = Data_AppUserFile.eUserStatus.free_account;
                                if (sendEmails)
                                {
                                    EMail.SendJustActivated(user, log4Email);
                                }
                                sendWelcomeMessages         = true;
                                sendWelcomeMessages_GUID    = user.ApiGuId;
                                sendWelcomeMessages_TelList = user.MobileNumbers_AllConfirmed__.getVal;
                            }
                            else
                            {
                                // we have no valid numbers, so block
                                user.AccountStatus = Data_AppUserFile.eUserStatus.blocked;
                                if (sendEmails)
                                {
                                    EMail.SendWrongTelRegistered(user, log4Email);
                                }
                            }
                        }
                        else if (user.AccountStatus == Data_AppUserFile.eUserStatus.free_account)
                        {
                            // this could be a free account number adding
                            if (sendEmails)
                            {
                                EMail.SendJustActivated(user, log4Email);
                            }
                            sendWelcomeMessages         = true;
                            sendWelcomeMessages_GUID    = user.ApiGuId;
                            sendWelcomeMessages_TelList = user.MobileNumbers_AllConfirmed__.getVal;
                        }
                    }
                }, null, delegate(Object args)
                {
                    // post user file processing
                    if (doAgain.MobileNumbersCount != 0)
                    {
                        // still unprocessed numbers
                        Data_Net__04CheckTelNumbers _04 = new Data_Net__04CheckTelNumbers(info.Email, DateTime.UtcNow.Ticks, doAgain.getVal, "");
                        DSSwitch.msgFile04().Store(niceSystem, _04, trayLog);
                    }
                    if (sendWelcomeMessages)
                    {
                        MessageProcessing_API api = new MessageProcessing_API(sendWelcomeMessages_GUID);
                        string additionalInfo;
                        api.SendWhatsApp(
                            niceSystem,
                            sendWelcomeMessages_TelList,
                            "Welcome to NiceApi.net\r\n",
                            true,
                            trayLog,
                            out additionalInfo);
                    }
                }, trayLog);
            }
        }
Example #12
0
        public string SendWhatsApp(NiceSystemInfo niceSystem, string XAPIMobile, string Message, bool isWelcomeMessage, IMyLog log, out string fileName)
        {
            fileName = "";
            string[] requTelList    = null;
            string   cleanMessage   = null;
            bool     sendFooter     = true;
            bool     deleteOnFailed = false;

            try
            {
                timeNow = DateTime.UtcNow;
                // 1 extract (check) input data
                #region 1 extract (check) input data
                if (string.IsNullOrEmpty(APIId))
                {
                    throw new ArgumentException("X-APIId missing");
                }

                if (string.IsNullOrEmpty(XAPIMobile))
                {
                    throw new ArgumentException("X-APIMobile missing");
                }

                requTelList = XAPIMobile.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < requTelList.Length; i++)
                {
                    requTelList[i] = "+" + requTelList[i];
                }

                cleanMessage = Message.Replace(":SE", ":  SE").Replace(": SE", ":  SE");
                if (string.IsNullOrEmpty(cleanMessage))
                {
                    throw new ArgumentException("No POST data");
                }
                #endregion

                // 2 load user file and check guid
                #region 2 load user file and check guid
                string email = Data_AppUserFile.API_IdToEmail(APIId);
                if (email == null)
                {
                    throw new ArgumentException("X-APIId unknown");
                }
                DSSwitch.appUser().Update_General(email, delegate(Data_AppUserFile user, Object args)
                {
                    if (user == null)
                    {
                        throw new ArgumentException("X-APIId unknown");
                    }
                    if (!user.IsAccountActive(cleanMessage))
                    {
                        throw new ArgumentException("Account not active (7). " + user.AccountStatusExplained());
                    }
                    if (user.ApiGuId != APIId)
                    {
                        throw new ArgumentException("X-APIId unknown");
                    }
                    #endregion

                    // 3 action
                    user.CommitOrThrow_Send(requTelList, isWelcomeMessage, cleanMessage.Length, ref user.AccountStatus, out sendFooter);
                    deleteOnFailed = user.DeleteOnFailed;
                }, null, null, log);

                // 5) createMessageFile
                bool noCounterUpdate = false;
                if (Message.StartsWith("__NoSend"))
                {
                    noCounterUpdate = true;
                }
                else if (Message == "Welcome\r\n")
                {
                    noCounterUpdate = true;
                }
                else if (Message == "Welcome to NiceApi.net\r\n")
                {
                    noCounterUpdate = true;
                }

                int telNoId = 0;
                foreach (string tel1 in requTelList)
                {
                    fileName +=
                        createMessageFile(
                            niceSystem,
                            telNoId,
                            requTelList[telNoId],
                            cleanMessage,
                            email,
                            timeNow,
                            log,
                            noCounterUpdate,
                            sendFooter,
                            deleteOnFailed ?
                            1 : -1) + ", ";
                    // move on
                    telNoId++;
                }

                if (telNoId == 1)
                {
                    return("queued");
                }
                else
                {
                    return("queued x" + telNoId.ToString());
                }
            }
            catch (ArgumentException ae)
            {
                return(ae.Message);
            }
        }
Example #13
0
        public string Process_Registration_JustVerified(NiceSystemInfo niceSystem, out bool ok, bool sendAdminNotification, bool sendAdminNotificationToWhatsapp, IMyLog log, LogForEmailSend log4Email)
        {
            StringBuilder sbInfo     = new StringBuilder();
            string        telToCheck = null;

            ok = false;
            string friendlyEmail = null;
            bool   okIntern      = false;

            try
            {
                timeNow = DateTime.UtcNow;
                // 1 extract (check) input data
                if (string.IsNullOrEmpty(APIId))
                {
                    throw new ArgumentException("X-APIId missing");
                }

                // 2 load user file and check guid
                string email = Data_AppUserFile.API_IdToEmail(APIId);
                if (email == null)
                {
                    throw new ArgumentException("X-APIId unknown");
                }
                DSSwitch.appUser().Update_General(email, delegate(Data_AppUserFile user, Object args)
                {
                    if (user == null)
                    {
                        throw new ArgumentException("X-APIId unknown");
                    }
                    if (user.ApiGuId != APIId)
                    {
                        throw new ArgumentException("X-APIId unknown");
                    }
                    if (user.AccountStatus != Data_AppUserFile.eUserStatus.email_sent_for_verification)
                    {
                        throw new ArgumentException("AccountStatus is wrong");
                    }

                    // 3 action, produce telCheck file and update AccountStatus
                    user.AccountStatus = Data_AppUserFile.eUserStatus.verified_checkingTelNumbers;
                    telToCheck         = user.MobileNumbers_AllConfirmed__.getVal + user.MobileNumbers_AllUnConfirmed__.getVal;
                    friendlyEmail      = user.Email;
                    okIntern           = true;
                }, null, delegate(Object args)
                {
                    // post process
                    if (log != null)
                    {
                        log.Info(friendlyEmail + " just verified his email");
                    }
                    if (sendAdminNotification)
                    {
                        EMail.SendAdminNotification(friendlyEmail + " just verified his email", log4Email);
                    }
                    if (sendAdminNotificationToWhatsapp)
                    {
                        NotificationInfo notificationInfo = DSSwitch.full().GetNotificationInfo();
                        NiceSystemInfo notifyToUse        = DSSwitch.full().GetSystems(false).FirstOrDefault(s => s.Name == notificationInfo.Name);
                        if (notifyToUse != null)
                        {
                            Data_Net__00NormalMessage msg = new Data_Net__00NormalMessage(
                                Data_AppUserFile.API_IdToEmail(notifyToUse.APIId),
                                "zapi_" + notificationInfo.RxTel,
                                DateTime.UtcNow.Ticks,
                                friendlyEmail + " just verified his email",
                                0, 10, true);
                            DSSwitch.msgFile00().Store(notifyToUse, msg, Data_Net__00NormalMessage.eLocation.Queued, log);
                        }
                    }
                    Data_Net__04CheckTelNumbers _04 = new Data_Net__04CheckTelNumbers(friendlyEmail, timeNow.Ticks, telToCheck, "");
                    DSSwitch.msgFile04().Store(niceSystem, _04, log);
                }, log);
            }
            catch (ArgumentException ae)
            {
                sbInfo.Append(ae.Message);
            }
            catch (Exception)
            {
                sbInfo.Append("ERROR");
            }
            ok = okIntern;
            return(sbInfo.ToString());
        }
Example #14
0
        public string Process_MGUseAddTelToFreeAccounts(NiceSystemInfo niceSystem, MobileNoHandler XTelList, int maxNumbers, IMyLog log)
        {
            StringBuilder   sbInfo          = new StringBuilder();
            MobileNoHandler telForCheckFile = new MobileNoHandler("");

            try
            {
                timeNow = DateTime.UtcNow;
                // 1 extract (check) input data
                #region 1 extract (check) input data
                if (string.IsNullOrEmpty(Email))
                {
                    throw new ArgumentException("X-APIId missing");
                }
                #endregion

                // 2 load user file and check guid
                #region 2 load user file and check guid
                DSSwitch.appUser().Update_General(Email, delegate(Data_AppUserFile user, Object args)
                {
                    if (user == null)
                    {
                        throw new ArgumentException("X-APIId unknown");
                    }
                    #endregion

                    // 3 action, add up to 5 numbers and produce telCheck file
                    #region 3 action, add up to 5 numbers and produce telCheck file
                    if (user.AccountStatus == Data_AppUserFile.eUserStatus.blocked)
                    {
                        // unblock, as this is an instraction from the admin
                        user.AccountStatus = Data_AppUserFile.eUserStatus.free_account;
                    }

                    if (user.AccountStatus != Data_AppUserFile.eUserStatus.free_account)
                    {
                        throw new ArgumentException("This applies only to free_account. Not to " + user.AccountStatus.ToString());
                    }
                    if ((
                            user.MobileNumbers_AllConfirmed__.MobileNumbersCount +
                            user.MobileNumbers_AllUnConfirmed__.MobileNumbersCount +
                            XTelList.MobileNumbersCount) > maxNumbers)
                    {
                        throw new ArgumentException("Only up to 5 numbers allowed");
                    }
                    foreach (string tel1 in XTelList.MobileNumberArray)
                    {
                        user.MobileNumbers_AllUnConfirmed__.Add(tel1);
                        telForCheckFile.Add(tel1);
                        sbInfo.AppendFormat("Added {0}\r\n", tel1);
                    }
                    sbInfo.AppendFormat("Now {0} # registered\r\n", (user.MobileNumbers_AllConfirmed__.MobileNumbersCount + user.MobileNumbers_AllUnConfirmed__.MobileNumbersCount));
                    #endregion
                }, null, delegate(Object args)
                                                  // 4 post user file handling, create telCheck file
                {
                    Data_Net__04CheckTelNumbers _04 = new Data_Net__04CheckTelNumbers(Email, timeNow.Ticks, telForCheckFile.getVal, "");
                    DSSwitch.msgFile04().Store(niceSystem, _04, log);
                    sbInfo.AppendFormat("File {0} created\r\n", _04.GetFileName());
                }, log);
            }
            catch (ArgumentException ae)
            {
                sbInfo.Append(ae.Message);
            }
            catch (Exception)
            {
                sbInfo.Append("ERROR");
            }
            return(sbInfo.ToString());
        }
Example #15
0
        public string Process_TelNumAPI(NiceSystemInfo niceSystem, string XAPIInstruction, string Message, IMyLog log)
        {
            StringBuilder sbRet = new StringBuilder();

            try
            {
                timeNow = DateTime.UtcNow;
                // 1 extract (check) input data
                #region 1 extract input data
                if (string.IsNullOrEmpty(APIId))
                {
                    throw new ArgumentException("X-APIId missing");
                }
                eTelNum_Instruction telNum_Instruction = castInstractionOrThrow(XAPIInstruction);
                MobileNoHandler     telNum_Handler     = new MobileNoHandler(Message.Replace(" ", "").Replace("\t", "").Replace("\r", "").Replace("\n", ""));
                #endregion

                // 2 load user file and check guid
                #region 2 load user file and check guid
                if (Email == null)
                {
                    throw new ArgumentException("X-APIId unknown");
                }
                MobileNoHandler telAddToCheckingFile = new MobileNoHandler("");
                DSSwitch.appUser().Update_General(Email, delegate(Data_AppUserFile user, Object args)
                {
                    if (user == null)
                    {
                        throw new ArgumentException("X-APIId unknown");
                    }
                    if (user.ApiGuId != APIId)
                    {
                        throw new ArgumentException("X-APIId unknown");
                    }
                    if (!user.IsAccountActive(""))
                    {
                        throw new ArgumentException("Account not active (8). " + user.AccountStatusExplained());
                    }
                    if (!user.AddNumber_AllowedWithAPI)
                    {
                        throw new ArgumentException("Not allowed for this account");
                    }
                    #endregion

                    // 3 action format retString according to telNum_Instruction
                    #region 3 action format retString according to telNum_Instruction
                    switch (telNum_Instruction)
                    {
                    case eTelNum_Instruction.ShowConfirmed:
                        sbRet.Append(user.MobileNumbers_AllConfirmed__.getVal);
                        break;

                    case eTelNum_Instruction.ShowUnconfirmed:
                        sbRet.Append(user.MobileNumbers_AllUnConfirmed__.getVal);
                        break;

                    case eTelNum_Instruction.Show:
                        sbRet.AppendLine("Plan: " + user.AccountStatus.ToString());
                        sbRet.AppendLine(String.Format("Counter: {0} / {1}", user.MobileNumbers_AllConfirmed__.MobileNumbersCount, user.MobileNumbers_AllUnConfirmed__.MobileNumbersCount));
                        sbRet.AppendLine("Confirmed: " + user.MobileNumbers_AllConfirmed__.getVal);
                        sbRet.AppendLine("Unconfirmed: " + user.MobileNumbers_AllUnConfirmed__.getVal);
                        break;

                    case eTelNum_Instruction.Add:
                        {
                            MobileNoHandler XTelList = new MobileNoHandler(Message, true);

                            foreach (string tel1 in XTelList.MobileNumberArray)
                            {
                                if (user.MobileNumbers_AllConfirmed__.Contains(tel1))
                                {
                                    sbRet.AppendLine(tel1 + " is already confirmed.");
                                }
                                else if (user.MobileNumbers_AllUnConfirmed__.Contains(tel1))
                                {
                                    sbRet.AppendLine(tel1 + " is already on the list.");
                                }
                                else if (!user.GetCheckerBase(true).FundManagement_CommitAddOneNumber(tel1))
                                {
                                    sbRet.AppendLine("Not enough funds to add " + tel1 + ".");
                                }
                                else
                                {
                                    sbRet.AppendLine(tel1 + " added.");
                                    user.MobileNumbers_AllUnConfirmed__.Add(tel1);
                                    telAddToCheckingFile.Add(tel1);
                                }
                            }
                        }
                        break;

                    case eTelNum_Instruction.Remove:
                        throw new ArgumentException("Remove not allowed for this account");
                    //break;

                    default:
                        throw new ArgumentException("Internel Error");
                    }
                    #endregion
                }, null, delegate(Object args)
                {
                    if (telAddToCheckingFile.MobileNumbersCount > 0)
                    {
                        Data_Net__04CheckTelNumbers _04 = new Data_Net__04CheckTelNumbers(Email, timeNow.Ticks, telAddToCheckingFile.getVal, "");
                        DSSwitch.msgFile04().Store(niceSystem, _04, log);
                    }
                }, log);
            }
            catch (ArgumentException ae)
            {
                sbRet = new StringBuilder();
                sbRet.Append(ae.Message);
            }
            catch (Exception)
            {
                sbRet = new StringBuilder();
                sbRet.Append("ERROR");
            }
            return(sbRet.ToString());;
        }