示例#1
0
    protected void RepPaymentProcessorsGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string[] commands = new string[2] {
            "remove", "edit"
        };

        if (commands.Contains(e.CommandName))
        {
            var index           = e.GetSelectedRowIndex() % RepPaymentProcessorsGridView.PageSize;
            var row             = RepPaymentProcessorsGridView.Rows[index];
            var paymentMethodId = Convert.ToInt32(row.Cells[0].Text);
            var paymentMethod   = new RepresentativesPaymentProcessor(paymentMethodId);

            if (e.CommandName == "remove")
            {
                paymentMethod.Delete();
            }
            else if (e.CommandName == "edit")
            {
                EditedRepresentativesPaymentProcessor = paymentMethod;
                Response.Redirect(string.Format("representatives.aspx?tab=0&eid={0}", paymentMethodId));
            }

            titleLiteral.Text = U6010.EDITPAYMENTMETHODS;
            ForRepSubTitlePlaceHolder.Visible = false;
            RepPaymentProcessorsGridView.DataBind();
        }
    }
示例#2
0
    protected void SavePaymentMethodButton_Click(object sender, EventArgs e)
    {
        SuccMessagePanel.Visible  = false;
        ErrorMessagePanel.Visible = false;

        try
        {
            if (string.IsNullOrEmpty(RepresentativePaymentMethodForCurrentRep.ProcessorName))
            {
                throw new MsgException(U6010.PROVIDEPROCESSORNAME);
            }

            if (string.IsNullOrEmpty(RepresentativePaymentMethodForCurrentRep.DepositInfo) && string.IsNullOrEmpty(RepresentativePaymentMethodForCurrentRep.WithdrawalInfo))
            {
                throw new MsgException(U6010.PAYMENTMETHODEMPTYERROR);
            }

            if (string.IsNullOrEmpty(RepresentativePaymentMethodForCurrentRep.LogoImagePath))
            {
                throw new MsgException(U6000.PLEASEUPLOADIMAGE);
            }

            if (EditedRepresentativesPaymentProcessor == null)
            {
                EditedRepresentativesPaymentProcessor = new RepresentativesPaymentProcessor();
            }

            EditedRepresentativesPaymentProcessor.UserId         = Member.CurrentId;
            EditedRepresentativesPaymentProcessor.Name           = RepresentativePaymentMethodForCurrentRep.ProcessorName;
            EditedRepresentativesPaymentProcessor.LogoPath       = RepresentativePaymentMethodForCurrentRep.LogoImagePath;
            EditedRepresentativesPaymentProcessor.DepositInfo    = RepresentativePaymentMethodForCurrentRep.DepositInfo;
            EditedRepresentativesPaymentProcessor.WithdrawalInfo = RepresentativePaymentMethodForCurrentRep.WithdrawalInfo;
            EditedRepresentativesPaymentProcessor.Save();

            RepresentativePaymentMethodForCurrentRep.ClearFields();

            SuccMessagePanel.Visible = true;
            if (SavePaymentMethodButton.Text == L1.SAVE)
            {
                SuccMessage.Text = U6010.PAYMENTMETHODSAVED;
            }
            else
            {
                SuccMessage.Text = U6010.PAYMENTMETHODADDED;
            }
        }
        catch (MsgException ex)
        {
            ErrorMessagePanel.Visible = true;
            ErrorMessage.Text         = ex.Message;
        }
    }
示例#3
0
    protected void AvaibleRepresentativeList_SelectedIndexChanged(object sender, EventArgs e)
    {
        var representative = new Representative(Convert.ToInt32(AvaibleRepresentativeList.SelectedValue));
        var useId          = representative.UserId;
        var optionsList    = RepresentativesPaymentProcessor.GetAllPaymentOptions(useId);

        DepositOptionsPlaceHolder.Controls.Clear();

        foreach (var option in optionsList)
        {
            if (!string.IsNullOrEmpty(option.DepositInfo))
            {
                DepositOptionsPlaceHolder.Controls.Add(GetPaymentHTML(option.Name, option.LogoPath, option.DepositInfo));
            }
        }
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.IsRepresentativesEnabled);

        LangAdders();
        BindControls();

        if (!IsPostBack)
        {
            ContactPanelPlaceHolder.Visible = false;

            if (Request.QueryString["tab"] != null)
            {
                //0 - Add New, 1 - Manage
                var tab = Convert.ToInt32(Request.QueryString["tab"]);

                SuccMessagePanel.Visible        = false;
                ErrorMessagePanel.Visible       = false;
                ContactPanelPlaceHolder.Visible = false;
                CountriesPlaceHolder.Visible    = false;

                PaymentMethodsPlaceHolder.Visible       = true;
                ManagePaymentMethodsPlaceHolder.Visible = false;
                AddNewPaymentMethodPlaceHolder.Visible  = true;

                if (tab == 0)
                {
                    MenuAddNewPaymentMethodButton.CssClass += " active";
                }
                else if (tab == 1)
                {
                    MenuEditPaymentMethodsButton.CssClass  += " active";
                    ManagePaymentMethodsPlaceHolder.Visible = true;
                    AddNewPaymentMethodPlaceHolder.Visible  = false;
                }
                if (Request.QueryString["eid"] != null)
                {
                    var Id = Convert.ToInt32(Request.QueryString["eid"]);
                    EditedRepresentativesPaymentProcessor = new RepresentativesPaymentProcessor(Id);
                    RepresentativePaymentMethodForCurrentRep.RepresentativePaymentMethod = EditedRepresentativesPaymentProcessor;
                }
            }
        }
    }
示例#5
0
    protected void SendButton_Click(object sender, EventArgs e)
    {
        SuccMessagePanel.Visible  = false;
        ErrorMessagePanel.Visible = false;

        if (!Member.IsLogged)
        {
            Response.Redirect("/login.aspx");
        }

        if (Page.IsValid)
        {
            try
            {
                var Representant = new Representative();

                Representant.Name  = NameTextBox.Text;
                Representant.Email = EmailTextBox.Text;
                Representant.Why   = WhyTextBox.Text;
                Representant.City  = CityTextBox.Text;

                if (AppSettings.Representatives.Policy == AppSettings.Representatives.RepresentativesPolicy.Automatic)
                {
                    Representant.Country = CountryDropDownList.SelectedItem.ToString();
                }
                else
                {
                    Representant.Country = CountryTextBox.Text.Trim();
                }

                int allActiveFromCountry   = Representative.GetAllActiveFromCountry(Representant.Country).Count;
                int maxNoOfRepresentatives = AppSettings.Representatives.NoOfRepresentatives;

                if (allActiveFromCountry >= maxNoOfRepresentatives)
                {
                    throw new MsgException(string.Format(U6003.REPRESENTATIVESLIMIT, maxNoOfRepresentatives));
                }

                Representant.Skype       = SkypeTextBox.Text;
                Representant.Facebook    = FacebookTextBox.Text;
                Representant.PhoneNumber = PhoneTextBox.Text;
                Representant.Languages   = LanguagesTextBox.Text;
                Representant.UserId      = Member.CurrentId;
                Representant.Status      = UniversalStatus.Paused;

                if (Representative.DidUserSendRequest(Representant.UserId))
                {
                    throw new MsgException(U6003.ALREADYREPRESENTANT);
                }

                if (Representative.IsEmailInDatabase(Representant.Email))
                {
                    throw new MsgException(U6002.EMAILREGISTRED);
                }

                if (RepresentativePaymentMethod.Visible)
                {
                    if (string.IsNullOrEmpty(RepresentativePaymentMethod.LogoImagePath))
                    {
                        throw new MsgException(U5006.MUSTUPLOADIMAGE);
                    }

                    var newRepresentativeProcessor = new RepresentativesPaymentProcessor();
                    newRepresentativeProcessor.UserId         = Member.CurrentId;
                    newRepresentativeProcessor.Name           = RepresentativePaymentMethod.ProcessorName;
                    newRepresentativeProcessor.LogoPath       = RepresentativePaymentMethod.LogoImagePath;
                    newRepresentativeProcessor.WithdrawalInfo = RepresentativePaymentMethod.WithdrawalInfo;
                    newRepresentativeProcessor.DepositInfo    = RepresentativePaymentMethod.DepositInfo;
                    newRepresentativeProcessor.Save();
                }

                Representant.Save();

                SuccMessagePanel.Visible  = true;
                SuccMessage.Text          = L1.OP_SUCCESS;
                ErrorMessagePanel.Visible = false;

                ContactPanelPlaceHolder.Visible = false;
                TitlePlaceHolder.Visible        = true;
                CountriesPlaceHolder.Visible    = true;

                ClearFields();
            }
            catch (MsgException ex)
            {
                ErrorMessagePanel.Visible       = true;
                ErrorMessage.Text               = ex.Message;
                ContactPanelPlaceHolder.Visible = true;
                TitlePlaceHolder.Visible        = false;
                CountriesPlaceHolder.Visible    = false;
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex);
            }
        }
    }