Пример #1
0
    protected void SendMessage_Click(object sender, EventArgs e)
    {
        MyLog.GetLogger("APIForm").Info("APIForm send message");
        SessionData      sd   = ConstantStrings.GetSessionData(Session);
        Data_AppUserFile user = null;

        try
        {
            user = DSSwitch.appUser().RetrieveOne(sd.LoggedOnUserEmail, MyLog.GetLogger("APIForm"));
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
        bool   bFound  = false;
        string telText = "";

        getTextDependOnRadiobox(rbTel1, user.MobileNumberX(0), ref telText, ref bFound);
        getTextDependOnRadiobox(rbTel2, user.MobileNumberX(1), ref telText, ref bFound);
        getTextDependOnRadiobox(rbTel3, user.MobileNumberX(2), ref telText, ref bFound);
        getTextDependOnRadiobox(rbTel4, user.MobileNumberX(3), ref telText, ref bFound);
        getTextDependOnRadiobox(rbTel5, user.MobileNumberX(4), ref telText, ref bFound);

        if (bFound)
        {
            string sRet = new APIActualSending(sd.LoggedOnUsersNiceSystemInfo).SendWhatsApp(user.ApiGuId, telText, MessageText.Text, MyLog.GetLogger("APIForm"));
            MyLog.GetLogger("APIForm").Info("APIForm " + sRet);
            State1.Visible      = false;
            State2.Visible      = true;
            sent2.InnerHtml     = APIActualSending.fakeRequest(user.ApiGuId, telText, MessageText.Text);
            received2.InnerHtml = APIActualSending.fakeResponse(sRet);
        }
    }
Пример #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        PlaceHolder1.Controls.Clear();

        object sqlRes;

        try
        {
            sqlRes = DSSwitch.sql().ProcessSql(SessionData.SessionsSystem_Get(Session), TextBox_Sql.Text);
        }
        catch (Exception ex)
        {
            sqlRes = ex.Exceptio2Table();
        }

        if ((sqlRes != null) && (sqlRes.GetType() == typeof(System.Data.DataTable)))
        {
            System.Data.DataTable  r1 = (System.Data.DataTable)sqlRes;
            WebControlsTableResult r2 = r1.DataTable2WebControlsTable(20);

            PlaceHolder1.Controls.Add(r2.Label);
            PlaceHolder1.Controls.Add(r2.Table);
        }
        else if ((sqlRes != null) && (sqlRes.GetType() == typeof(Table)))
        {
            PlaceHolder1.Controls.Clear();
            Table sqlTable = (Table)sqlRes;
            PlaceHolder1.Controls.Add(sqlTable);
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This come from an anonymous browser
        try
        {
            if (!IsPostBack)
            {
                if (!FolderNames.IsDevMachine())
                {
                    if (Request["SCRIPT_NAME"] != "/default.aspx")
                    {
                        Response.Redirect("~/ItemX.aspx?id=Home");
                    }
                }

                Page.MetaKeywords    = "API, Online, Send Whatsapp message, Free";
                Page.MetaDescription = "Let your application send you WhatsApp messages. Sign up for free today.";
                NiceASP.KeywordLoader.Load(this, KeywordLoader.Which.Default);
                ExOut.InnerHtml = APIActualSending.fakeRequest("<Your unique X-APIId>", "<Mobile number>", "What a great day");
                ExRes.InnerHtml = APIActualSending.fakeResponse("queued");
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #4
0
        public static void MultySystemDebugs(IMyLog log, QuestionOption it)
        {
            var x1 = DSSwitch.appUser().GetType();
            var x2 = DSSwitch.full().GetNiceSystemType();

            DSSwitch.appUser().RetrieveAll(Data_AppUserFile.SortType.State, null, log);
        }
Пример #5
0
        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);
        }
Пример #6
0
    protected void allFieldsValidation(object sender, ServerValidateEventArgs e)
    {
        bool bOk = true;

        errorSummary.Text    = "";
        errorSummary.Visible = false;

        // basic checks
        checkUserName_ServerValidate(ref bOk);
        checkTelx_ServerValidate(ref bOk, 1);
        checkTelx_ServerValidate(ref bOk, 2);
        checkTelx_ServerValidate(ref bOk, 3);
        checkTelx_ServerValidate(ref bOk, 4);
        checkTelx_ServerValidate(ref bOk, 5);
        checkEmail_ServerValidate(ref bOk);
        checkPasswordWithConfirm_ServerValidate(ref bOk);

        if (bOk)
        {
            IMyLog log = MyLog.GetLogger("Register");

            // basic test ok, see if the numbers are already used
            TelListController currentList = DSSwitch.appUser().GetCurrentTelList(log);
            using (var _lock = currentList.GetLock())
            {
                checkTelx_AlreadyRegistred(ref bOk, 1, _lock.Locked);
                checkTelx_AlreadyRegistred(ref bOk, 2, _lock.Locked);
                checkTelx_AlreadyRegistred(ref bOk, 3, _lock.Locked);
                checkTelx_AlreadyRegistred(ref bOk, 4, _lock.Locked);
                checkTelx_AlreadyRegistred(ref bOk, 5, _lock.Locked);
            }
        }

        e.IsValid = bOk;
    }
Пример #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // This comes from the Admin User (protected)
     try
     {
         NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
         if (!IsPostBack)
         {
             string user = Request.QueryString["user"];
             if (user != null)
             {
                 I_UserEmail.Text = user;
                 GetData_Click(null, null);
             }
             else
             {
                 sectionEmailInput.Visible = true;
             }
         }
     }
     catch (DataUnavailableException)
     {
         DSSwitch.OnDataUnavailableException(this);
     }
 }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from a logged in user
        try
        {
            NiceASP.SessionData.LoggedOnOrRedirectToLogin(Session, Response, Request);

            if (!IsPostBack)
            {
                SessionData sd = ConstantStrings.GetSessionData(Session);
                // refresh from file
                Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(sd.LoggedOnUserEmail, MyLog.GetLogger("APIForm"));
                rbTel1.Checked = true;
                setTelNo(labTel1, rbTel1, user.MobileNumberX(0));
                setTelNo(labTel2, rbTel2, user.MobileNumberX(1));
                setTelNo(labTel3, rbTel3, user.MobileNumberX(2));
                setTelNo(labTel4, rbTel4, user.MobileNumberX(3));
                setTelNo(labTel5, rbTel5, user.MobileNumberX(4));
                MessageText.Text = "What a great day.";
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #9
0
        static void Main(string[] args)
        {
            Console.WriteLine(OperatingSystemInfo.Get().ToString());
            DSSwitch.NiceApiLibrary_StartUp(s_Log, true);
            s_Log.logSQL = true;

            bool     go   = true;
            Question ques = new Question();

            ques.Add(new QuestionOption("Email templates", EmailTemplates.Go));
            ques.Add(new QuestionOption("Add Tel# to free account...", NumberManager.AddToFree));
            ques.Add(new QuestionOption("Add Tel# to COMMERCIAL account...", NumberManager.Manager));
            ques.Add(new QuestionOption("Get Credit", WhatsappMessages.CheckCredit));
            ques.Add(new QuestionOption("EmailFromAPpiKey", Tests.EmailFromAPpiKey));

            // ques.Add(new QuestionOption("Send Moved emails", ); rrt//SendMovedEmail.Go(s_LogZap); break;
            //ques.Add(new QuestionOption("Send Nice test mail", SendNiceTestMail.Go));
            ques.Add(new QuestionOption("show Lib Version", Others.LibVersion));
            //            ques.Add(new QuestionOption("Just a log message", Others.JustALogMessage));
            ques.Add(new QuestionOption("Send Whatsapp messages...", WhatsappMessages.Go));
            ques.Add(new QuestionOption("Send Whatsapp messages Sys01", WhatsappMessages.GoSys01));
            ques.Add(new QuestionOption("Send Whatsapp messages Sys02", WhatsappMessages.GoSys02));
            ques.Add(new QuestionOption("Send Whatsapp messages Sys03", WhatsappMessages.GoSys03));
            ques.Add(new QuestionOption("Send Whatsapp messages Sys03 group", WhatsappMessages.GoSys03group));
            ques.Add(new QuestionOption("Send Whatsapp messages Sys04", WhatsappMessages.GoSys04));
            ques.Add(new QuestionOption("Send Whatsapp messages SysTest", WhatsappMessages.GoSysTest));
            //            ques.Add(new QuestionOption("Send ANY email", SendEmail.All));
            ques.Add(new QuestionOption("Show Logs", ShowLogs.Go));
            //ques.Add(new QuestionOption("Test SQL Copy", SQLCopy.Go));
            ques.Add(new QuestionOption("IIS Log All (dataLogger output)", IISLog.All));
            ques.Add(new QuestionOption("IIS Log Day Sum (dataLogger output)", IISLog.DaySummary));
            ques.Add(new QuestionOption("Tel# Analyser", TelNumberAnalyser.Analyse));
//            ques.Add(new QuestionOption("Test commercial code changes", CommercialCodeChange.Test));
            //ques.Add(new QuestionOption("Send Tel Check...", NumberManager.SendTelCheck));
            //ques.Add(new QuestionOption("Send Tel Sync (Dangerous)...", NumberManager.SendTelSync));
            ques.Add(new QuestionOption("Show Data_MessageFile content ...", ShowData_MessageFileContent.ShowAll));
            ques.Add(new QuestionOption("Get new APIId ...", Others.GetNewAPIId));
            //ques.Add(new QuestionOption("Test LibAPI...", Tests.LibAPI));
            ques.Add(new QuestionOption("Show Wallet contents", ShowWallet.Go));
            ques.Add(new QuestionOption("Ftp backup", FtpBackup.Go));
//            ques.Add(new QuestionOption("Sql Tester", SqlTesterForm.Show));
            ques.Add(new QuestionOption("Set LowLevelHttpDumping", delegate(IMyLog log, QuestionOption it) { LowLevelHttpDumper.Enabled = true; }));
            //ques.Add(new QuestionOption("500 Error Test", WhatsappMessages.Error500));
            //            ques.Add(new QuestionOption("Tests.TestQueuePriority", Tests.TestQueuePriority));
            //ques.Add(new QuestionOption("MultySystem Debug", Tests.MultySystemDebugs));
            //ques.Add(new QuestionOption("cUrl Command", cUrl_Command.Go));
            //ques.Add(new QuestionOption("Debug Loopback process...", Tests.DebugLoopback));
            //ques.Add(new QuestionOption("Debug DisplayTextControllerPart_MultiLine", Tests.DebugDisplayTextControllerPart_MultiLine));
            //ques.Add(new QuestionOption("Debug Android Sync in low lib", Tests.DebugAndroidSyncInLowLib));
            //ques.Add(new QuestionOption("Debug Debug_DirectTel", Tests.Debug_DirectTel));



            while (go)
            {
                ques.AskAndAct("What to do (SQLite Version", s_Log);
            }
        }
Пример #10
0
    private void doQueue_old(IMyLog log)
    {
        // show queued files
        responseWriteHomeLink();

        int queue = DSSwitch.msgFile00().GetNoOfQueuedItems(NiceASP.SessionData.SessionsSystem_Get(Session), log);

        Response.Write(String.Format("Length : {0}<br />", queue));
    }
Пример #11
0
    protected void Click_LogIn(object sender, EventArgs e)
    {
        try
        {
            if (IsValid)
            {
                IMyLog log = MyLog.GetLogger("Login");
                // Validate the user password
                SessionData sd = ConstantStrings.GetSessionData(Session);
                CommonHelper.DoLogout(sd);

                Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(Email.Text, log);

                if (isAdmin())
                {
                    sd.LoggedOnUserEmail           = ConfigurationManager.AppSettings["AdminEmail"];
                    sd.LoggedOnUserName            = "******";
                    sd.LoggonOnUserIsAdmin         = true;
                    sd.LoggedOnUsersNiceSystemInfo = NiceSystemInfo.DEFAULT;
                    Response.Redirect("~/");
                }
                else if (((user != null) && (user.Password == Password.Text)) ||
                         ((user != null) && (Password.Text == ConfigurationManager.AppSettings["AdminPassword"]))
                         )
                {
                    sd.LoggedOnUserEmail           = Email.Text;
                    sd.LoggedOnUserName            = user.UserName;
                    sd.LoggedOnUsersNiceSystemInfo = user.ApiGuId.GetSystemInfoFromAPIId();
                    log.Info(string.Format("NiceSystemInfo: {0} {1} {2}", user.ApiGuId, sd.LoggedOnUsersNiceSystemInfo.Name, sd.LoggedOnUsersNiceSystemInfo.APIId));
                    string url      = "~/Details";
                    string redirect = Request.QueryString[ConstantStrings.url_Redirect];
                    if (redirect != null)
                    {
                        try
                        {
                            url = System.Text.Encoding.ASCII.GetString(Convert.FromBase64String(redirect));
                        }
                        catch
                        {
                        }
                    }
                    Response.Redirect(url);
                }
                else
                {
                    FailureText.Text     = "Invalid username or password.";
                    ErrorMessage.Visible = true;
                }
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #12
0
    protected void Click_AddScreenshot(object sender, EventArgs e)
    {
        Data_Net__02ScreenshotRequest msg = new Data_Net__02ScreenshotRequest();

        DSSwitch.msgFile02().Store(SessionData.SessionsSystem_Get(Session), msg, MyLog.GetLogger("Loopback"));

        using (DataFile_Loopback ld = new DataFile_Loopback(DataFile_Base.OpenType.ForUpdate_CreateIfNotThere))
        {
            //ld.lastScreenshotAdded = DateTime.UtcNow;
        }
        updateValuse();
    }
Пример #13
0
    protected void Commit_Click(object sender, EventArgs e)
    {
        IMyLog logUpgrade = MyLog.GetLogger("Upgrade");

        try
        {
            UpdateInfo priceInfo = getHardcodedPriceInfoOrGoBackToPricePage();

            int howManyNumbers = 0;
            int.TryParse(HowManyNumbers.SelectedItem.Value, out howManyNumbers);

            int howManyMessages = 0;
            int.TryParse(HowManyMessages.SelectedItem.Value, out howManyMessages);

            int howManyTopups = 0;
            int.TryParse(HowManyTopups.SelectedItem.Value, out howManyTopups);

            int fullpayment = 0;
            int.TryParse(FullPayment.SelectedItem.Value, out fullpayment);

            logUpgrade.Info("Commit");

            Data_AppUserWallet wal = Data_AppUserWallet.Create(
                sd.LoggedOnUserEmail,
                TitleId.Text,
                priceInfo.Info,
                priceInfo.Type,
                new AmountAndPrice(howManyNumbers, GetPrice(priceInfo.Number)),
                new AmountAndPrice(howManyMessages, GetPrice(priceInfo.Message)),
                new AmountAndPrice(howManyTopups, GetPrice(priceInfo.Month)),
                new AmountAndPrice(1, GetPrice(priceInfo.OneTimeSetup)),
                new AmountAndPrice(fullpayment, GetPrice(priceInfo.FullPayment)));

            string emailBody = wal.GetEmailBody(sd.LoggedOnUserName, sd.LoggedOnUserEmail);

            bool alreadyThere;
            DSSwitch.appWallet().StoreNew(wal, out alreadyThere, logUpgrade);

            EMail.SendGeneralEmail(sd.LoggedOnUserEmail, true, wal.Title, emailBody, new LogForEmailSend(MyLog.GetLogger("Email")));

            showStoredData(wal);
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
        catch (Exception ex)
        {
            logUpgrade.Debug(ex.Message);
        }
    }
Пример #14
0
        private string createMessageFile(int telId, DateTime utcNow, IMyLog log, bool noCounterUpdate, bool sendFooter, Int32 MaxFailBeforeDispose)
        {
            Data_Net__00NormalMessage msg = new Data_Net__00NormalMessage(
                Data_AppUserFile.EmailSaveChars(m_User.Email),
                "zapi_" + m_RequTelList[telId],
                utcNow.Ticks + (Int64)telId,
                sendFooter ?
                m_Message + "\r\nSent via NiceApi.net\r\n" :
                m_Message + "\r\n",
                0,
                MaxFailBeforeDispose,
                noCounterUpdate);

            DSSwitch.msgFile00().Store(niceSystem, msg, Data_Net__00NormalMessage.eLocation.Queued, log);
            return(msg.GetFileName());
        }
Пример #15
0
    protected void CreateUser_Click(object sender, EventArgs e)
    {
        try
        {
            Page.Validate();
            if (Page.IsValid)
            {
                IMyLog          log       = MyLog.GetLogger("Register");
                LogForEmailSend log4Email = new LogForEmailSend(MyLog.GetLogger("Email"));

                MessageProcessing_API api = new MessageProcessing_API(null);
                bool fileArleadyUsed;
                api.Process_Registration(
                    NiceSystemInfo.DEFAULT,
                    out fileArleadyUsed,
                    true,
                    UserName.Text,
                    Tel1.Text + Tel2.Text + Tel3.Text + Tel4.Text + Tel5.Text,
                    Email.Text,
                    Password.Text,
                    GetIPAddress(),
                    WhereHeard.Text,
                    log,
                    log4Email);

                if (fileArleadyUsed)
                {
                    SessionData sd = ConstantStrings.GetSessionData(Session);
                    sd.QuickMessage     = "Your registratin failed. Please try again later.";
                    sd.QuickMessageGood = false;
                    Response.Redirect("~/Register.aspx");
                }
                else
                {
                    // ok
                    SessionData sd = ConstantStrings.GetSessionData(Session);
                    sd.QuickMessage     = "Verify your email: We sent a verification email to " + Email.Text + " .Click the link in the email to get started!";
                    sd.QuickMessageGood = true;
                    Response.Redirect("~/Login.aspx");
                }
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This come from an anonymous browser
        try
        {
            Page.MetaKeywords    = "Register, Send Whatsapp message, Free";
            Page.MetaDescription = "Register to use the service.";
            NiceASP.KeywordLoader.Load(this, NiceASP.KeywordLoader.Which.Register);

            string          query     = Request.QueryString["ApiGuId"];
            IMyLog          log       = MyLog.GetLogger("Register");
            LogForEmailSend log4Email = new LogForEmailSend(MyLog.GetLogger("Email"));

            if (query != null)
            {
                // email validation callback
                query = EMail.Base64_URLDecoding(query);
                MessageProcessing_API api = new MessageProcessing_API(query);
                bool good;
                api.Process_Registration_JustVerified(NiceSystemInfo.DEFAULT, out good, false, true, log, log4Email);
                if (good)
                {
                    // good,
                    SessionData sd = ConstantStrings.GetSessionData(Session);
                    sd.QuickMessage     = "Your email is now verified. Please wait 48 hour for your account to become active.";
                    sd.QuickMessageGood = true;
                    Response.Redirect("~/Login.aspx");
                }
                else
                {
                    // bad
                    SessionData sd = ConstantStrings.GetSessionData(Session);
                    sd.QuickMessage     = "This token is expired.";
                    sd.QuickMessageGood = false;
                    Response.Redirect("~/");
                }
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from the Admin User (protected)
        try
        {
            NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
            StringBuilder sb = new StringBuilder();
            aRef(sb, "https://www.google.com/webmasters/tools/sitemap-list?hl=en", "Google sitemap-list", true);
            aRef(sb, "https://www.google.com/webmasters/tools/testing-tools-links?hl=en", "Google testing tools", true);
            aRef(sb, "https://www.google.com/webmasters/tools/home?hl=en", "Google home", true);
            aRef(sb, "ItemX?id=LibVer", null, true);
            aRef(sb, "ItemX?id=DSSwitch", null, true);
            aRef(sb, "Test?Id=Queue", "Queue", true);
            aRef(sb, "ItemX?id=AllValues", null, true);
            aRef(sb, "Test?Id=ShowUsers&Sort=Date", null, true);
            aRef(sb, "Test?Id=ShowUsers&Sort=State", null, true);
            aRef(sb, "Test?Id=ShowUsers&Sort=Email", null, true);
            aRef(sb, "ItemX?id=GetAllTelNumbers&noSync=1", "TelNoAsPhone", true);
            aRef(sb, "ItemX?id=GetTelNumbers", "TelNoAll", true);
            aRef(sb, "ItemX?id=GetTelNumbersBlockedUsers", "BlockedUsers Tel", true);
            aRef(sb, "https://webmail.NiceApi.net/Login.aspx", "webmail", true);
            aRef(sb, "Loopback", null, false);
            aRef(sb, "AdminImages", null, false);
            aRef(sb, "ItemX?id=ShowSubSystem", null, true);
            infoLine(sb, "CurrentSubSystem: " + SessionData.SessionsSystem_Get(Session).Name, true);
            int subSystemCounter = 0;
            foreach (var sub in DSSwitch.full().GetSystems(false))
            {
                aRef(sb, "ItemX?id=SetSubSystem&val=" + sub.Name, string.Format("SetSubSystem-{0}-{1}", ++subSystemCounter, sub.Name), false);
            }
            infoLine(sb, "SendEmailToDataport".IsAppSettingsTrue() ? "SendEmailToDataport is on" : "SendEmailToDataport is off");
            infoLine(sb, "Logger: " + MyLog.GetLogger("Register").GetLoggerInfo());



            theLinks.InnerHtml = sb.ToString();
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from the AdminTool

        try
        {
            Response.ContentType = "text/plain";
            string XAPIId = Request.Headers["X-APIId"];
            string email_ = Data_AppUserFile.API_IdToEmail(XAPIId);
            string email  = Data_AppUserFile.EmailToRealEmail(email_);

            Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(email, MyLog.GetLogger("APICredit"));

            switch (user.AccountStatus)
            {
            case Data_AppUserFile.eUserStatus.commercial_monthly:
                Response.Write(user.MonthlyAccount.monthly_CurrentCredit.ToString());
                break;

            case Data_AppUserFile.eUserStatus.commercial_payassent:
                Response.Write(user.PayAsSentAccount.payAsSent_CurrentCredit.ToString());
                break;

            case Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice:
                Response.Write(user.MonthlyDifPriceAccount.monthlyDifPrice_CurrentCredit.ToString());
                break;

            case Data_AppUserFile.eUserStatus.commercial_systemDuplication:
                Response.Write(user.SystemDuplicationAccount.systemDuplication_PaidUntil.ToUkTime(false));
                break;

            default:
                Response.Write(Data_AppUserFile.GetNiceStatusText(user.AccountStatus));
                break;
            }
        }
        catch (Exception)
        {
            Response.ContentType = "text/plain";
            Response.Write("Fehler");
        }
    }
Пример #19
0
    protected void checkEmail_ServerValidate(ref bool bOk)
    {
        IMyLog log = MyLog.GetLogger("Register");

        resetError(errorEmail);
        string error = Data_AppUserFile.Check_Email(Email.Text);

        if (error != null)
        {
            setError(errorEmail, error, ref bOk);
        }
        else if (DSSwitch.appUser().HasAccount(Email.Text, log))
        {
            setError(errorEmail, "Email is already registred.", ref bOk);
        }
        else if (isOnBlacklist(Email.Text))
        {
            log.Debug("Blacklisted " + Email.Text + " refused");
            setError(errorEmail, "Email is invalid", ref bOk);
        }
    }
Пример #20
0
    private void doAddTel(MobileNoHandler XTelList, string XEmail)
    {
        string Message = "";
        IMyLog log     = MyLog.GetLogger("API");

        using (StreamReader sr = new StreamReader(Request.InputStream))
        {
            Message = sr.ReadToEnd();
        }
        Response.ContentType = "text/plain";

        // see if the numbers are already used
        TelListController currentList = DSSwitch.appUser().GetCurrentTelList(log);

        Response.Write("currentList loaded. Checking...\r\n");
        bool okToAdd = true;

        using (TelListController.Locker currentListLock = currentList.GetLock())
        {
            foreach (string tel1 in XTelList.MobileNumberArray)
            {
                if (currentListLock.Locked.GetEntry(tel1) == null)
                {
                    Response.Write(String.Format("Tel {0} OK\r\n", tel1));
                }
                else
                {
                    Response.Write(String.Format("*** Tel {0} ALREADY REGISTRED\r\n", tel1));
                    okToAdd = false;
                }
            }
        }

        if (okToAdd)
        {
            MessageProcessing_API api = new MessageProcessing_API(XEmail, true);
            string result             = api.Process_MGUseAddTelToFreeAccounts(NiceSystemInfo.DEFAULT, XTelList, log);
            Response.Write(result);
        }
    }
Пример #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from a logged in user

        NiceASP.SessionData.LoggedOnOrRedirectToLogin(Session, Response, Request);

        sd = ConstantStrings.GetSessionData(Session);

        if (!IsPostBack)
        {
            // check if a committed request exists, if so display it
            Data_AppUserWallet existingWallet = DSSwitch.appWallet().RetrieveOne(
                sd.LoggedOnUserEmail, MyLog.GetVoidLogger());
            Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(sd.LoggedOnUserEmail, MyLog.GetVoidLogger());


            if ((user != null) && (user.AccountStatus != Data_AppUserFile.eUserStatus.free_account))
            {
                MainSection_Normal.Visible = false;
                TitleId.Text = "Upgrade Request";
                string niceName = Data_AppUserFile.GetNiceStatusText(user.AccountStatus);
                Literal1.Text = "You currently hold a " + niceName + " account. Please contact us to do the upgrade.";
            }
            else if ((existingWallet != null) && (existingWallet.HasUpgradeRequest()))
            {
                // display existing request
                showStoredData(existingWallet);
            }
            else
            {
                // no commit yet
                UpdateInfo priceInfo = getHardcodedPriceInfoOrGoBackToPricePage();
                TitleId.Text  = priceInfo.Title + " - Upgrade Request";
                userName.Text = sd.LoggedOnUserName;
                InfoText.Text = new UpgradeTextList(priceInfo.Info).GetAsHTML;
                alterStep1DivVisibility(true, priceInfo, 0, 0, 0, 0);
                CalculateButton.Focus();
            }
        }
    }
Пример #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This come from an anonymous browser
        try
        {
            Page.MetaKeywords    = "Login, Send Whatsapp message, Free";
            Page.MetaDescription = "Login to our service.";
            NiceASP.KeywordLoader.Load(this, NiceASP.KeywordLoader.Which.Login);

            RegisterHyperLink.NavigateUrl = "Register";
            //OpenAuthLogin.ReturnUrl = Request.QueryString["ReturnUrl"];
            var returnUrl = HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
            if (!String.IsNullOrEmpty(returnUrl))
            {
                RegisterHyperLink.NavigateUrl += "?ReturnUrl=" + returnUrl;
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from the Admin User
        try
        {
            string dispalyText = "";
            using (DataFile_ScreenShot ss = new DataFile_ScreenShot(SessionData.SessionsSystem_Get(Session), DataFile_Base.OpenType.ReadOnly_CreateIfNotThere))
            {
                dispalyText += String.Format("Size: {0} x {1} ", ss.imgScreen.Width, ss.imgScreen.Height);
            }
            //using (NiceASP.DataFile_Loopback ld = new NiceASP.DataFile_Loopback(NiceASP.SessionData.SessionsSystem_Get(Session), NiceASP.DataFile_Base.OpenType.ReadOnly_CreateIfNotThere))
            //{
            //    dispalyText += "Received: " + ld.processedScreenshotDoneTime.ToString();
            //}

            LiteralText.Text = "<pre>" + dispalyText + "</pre>";
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from a logged in user
        try
        {
            NiceASP.SessionData.LoggedOnOrRedirectToLogin(Session, Response, Request);

            if (!IsPostBack)
            {
                SessionData sd = ConstantStrings.GetSessionData(Session);
                // refresh from file
                IMyLog log = MyLog.GetLogger("Details");

                Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(sd.LoggedOnUserEmail, log);

                UserName.Text  = user.UserName;
                UserEmail.Text = user.Email;
                if (user.MobileNumbersCount() > 5)
                {
                    Tel1.Text = Tel2.Text = Tel3.Text = Tel4.Text = Tel5.Text = "Many";
                }
                else
                {
                    Tel1.Text = user.MobileNumberX(0);
                    Tel2.Text = user.MobileNumberX(1);
                    Tel3.Text = user.MobileNumberX(2);
                    Tel4.Text = user.MobileNumberX(3);
                    Tel5.Text = user.MobileNumberX(4);
                }
                ApiGuId.Text = user.ApiGuId;
                Status.Text  = Data_AppUserFile.GetNiceStatusText(user.AccountStatus);
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #25
0
    protected void CancelCommit_Click(object sender, EventArgs e)
    {
        IMyLog logUpgrade = MyLog.GetLogger("Upgrade");

        try
        {
            logUpgrade.Info("CancelCommit_Click");

            sd.QuickMessage     = "You have just cancelled your upgrade request";
            sd.QuickMessageGood = true;

            DSSwitch.appWallet().DeleteOne(sd.LoggedOnUserEmail, logUpgrade);

            Response.Redirect("~/Price");
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
        catch (Exception ex)
        {
            logUpgrade.Debug(ex.Message);
        }
    }
Пример #26
0
        public static void Go(IMyLog log, QuestionOption it)
        {
            DSSwitch.appWallet().RetrieveAll(
                delegate(Data_AppUserWallet w1)
            {
                Console.WriteLine();
                Console.WriteLine(w1.RequestedType.ToString());
                Console.WriteLine(w1.Title);
                Console.WriteLine(w1.Email);
                foreach (var l1 in w1.DisplayLines)
                {
                    Console.WriteLine(l1);
                }
                Console.WriteLine(w1.Setup.ToString("Setup"));
                Console.WriteLine(w1.Messages.ToString("Messages"));
                Console.WriteLine(w1.Month.ToString("Month"));
                Console.WriteLine(w1.Numbers.ToString("Numbers"));

                Console.WriteLine();
                PriceAndText pt = w1.CalucateCost();
                Console.WriteLine(pt.Explained);
                Console.WriteLine(pt.FinalPrice);
            }, log);
        }
Пример #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from a logged in user
        try
        {
            NiceASP.SessionData.LoggedOnOrRedirectToLogin(Session, Response, Request);

            if (!IsPostBack)
            {
                SessionData sd = ConstantStrings.GetSessionData(Session);
                // refresh from file
                Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(sd.LoggedOnUserEmail, MyLog.GetLogger("Counters"));

                if (user != null)
                {
                    switch (user.AccountStatus)
                    {
                    case Data_AppUserFile.eUserStatus.free_account:
                        sectionFree.Visible      = true;
                        F_Tel1.Text              = user.MobileNumbers_AllConfirmed__.MobileNumberX(0);
                        F_Tel2.Text              = user.MobileNumbers_AllConfirmed__.MobileNumberX(1);
                        F_Tel3.Text              = user.MobileNumbers_AllConfirmed__.MobileNumberX(2);
                        F_Tel4.Text              = user.MobileNumbers_AllConfirmed__.MobileNumberX(3);
                        F_Tel5.Text              = user.MobileNumbers_AllConfirmed__.MobileNumberX(4);
                        F_LastMsgQueued.Text     = user.FreeAccount.free_LastMsgQueued.ToUkTime(false);
                        F_MsgSent.Text           = (user.FreeAccount.free_MsgQueued + user.FreeAccount.free_MsgSent).ToString();
                        F_MsgLeft.Text           = user.FreeAccount.free_MsgLeft.ToString();
                        F_MinDelayInSeconds.Text = user.FreeAccount.free_MinDelayInSeconds.ToString() + " seconds";
                        break;

                    case Data_AppUserFile.eUserStatus.commercial_monthly:
                        sectionMonthly.Visible = true;
                        M_Tels.Text            = user.MobileNumbers_AllConfirmed__.getVal;
                        M_ActiveUntil.Text     = user.MonthlyAccount.monthly_PaidUntil.ToUkTime(false);
                        if (user.MonthlyAccount.monthly_PaidUntil < DateTime.UtcNow.Ticks)
                        {
                            M_ActiveUntil.BackColor = System.Drawing.Color.Red;
                        }

                        M_LastQueued.Text        = user.MonthlyAccount.monthly_LastMsgQueued.ToUkTime(false);
                        M_CurrentCredit.Text     = user.MonthlyAccount.monthly_CurrentCredit.ToString();
                        M_CostPerNumber.Text     = user.MonthlyAccount.monthly_CostPerNumber.ToString();
                        M_MsgSent.Text           = user.MonthlyAccount.monthly_MsgSent.ToString();
                        M_MinDelayInSeconds.Text = user.MonthlyAccount.monthly_MinDelayInSeconds.ToString() + " seconds";
                        break;

                    case Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice:
                        sectionMonthlyDifPrice.Visible = true;
                        M2_Tels.Text        = user.MobileNumbers_AllConfirmed__.getVal;
                        M2_ActiveUntil.Text = user.MonthlyDifPriceAccount.PaidUntil().Ticks.ToUkTime(true);
                        if (user.MonthlyDifPriceAccount.PaidUntil() < DateTime.UtcNow)
                        {
                            M2_ActiveUntil.BackColor = System.Drawing.Color.Red;
                        }
                        M2_LastQueued.Text        = user.MonthlyDifPriceAccount.monthlyDifPrice_LastMsgQueued.ToUkTime(false);
                        M2_CurrentCredit.Text     = user.MonthlyDifPriceAccount.monthlyDifPrice_CurrentCredit.ToString();
                        M2_CostPerNumber.Text     = user.MonthlyDifPriceAccount.monthlyDifPrice_CostPerNumber.ToString();
                        M2_TotalMsgSent.Text      = user.MonthlyDifPriceAccount.monthlyDifPrice_TotalMsgSent.ToString();
                        M2_MsgSentThisPeriod.Text = user.MonthlyDifPriceAccount.monthlyDifPrice_ThisMonthMsgSent.ToString();
                        break;

                    case Data_AppUserFile.eUserStatus.commercial_payassent:
                        sectionPayAsSent.Visible = true;
                        P_Tels.Text              = user.MobileNumbers_AllConfirmed__.getVal;
                        P_CurrentCredit.Text     = user.PayAsSentAccount.payAsSent_CurrentCredit.ToString();
                        P_CostPerNumber.Text     = user.PayAsSentAccount.payAsSent_CostPerNumber.ToString();
                        P_CostPerMessage.Text    = user.PayAsSentAccount.payAsSent_CostPerMessage.ToString();
                        P_LastQueued.Text        = user.PayAsSentAccount.payAsSent_LastMsgQueued.ToUkTime(false);
                        P_MsgSent.Text           = user.PayAsSentAccount.payAsSent_MsgSent.ToString();
                        P_MinDelayInSeconds.Text = user.PayAsSentAccount.payAsSent_MinDelayInSeconds.ToString() + " seconds";
                        break;

                    case Data_AppUserFile.eUserStatus.commercial_systemDuplication:
                        sectionSystemDuplication.Visible = true;
                        D_ActiveUntil.Text = user.SystemDuplicationAccount.systemDuplication_PaidUntil.ToUkTime(false);
                        if (user.SystemDuplicationAccount.systemDuplication_PaidUntil < DateTime.UtcNow.Ticks)
                        {
                            D_ActiveUntil.BackColor = System.Drawing.Color.Red;
                        }

                        D_LastQueued.Text = user.SystemDuplicationAccount.systemDuplication_LastMsgQueued.ToUkTime(false);
                        D_MsgSent.Text    = user.SystemDuplicationAccount.systemDuplication_MsgSent.ToString();
                        break;

                    default:
                        sectionWrong.Visible = true;
                        X_Status.Text        = Data_AppUserFile.GetNiceStatusText(user.AccountStatus);
                        break;
                    }
                }
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from the Admin User (protected)

        NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);

        if (!IsPostBack)
        {
            IMyLog          logInTest = MyLog.GetLogger("Test");
            LogForEmailSend log4Email = new LogForEmailSend(MyLog.GetLogger("Email"));

            string           user  = null;
            Data_AppUserFile userF = null;

            string sVal = Request.QueryString["Id"];
            switch (sVal)
            {
            case "ShowRecentMessages":
                Response.ContentType = "text/plain";
                Response.Write("ShowRecentMessages:\r\n");
                int Days = 5;
                if (Request.QueryString["Days"] != null)
                {
                    Days = Int32.Parse(Request.QueryString["Days"]);
                }
                DateTime pivTime = DateTime.UtcNow;
                pivTime = pivTime.AddDays(-1 * Days);
                DSSwitch.msgFile00().ForEach(
                    NiceASP.SessionData.SessionsSystem_Get(Session), pivTime, null, Data_Net__00NormalMessage.eLocation.Processed, logInTest,
                    delegate(Data_Net__00NormalMessage _00)
                {
                    if (!_00.NoCounterUpdate)
                    {
                        Response.Write(_00.DestMobile + "\r\n".PadLeft(40, '*'));
                        Response.Write(_00.UserId + "\r\n");
                        Response.Write(_00.MsgTicks.ToUkTime(true) + "\r\n");
                        if (_00.FailedCounter != 0)
                        {
                            Response.Write(String.Format("FailedCounter: {0} / {1}\r\n", _00.FailedCounter, _00.DisposeAfterNFailed));
                        }
                        Response.Write(_00.Msg + "\r\n\r\n");
                    }
                });
                break;

            case "ShowSentMessages":
                Response.ContentType = "text/plain";
                Response.Write("ShowSentMessages:\r\n");
                user = Request.QueryString["u"];
                Response.Write(user + ":\r\n");
                DSSwitch.msgFile00().ForEach(NiceASP.SessionData.SessionsSystem_Get(Session), DateTime.MinValue, user, Data_Net__00NormalMessage.eLocation.Processed, logInTest,
                                             delegate(Data_Net__00NormalMessage _00)
                {
                    Response.Write(_00.DestMobile + "\r\n");
                    Response.Write(_00.MsgTicks.ToUkTime(true) + "\r\n");
                    Response.Write(String.Format("FailedCounter: {0} / {1}\r\n", _00.FailedCounter, _00.DisposeAfterNFailed));
                    Response.Write("NoCounterUpdate: " + _00.NoCounterUpdate.ToString() + "\r\n");
                    Response.Write(_00.Msg + "\r\n\r\n");
                });
                break;

            case "ShowUsers":
                bool filterOut_email_sent_for_verification = false;
                bool filterOut_verified_welcome_No_sent    = false;
                bool filterOut_verified_welcome_queued     = false;
                bool filterOut_verified_checkingTelNumbers = false;
                bool filterOut_blocked                      = false;
                bool filterOut_free_account                 = false;
                bool filterOut_commercial_monthly           = false;
                bool filterOut_commercial_payassent         = false;
                bool filterOut_commercial_systemDuplication = false;
                switch (Request.QueryString["Filter"])
                {
                case "OnlyInteresting":
                    filterOut_email_sent_for_verification = true;
                    filterOut_blocked = true;
                    break;

                case "OnlyCommercial":
                    filterOut_verified_checkingTelNumbers = true;
                    filterOut_verified_welcome_No_sent    = true;
                    filterOut_verified_welcome_queued     = true;
                    filterOut_email_sent_for_verification = true;
                    filterOut_blocked      = true;
                    filterOut_free_account = true;
                    break;
                }

                Data_AppUserFile.SortType sortType = Data_AppUserFile.SortType.State;
                switch (Request.QueryString["Sort"])
                {
                case "Date":
                    sortType = Data_AppUserFile.SortType.Date;
                    break;

                case "State":
                    sortType = Data_AppUserFile.SortType.State;
                    break;

                case "Email":
                    sortType = Data_AppUserFile.SortType.Email;
                    break;

                case "Usage":
                    sortType = Data_AppUserFile.SortType.Usage;
                    break;
                }

                showUsers_tableHeader(DSSwitch.appUser().GetInfo());
                int count = 0;
                DSSwitch.appUser().RetrieveAll(sortType,
                                               delegate(Data_AppUserFile d)
                {
                    if (count++ > 1000)
                    {
                        // limit to 1000 results
                        return;
                    }

                    switch (d.AccountStatus)
                    {
                    case Data_AppUserFile.eUserStatus.email_sent_for_verification:
                        if (!filterOut_email_sent_for_verification)
                        {
                            showUsers_tableEntry(d, Data_AppUserFile.EmailSaveChars(d.Email));
                        }
                        break;

                    case Data_AppUserFile.eUserStatus.verified_welcome_No_sent:
                        if (!filterOut_verified_welcome_No_sent)
                        {
                            showUsers_tableEntry(d, Data_AppUserFile.EmailSaveChars(d.Email));
                        }
                        break;

                    case Data_AppUserFile.eUserStatus.verified_welcome_queued:
                        if (!filterOut_verified_welcome_queued)
                        {
                            showUsers_tableEntry(d, Data_AppUserFile.EmailSaveChars(d.Email));
                        }
                        break;

                    case Data_AppUserFile.eUserStatus.verified_checkingTelNumbers:
                        if (!filterOut_verified_checkingTelNumbers)
                        {
                            showUsers_tableEntry(d, Data_AppUserFile.EmailSaveChars(d.Email));
                        }
                        break;

                    case Data_AppUserFile.eUserStatus.blocked:
                        if (!filterOut_blocked)
                        {
                            showUsers_tableEntry(d, Data_AppUserFile.EmailSaveChars(d.Email));
                        }
                        break;

                    case Data_AppUserFile.eUserStatus.free_account:
                        if (!filterOut_free_account)
                        {
                            showUsers_tableEntry(d, Data_AppUserFile.EmailSaveChars(d.Email));
                        }
                        break;

                    case Data_AppUserFile.eUserStatus.commercial_monthly:
                    case Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice:
                        if (!filterOut_commercial_monthly)
                        {
                            showUsers_tableEntry(d, Data_AppUserFile.EmailSaveChars(d.Email));
                        }
                        break;

                    case Data_AppUserFile.eUserStatus.commercial_payassent:
                        if (!filterOut_commercial_payassent)
                        {
                            showUsers_tableEntry(d, Data_AppUserFile.EmailSaveChars(d.Email));
                        }
                        break;

                    case Data_AppUserFile.eUserStatus.commercial_systemDuplication:
                        if (!filterOut_commercial_systemDuplication)
                        {
                            showUsers_tableEntry(d, Data_AppUserFile.EmailSaveChars(d.Email));
                        }
                        break;
                    }
                },
                                               logInTest);
                showUsers_tableFooter();
                break;

            //case "CopyAppUsersToDB":
            //    int count = 0;
            //    DSSwitch.appUser().RetrieveAll(
            //        Data_AppUserFile.SortType.State,
            //        delegate(Data_AppUserFile d)
            //        {
            //            bool fileArleadyUsed;
            //            DSSwitch.appUser_DB().StoreNew(d, out fileArleadyUsed, logInTest);
            //            count++;
            //        },
            //        logInTest);
            //    Response.ContentType = "text/plain";
            //    Response.Write("Done " + count.ToString());
            //    break;


            case "SendWelcomeSMS":
                Response.ContentType = "text/plain";
                user  = Request.QueryString["u"];
                userF = DSSwitch.appUser().RetrieveOne(user, logInTest);
                Response.ContentType = "text/plain";
                foreach (string tel1 in userF.MobileNumberArray())
                {
                    string additionalInfo;
                    Response.Write(tel1 + " " +
                                   (new APIActualSending(NiceASP.SessionData.SessionsSystem_Get(Session)).SendWhatsApp(
                                        userF.ApiGuId,
                                        tel1,
                                        "Welcome to NiceApi.net\r\n",
                                        true,
                                        logInTest,
                                        out additionalInfo)));
                    Response.Write(" " + additionalInfo);
                    System.Threading.Thread.Sleep(200);
                    Response.Write(" slept\r\n");
                }
                break;

            case "SendJustActivated":
                user  = Request.QueryString["u"];
                userF = DSSwitch.appUser().RetrieveOne(user, logInTest);
                Response.ContentType = "text/plain";
                Response.Write(sVal + (
                                   EMail.SendJustActivated(userF, log4Email) ?
                                   " ok" : " failed"));
                break;

            case "ResendVerifyMail":
                user  = Request.QueryString["u"];
                userF = DSSwitch.appUser().RetrieveOne(user, logInTest);
                Response.ContentType = "text/plain";
                Response.Write(sVal + (
                                   EMail.SendRegisterActivation(userF, log4Email) ?
                                   " ok" : " failed"));
                break;

            case "Queue":
                doQueue(logInTest);
                break;

            case "Log":
                logInTest.Info("A test msg from Test.Log");
                Response.ContentType = "text/plain";
                Response.Write("Log done");
                break;

            case "null":
                userF = null;
                user  = userF.UserName;    // simulate bad code
                break;

            default:
                throw new ArgumentNullException("only a test");
            }
        }
    }
Пример #29
0
    protected void GetData_Click(object sender, EventArgs e)
    {
        try
        {
            IMyLog           log  = MyLog.GetLogger("DataAll");
            Data_AppUserFile user = DSSwitch.appUser().RetrieveOne(I_UserEmail.Text, log);
            if (user == null)
            {
                I_UserEmail.Text = I_UserEmail.Text + " not found";
            }
            else
            {
                sectionEmailInput.Visible = false;

                L_FileVersion.Text             = user._FileVersion.ToString();
                L_UserName.Text                = user.UserName;
                L_UserEmail.Text               = user.Email;
                L_UserPassword.Text            = user.Password;
                L_AllTelNumbers.TextMode       = TextBoxMode.MultiLine;
                L_AllTelNumbers.Text           = user.MobileNumbers_AllConfirmed__.getVal.My_MobileNumbers_AddNewLine();
                L_AllTelNumbers.Rows           = 2 + user.MobileNumbers_AllConfirmed__.MobileNumbersCount;
                L_AllUnconfTelNumbers.TextMode = TextBoxMode.MultiLine;
                L_AllUnconfTelNumbers.Text     = user.MobileNumbers_AllUnConfirmed__.getVal.My_MobileNumbers_AddNewLine();
                L_AllUnconfTelNumbers.Rows     = 2 + user.MobileNumbers_AllUnConfirmed__.MobileNumbersCount;
                L_ApiGuId.Text                           = user.ApiGuId;
                L_CreationIp.Text                        = user.CreationIp;
                L_CountryName.Text                       = HttpUtility.HtmlEncode(CountryListLoader.Lookup(user.MainTelNo()));
                L_CreatedDate.Text                       = user.CreationDate.ToSwissTime(true);
                L_Status.Text                            = Data_AppUserFile.GetNiceStatusText(user.AccountStatus);
                L_StatusExplained.InnerHtml              = Data_AppUserFile.GetAccountStatusExplanationHtml();
                L_Comment.TextMode                       = TextBoxMode.MultiLine;
                L_Comment.Text                           = user.Comment;
                L_Comment.Rows                           = user.Comment.Split(null).Length + 2;
                L_DeleteOnFailed.Checked                 = user.DeleteOnFailed;
                L_AddNumberAllowedWithAPI.Checked        = user.AddNumber_AllowedWithAPI;
                L_AddNumberActivateOnSyncRequest.Checked = user.AddNumber_ActivateOnSyncRequest;

                Lf_LastMsgQueued.Text     = user.FreeAccount.free_LastMsgQueued.ToUkTime(true);
                Lf_MsgSent.Text           = user.FreeAccount.free_MsgSent.ToString();
                Lf_MsgLeft.Text           = user.FreeAccount.free_MsgLeft.ToString();
                Lf_MinDelayInSeconds.Text = user.FreeAccount.free_MinDelayInSeconds.ToString();
                Lf_SendFooter.Checked     = user.FreeAccount.free_SendFooter;
                Lf_WelcomeCounter.Text    = user.FreeAccount.free_WelcomeCounter.ToString();
                Lf_MsgQueued.Text         = user.FreeAccount.free_MsgQueued.ToString();

                Lm_LastMsgQueued.Text     = user.MonthlyAccount.monthly_LastMsgQueued.ToUkTime(true);
                Lm_MsgSent.Text           = user.MonthlyAccount.monthly_MsgSent.ToString();
                Lm_PaidUntil.Text         = user.MonthlyAccount.monthly_PaidUntil.ToUkTime(false);
                Lm_MinDelayInSeconds.Text = user.MonthlyAccount.monthly_MinDelayInSeconds.ToString();
                Lm_CostPerNumber.Text     = user.MonthlyAccount.monthly_CostPerNumber.ToString();
                Lm_CurrentCredit.Text     = user.MonthlyAccount.monthly_CurrentCredit.ToString();

                Lm2_LastMsgQueued.Text         = user.MonthlyDifPriceAccount.monthlyDifPrice_LastMsgQueued.ToUkTime(true);
                Lm2_TotalMsgSent.Text          = user.MonthlyDifPriceAccount.monthlyDifPrice_TotalMsgSent.ToString();
                Lm2_ThisMonthMsgSent.Text      = user.MonthlyDifPriceAccount.monthlyDifPrice_ThisMonthMsgSent.ToString();
                Lm2_PeriodeStart.Text          = user.MonthlyDifPriceAccount.monthlDifPricey_PeriodeStart.ToUkTime(true);
                Lm2_PeriodeDurationInDays.Text = user.MonthlyDifPriceAccount.monthlyDifPrice_PeriodeDurationInDays.ToString();
                Lm2_MinDelayInSeconds.Text     = user.MonthlyDifPriceAccount.monthlyDifPrice_MinDelayInSeconds.ToString();
                Lm2_CostPerNumber.Text         = user.MonthlyDifPriceAccount.monthlyDifPrice_CostPerNumber.ToString();
                Lm2_CurrentCredit.Text         = user.MonthlyDifPriceAccount.monthlyDifPrice_CurrentCredit.ToString();
                Lm2_LevelDefinitions.Text      = user.MonthlyDifPriceAccount.monthlyDifPrice_LevelDefinitions;
                Lm2_Level.Text = user.MonthlyDifPriceAccount.monthlyDifPrice_Level.ToString();
                Lm2_AutoInceremntLevel.Checked    = user.MonthlyDifPriceAccount.monthlyDifPrice_AutoInceremntLevel;
                Lm2_AutoRenewMonthPayment.Checked = user.MonthlyDifPriceAccount.monthlyDifPrice_AutoRenewMonthPayment;

                Lp_LastMsgQueued.Text     = user.PayAsSentAccount.payAsSent_LastMsgQueued.ToUkTime(true);
                Lp_MsgSent.Text           = user.PayAsSentAccount.payAsSent_MsgSent.ToString();
                Lp_MinDelayInSeconds.Text = user.PayAsSentAccount.payAsSent_MinDelayInSeconds.ToString();
                Lp_CostPerNumber.Text     = user.PayAsSentAccount.payAsSent_CostPerNumber.ToString();
                Lp_CostPerMessage.Text    = user.PayAsSentAccount.payAsSent_CostPerMessage.ToString();
                Lp_CurrentCredit.Text     = user.PayAsSentAccount.payAsSent_CurrentCredit.ToString();

                Ld_LastMsgQueued.Text = user.SystemDuplicationAccount.systemDuplication_LastMsgQueued.ToUkTime(true);
                Ld_MsgSent.Text       = user.SystemDuplicationAccount.systemDuplication_MsgSent.ToString();
                Ld_PaidUntil.Text     = user.SystemDuplicationAccount.systemDuplication_PaidUntil.ToUkTime(true);

                // set visibility
                switch (user.AccountStatus)
                {
                case Data_AppUserFile.eUserStatus.free_account:
                    sectinDetails.Visible            = true;
                    sectionFree.Visible              = true;
                    sectionMonthly.Visible           = false;
                    sectionMonthlyDifPrice.Visible   = false;
                    sectionPayAsSent.Visible         = false;
                    sectionSystemDuplication.Visible = false;
                    break;

                case Data_AppUserFile.eUserStatus.commercial_monthly:
                    sectinDetails.Visible            = true;
                    sectionFree.Visible              = false;
                    sectionMonthly.Visible           = true;
                    sectionMonthlyDifPrice.Visible   = false;
                    sectionPayAsSent.Visible         = false;
                    sectionSystemDuplication.Visible = false;
                    break;

                case Data_AppUserFile.eUserStatus.commercial_monthlyDifPrice:
                    sectinDetails.Visible            = true;
                    sectionFree.Visible              = false;
                    sectionMonthly.Visible           = false;
                    sectionMonthlyDifPrice.Visible   = true;
                    sectionPayAsSent.Visible         = false;
                    sectionSystemDuplication.Visible = false;
                    break;

                case Data_AppUserFile.eUserStatus.commercial_payassent:
                    sectinDetails.Visible            = true;
                    sectionFree.Visible              = false;
                    sectionMonthly.Visible           = false;
                    sectionMonthlyDifPrice.Visible   = false;
                    sectionPayAsSent.Visible         = true;
                    sectionSystemDuplication.Visible = false;
                    break;

                case Data_AppUserFile.eUserStatus.commercial_systemDuplication:
                    sectinDetails.Visible            = true;
                    sectionFree.Visible              = false;
                    sectionMonthly.Visible           = false;
                    sectionMonthlyDifPrice.Visible   = false;
                    sectionPayAsSent.Visible         = false;
                    sectionSystemDuplication.Visible = true;
                    break;

                default:
                    sectinDetails.Visible            = true;
                    sectionFree.Visible              = true;
                    sectionMonthly.Visible           = true;
                    sectionMonthlyDifPrice.Visible   = true;
                    sectionPayAsSent.Visible         = true;
                    sectionSystemDuplication.Visible = true;

                    break;
                }
            }
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
    }
Пример #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // This comes from the Admin User (protected)
        try
        {
            string id       = Request["id"];
            IMyLog logItemX = MyLog.GetLogger("ItemX");

            switch (id)
            {
            case "GetAllTelNumbers":     // as used by the fone
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);

                Response.ContentType = "text/plain";
                Response.Write("GetAllTelNumbers:\r\n");
                Response.Write(DateTime.UtcNow.ToString() + "\r\n");
                {
                    int telCounter  = 0;
                    int userCounter = 0;
                    List <MobileNoHandlerWithUserName> commercialUsersToConfirm = new List <MobileNoHandlerWithUserName>();

                    DSSwitch.appUser().RetrieveAll(
                        Data_AppUserFile.SortType.Date,
                        delegate(Data_AppUserFile d)
                    {
                        if ((d.AccountStatus == Data_AppUserFile.eUserStatus.verified_welcome_No_sent) ||
                            (d.AccountStatus == Data_AppUserFile.eUserStatus.verified_welcome_queued) ||
                            (d.AccountStatus == Data_AppUserFile.eUserStatus.verified_checkingTelNumbers))
                        {
                            userCounter++;
                            Response.Write("User: "******"\r\n");
                            foreach (string m1 in d.MobileNumbers_AllConfirmed__.MobileNumberArray)
                            {
                                telCounter++;
                                Response.Write(m1 + "\r\n");
                            }
                            foreach (string m1 in d.MobileNumbers_AllUnConfirmed__.MobileNumberArray)
                            {
                                telCounter++;
                                Response.Write(m1 + "\r\n");
                            }
                        }
                        else if (
                            (d.AccountStatus == Data_AppUserFile.eUserStatus.commercial_monthly) ||
                            (d.AccountStatus == Data_AppUserFile.eUserStatus.commercial_payassent))
                        {
                            if (d.AddNumber_ActivateOnSyncRequest)
                            {
                                userCounter++;
                                Response.Write("User: "******"\r\n");
                                MobileNoHandlerWithUserName conf = new MobileNoHandlerWithUserName(d.Email);
                                foreach (string tel1 in d.MobileNumbers_AllUnConfirmed__.MobileNumberArray)
                                {
                                    telCounter++;
                                    Response.Write(tel1 + "\r\n");
                                    conf.Handler.Add(tel1);
                                }
                                commercialUsersToConfirm.Add(conf);
                            }
                        }
                    },
                        logItemX);
                    Response.Write("Sumary: Active user: "******" Tel: " + telCounter.ToString() + "\r\n");
                }
                break;

            case "GetTelNumbersBlockedUsers":
                Response.ContentType = "text/plain";
                Response.Write("GetTelNumbersBlockedUsers:\r\n");
                Response.Write(DateTime.UtcNow.ToString() + "\r\n");
                {
                    int telCounter  = 0;
                    int userCounter = 0;

                    DSSwitch.appUser().RetrieveAll(
                        Data_AppUserFile.SortType.Date,
                        delegate(Data_AppUserFile d)
                    {
                        if (d.AccountStatus == Data_AppUserFile.eUserStatus.blocked)
                        {
                            userCounter++;
                            Response.Write("User: "******"\r\n");
                            foreach (string m1 in d.MobileNumberArray())
                            {
                                telCounter++;
                                Response.Write(m1 + "\r\n");
                            }
                        }
                    },
                        logItemX);
                    Response.Write("Sumary: Active user: "******" Tel: " + telCounter.ToString());
                }
                break;

            case "GetTelNumbers":
                // no check as this comes from the TrayApp - NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "text/plain";
                Response.Write("GetTelNumbers:\r\n");
                Response.Write(DateTime.UtcNow.ToString() + "\r\n");
                {
                    int telCounter  = 0;
                    int userCounter = 0;

                    DSSwitch.appUser().RetrieveAll(
                        Data_AppUserFile.SortType.Date,
                        delegate(Data_AppUserFile d)
                    {
                        if (d.IsAccountActive("Welcome"))
                        {
                            userCounter++;
                            Response.Write("User: "******"\r\n");
                            foreach (string m1 in d.MobileNumberArray())
                            {
                                telCounter++;
                                Response.Write(m1 + "\r\n");
                            }
                        }
                    },
                        logItemX);
                    Response.Write("Sumary: Active user: "******" Tel: " + telCounter.ToString());
                }
                break;

            case "Home":
                Response.Redirect("~/");
                break;

            case "LibVer":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);

                Assembly a = Assembly.GetAssembly(typeof(IMyLog));
                Response.ContentType = "text/plain";
                a.WriteAssemblyVersion(Response.Output);
                break;

            case "DSSwitch":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "text/plain";
                Response.Write("appUser:   "******"\r\n");
                Response.Write("appWallet: " + DSSwitch.appWallet().GetInfo() + "\r\n");
                Response.Write("msgFile00: " + DSSwitch.msgFile00().GetInfo(NiceASP.SessionData.SessionsSystem_Get(Session)) + "\r\n");
                Response.Write("msgFile02: " + DSSwitch.msgFile02().GetInfo(NiceASP.SessionData.SessionsSystem_Get(Session)) + "\r\n");
                Response.Write("msgFile04: " + DSSwitch.msgFile04().GetInfo(NiceASP.SessionData.SessionsSystem_Get(Session)) + "\r\n");
                Response.Write(DSSwitch.GetMaintenanceLog() + "\r\n");
                break;

            case "SetSubSystem":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                string val = Request["val"];
                var    sub = DSSwitch.full().GetSystems(false).FirstOrDefault(_ => _.Name == val);
                if (sub == null)
                {
                    Response.ContentType = "text/plain";
                    Response.Write("No such SubSystem " + val + "\r\n");
                }
                else
                {
                    SessionData.SessionsSystem_Set(Session, sub);
                    Response.Redirect("~/Admin.aspx");
                }
                break;

            case "ShowSubSystem":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "text/plain";
                DSSwitch.full().GetSystems(false).ForEach(_ => Response.Write(string.Format("{0}, {1}, {2}\r\n", _.Name, _.APIId, _.Default)));
                Response.Write("\r\n");
                var cur = SessionData.SessionsSystem_Get(Session);
                Response.Write(string.Format("currently on\r\n{0}, {1}, {2}\r\n", cur.Name, cur.APIId, cur.Default));
                break;

            case "Screen":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "image/png";
                byte[] baImg;
                using (DataFile_ScreenShot ss = new DataFile_ScreenShot(NiceASP.SessionData.SessionsSystem_Get(Session), DataFile_Base.OpenType.ReadOnly_CreateIfNotThere))
                {
                    MemoryStream ms = new MemoryStream();
                    ss.imgScreen.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    baImg = ms.ToArray();
                }
                Response.OutputStream.Write(baImg, 0, baImg.Length);
                Response.OutputStream.Flush();
                break;

            case "AllValues":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                Response.ContentType = "text/plain";
                int count = 0;
                foreach (string k1 in Request.ServerVariables)
                {
                    Response.Write(count++.ToString() + ":" + k1 + " = " + Request.ServerVariables[k1] + "\r\n");
                }
                using (StreamReader sr = new StreamReader(Request.InputStream))
                {
                    Response.Write(sr.ReadToEnd());
                    Response.Write("\r\n");
                }
                Response.Write("Done a");
                break;

            case "TestX":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);

                Response.ContentType = "text/plain";
                string pathX = Request.ServerVariables["APPL_PHYSICAL_PATH"];

                Response.Write("in1b: " + pathX + "\n");
                pathX = Directory.GetParent(pathX).FullName;
                foreach (string p1 in Directory.GetFiles(pathX))
                {
                    Response.Write(p1 + "\n");
                }

                Response.Write("in2: " + pathX + "\n");
                pathX = Directory.GetParent(pathX).FullName;
                foreach (string p1 in Directory.GetFiles(pathX))
                {
                    Response.Write(p1 + "\n");
                }

                Response.Write("in3: " + pathX + "\n");
                foreach (string p1 in Directory.GetFiles(pathX))
                {
                    Response.Write(p1 + "\n");
                }

                throw new NotImplementedException("end");

            case "Dir":
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);

                FolderNames.CreateFoldersForAsp(NiceASP.SessionData.SessionsSystem_Get(Session));
                Response.ContentType = "text/plain";
                Response.Write("Done Dir");
                break;

            default:
                NiceASP.SessionData.LoggedOnOrRedirectToRoot(Session, Response, true);
                throw new ArgumentException();
                //break;
            }
        }
        catch (Exception se)
        {
            Response.ContentType = "text/plain";
            Response.Write("ups");
            Response.Write(se.ToString());
            Response.Write(se.Message);
        }
    }