Example #1
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");
        }
    }
Example #2
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();
            }
        }
    }
Example #3
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);
        }
    }
Example #4
0
 public override string Info(Data_AppUserFile user)
 {
     return($"Default {Data_AppUserFile.GetNiceStatusText(user.AccountStatus)} {user.AccountStatus.Importance()}");
 }
Example #5
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);
        }
    }
Example #6
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);
        }
    }