コード例 #1
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);
        }
    }
コード例 #2
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);
        }
    }
コード例 #3
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);
     }
 }
コード例 #4
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);
        }
    }
コード例 #5
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);
        }
    }
コード例 #6
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);
        }
    }
コード例 #7
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);
        }
    }
コード例 #8
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);
        }
    }
コード例 #9
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);
        }
    }
コード例 #10
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);
        }
    }
コード例 #11
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);
        }
    }
コード例 #12
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);
        }
    }
コード例 #13
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);
        }
    }
コード例 #14
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);
        }
    }
コード例 #15
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);
        }
    }
コード例 #16
0
    protected void UpdateData_Click(object sender, EventArgs e)
    {
        try
        {
            DSSwitch.appUser().Update_General(I_UserEmail.Text, delegate(Data_AppUserFile user, Object args)
            {
                UpdateIfChanged(L_UserName_Store, L_UserName, ref user.UserName);
                UpdateIfChanged(L_UserEmail_Store, L_UserEmail, ref user.Email);
                UpdateIfChanged(L_UserEmail_Store, L_ApiGuId, ref user.ApiGuId);
                UpdateIfChanged(L_UserPassword_Store, L_UserPassword, ref user.Password);
                UpdateIfChanged_Mob(L_AllTelNumbers_Store, L_AllTelNumbers, ref user.MobileNumbers_AllConfirmed__);
                UpdateIfChanged_Mob(L_AllUnconfTelNumbers_Store, L_AllUnconfTelNumbers, ref user.MobileNumbers_AllUnConfirmed__);
                UpdateIfChanged(L_CreationIp_Store, L_CreationIp, ref user.CreationIp);
                UpdateIfChanged_Stat(L_Status_Store, L_Status, ref user.AccountStatus);
                UpdateIfChanged(L_Comment_Store, L_Comment, ref user.Comment);
                UpdateIfChanged_Bol(L_DeleteOnFailed_Store, L_DeleteOnFailed, ref user.DeleteOnFailed);
                UpdateIfChanged_Bol(L_AddNumberAllowedWithAPI_Store, L_AddNumberAllowedWithAPI, ref user.AddNumber_AllowedWithAPI);
                UpdateIfChanged_Bol(L_AddNumberActivateOnSyncRequest_Store, L_AddNumberActivateOnSyncRequest, ref user.AddNumber_ActivateOnSyncRequest);

                UpdateIfChanged_I64(Lf_MsgSent_Store, Lf_MsgSent, ref user.FreeAccount.free_MsgSent);
                UpdateIfChanged_I64(Lf_MsgLeft_Store, Lf_MsgLeft, ref user.FreeAccount.free_MsgLeft);
                UpdateIfChanged_I32(Lf_MinDelayInSeconds_Store, Lf_MinDelayInSeconds, ref user.FreeAccount.free_MinDelayInSeconds);
                UpdateIfChanged_Bol(Lf_SendFooter_Store, Lf_SendFooter, ref user.FreeAccount.free_SendFooter);
                UpdateIfChanged_I16(Lf_WelcomeCounter_Store, Lf_WelcomeCounter, ref user.FreeAccount.free_WelcomeCounter);
                UpdateIfChanged_I64(Lf_MsgQueued_Store, Lf_MsgQueued, ref user.FreeAccount.free_MsgQueued);

                UpdateIfChanged_I64(Lm_MsgSent_Store, Lm_MsgSent, ref user.MonthlyAccount.monthly_MsgSent);
                UpdateIfChanged_Dt(Lm_PaidUntil_Store, Lm_PaidUntil, ref user.MonthlyAccount.monthly_PaidUntil);
                UpdateIfChanged_I32(Lm_MinDelayInSeconds_Store, Lm_MinDelayInSeconds, ref user.MonthlyAccount.monthly_MinDelayInSeconds);
                UpdateIfChanged_mon(Lm_CostPerNumber_Store, Lm_CostPerNumber, ref user.MonthlyAccount.monthly_CostPerNumber);
                UpdateIfChanged_mon(Lm_CurrentCredit_Store, Lm_CurrentCredit, ref user.MonthlyAccount.monthly_CurrentCredit);

                UpdateIfChanged_I64(Lm2_TotalMsgSent_Store, Lm2_TotalMsgSent, ref user.MonthlyDifPriceAccount.monthlyDifPrice_TotalMsgSent);
                UpdateIfChanged_I64(Lm2_ThisMonthMsgSent_Store, Lm2_ThisMonthMsgSent, ref user.MonthlyDifPriceAccount.monthlyDifPrice_ThisMonthMsgSent);
                UpdateIfChanged_Dt(Lm2_PeriodeStart_Store, Lm2_PeriodeStart, ref user.MonthlyDifPriceAccount.monthlDifPricey_PeriodeStart);
                UpdateIfChanged_I32(Lm2_PeriodeDurationInDays_Store, Lm2_PeriodeDurationInDays, ref user.MonthlyDifPriceAccount.monthlyDifPrice_PeriodeDurationInDays);
                UpdateIfChanged_I32(Lm2_MinDelayInSeconds_Store, Lm2_MinDelayInSeconds, ref user.MonthlyDifPriceAccount.monthlyDifPrice_MinDelayInSeconds);
                UpdateIfChanged_mon(Lm2_CostPerNumber_Store, Lm2_CostPerNumber, ref user.MonthlyDifPriceAccount.monthlyDifPrice_CostPerNumber);
                UpdateIfChanged_mon(Lm2_CurrentCredit_Store, Lm2_CurrentCredit, ref user.MonthlyDifPriceAccount.monthlyDifPrice_CurrentCredit);
                UpdateIfChanged(Lm2_LevelDefinitions_Store, Lm2_LevelDefinitions, ref user.MonthlyDifPriceAccount.monthlyDifPrice_LevelDefinitions);
                UpdateIfChanged_I32(Lm2_Level_Store, Lm2_Level, ref user.MonthlyDifPriceAccount.monthlyDifPrice_Level);
                UpdateIfChanged_Bol(Lm2_AutoInceremntLevel_Store, Lm2_AutoInceremntLevel, ref user.MonthlyDifPriceAccount.monthlyDifPrice_AutoInceremntLevel);
                UpdateIfChanged_Bol(Lm2_AutoRenewMonthPayment_Store, Lm2_AutoRenewMonthPayment, ref user.MonthlyDifPriceAccount.monthlyDifPrice_AutoRenewMonthPayment);

                UpdateIfChanged_I64(Lp_MsgSent_Store, Lp_MsgSent, ref user.PayAsSentAccount.payAsSent_MsgSent);
                UpdateIfChanged_I32(Lp_MinDelayInSeconds_Store, Lp_MinDelayInSeconds, ref user.PayAsSentAccount.payAsSent_MinDelayInSeconds);
                UpdateIfChanged_mon(Lp_CostPerNumber_Store, Lp_CostPerNumber, ref user.PayAsSentAccount.payAsSent_CostPerNumber);
                UpdateIfChanged_mon(Lp_CostPerMessage_Store, Lp_CostPerMessage, ref user.PayAsSentAccount.payAsSent_CostPerMessage);
                UpdateIfChanged_mon(Lp_CurrentCredit_Store, Lp_CurrentCredit, ref user.PayAsSentAccount.payAsSent_CurrentCredit);

                UpdateIfChanged_I64(Ld_MsgSent_Store, Ld_MsgSent, ref user.SystemDuplicationAccount.systemDuplication_MsgSent);
                UpdateIfChanged_Dt(Ld_PaidUntil_Store, Ld_PaidUntil, ref user.SystemDuplicationAccount.systemDuplication_PaidUntil);
            }, null, null, MyLog.GetLogger("DataAll"));

            SessionData sd = ConstantStrings.GetSessionData(Session);
            sd.QuickMessage     = I_UserEmail.Text + " updated";
            sd.QuickMessageGood = true;
            Response.Redirect(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~/"));
        }
        catch (DataUnavailableException)
        {
            DSSwitch.OnDataUnavailableException(this);
        }
        catch (Exception)
        {
        }
    }