コード例 #1
0
        protected void lbCreate_Click(object sender, EventArgs e)
        {
            //Page.Validate();
            if (!Page.IsValid || !cbConfirm.Checked)
            {
                return;
            }

            localhost.TrialResult tr = localhost.TrialResult.Failed;
            string message           = String.Empty;

            string assist = LocRM.GetString("Assist");
            int    requestId;
            string requestGuid;

            try
            {
                tr = TrialHelper.Request(
                    tbPortalName.Text
                    , tbDomain.Text
                    , tbFirstName.Text
                    , tbLatName.Text
                    , tbEmail.Text
                    , tbPhone.Text
                    , ddCountry.Items[ddCountry.SelectedIndex].Text
                    , tbLogin.Text
                    , tbPassword.Text
                    , ResellerGuid
                    , Thread.CurrentThread.CurrentUICulture.Name
                    , int.Parse(ddTimeZone.SelectedValue)
                    , CManage.GetReferrer(Request)
                    , out requestId
                    , out requestGuid

                    /*
                     * , cbSendMe.Checked
                     * , cbCallMe.Checked
                     */
                    );

                switch (tr)
                {
                case localhost.TrialResult.AlreadyActivated:
                    lblStep4Header.Text    = LocRM.GetString("TrialRejected");
                    lblStep4SubHeader.Text = LocRM.GetString("TrialRejectedReasons");
                    message              = LocRM.GetString("TrialActivated");
                    lblStep4Text.Text    = LocRM.GetString("TrialActivated") + assist;
                    btnCreate.Visible    = false;
                    spanLanguage.Visible = false;
                    break;

                case localhost.TrialResult.DomainExists:
                    lblStep4Header.Text    = LocRM.GetString("TrialRejected");
                    lblStep4SubHeader.Text = LocRM.GetString("TrialRejectedReasons");
                    message              = LocRM.GetString("DomainExists");
                    lblStep4Text.Text    = LocRM.GetString("DomainExists") + assist;
                    lbRepeat.Visible     = true;
                    btnCreate.Visible    = false;
                    spanLanguage.Visible = false;
                    break;

                case localhost.TrialResult.Failed:
                    lblStep4Header.Text    = LocRM.GetString("TrialRejected");
                    lblStep4SubHeader.Text = LocRM.GetString("TrialRejectedReasons");
                    message           = LocRM.GetString("UnknownReason");
                    lblStep4Text.Text = LocRM.GetString("UnknownReason") + assist;
                    break;

                case localhost.TrialResult.InvalidRequest:
                    lblStep4Header.Text    = LocRM.GetString("TrialRejected");
                    lblStep4SubHeader.Text = LocRM.GetString("TrialRejectedReasons");
                    message           = LocRM.GetString("InvalidRequest");
                    lblStep4Text.Text = LocRM.GetString("InvalidRequest") + assist;
                    break;

                case localhost.TrialResult.RequestPending:
                    lblStep4Header.Text    = LocRM.GetString("RequestPending");
                    lblStep4SubHeader.Text = LocRM.GetString("OneStep");
                    message           = String.Format("Request Pending.", tbDomain.Text);
                    lblStep4Text.Text = String.Format("Request Pending.", tbDomain.Text);
                    break;

                case localhost.TrialResult.Success:
                    lblStep4Header.Text    = LocRM.GetString("Created");
                    lblStep4SubHeader.Text = LocRM.GetString("OneStep");
                    message              = String.Format(LocRM.GetString("Congratulations"), tbDomain.Text, lblDomain.Text);
                    lblStep4Text.Text    = String.Format(LocRM.GetString("Congratulations"), tbDomain.Text, lblDomain.Text);
                    btnCreate.Visible    = false;
                    spanLanguage.Visible = false;
                    break;

                case localhost.TrialResult.UserRegistered:
                    lblStep4Header.Text    = LocRM.GetString("TrialRejected");
                    lblStep4SubHeader.Text = LocRM.GetString("TrialRejectedReasons");
                    message              = LocRM.GetString("UserRegistered");
                    lblStep4Text.Text    = LocRM.GetString("UserRegistered") + assist;
                    lbRepeat.Visible     = true;
                    btnCreate.Visible    = false;
                    spanLanguage.Visible = false;
                    break;

                case localhost.TrialResult.WaitingForActivation:
                    Response.Redirect(String.Format("activate.aspx?rid={0}&guid={1}&locale={2}", requestId, requestGuid, Thread.CurrentThread.CurrentUICulture.Name), true);
                    return;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                lblStep4Header.Text    = LocRM.GetString("Failed");
                lblStep4SubHeader.Text = LocRM.GetString("TrialRejectedReasons");
                lblStep4Text.Text      = ex.Message + @"<br>" + assist;
                message           = ex.Message;
                cbConfirm.Checked = false;
                lbRepeat.Visible  = true;
                btnCreate.Visible = false;
            }
            finally
            {
                try
                {
                    string conStr = Settings.ConnectionString;
                    if (conStr != null && conStr.Length > 0)                     //Save request in local database.
                    {
                        CManage.CreateRequest(
                            tbPortalName.Text
                            , "1 - 20"
                            , ""
                            , tbDomain.Text
                            , tbFirstName.Text
                            , tbLatName.Text
                            , tbEmail.Text
                            , ddCountry.Items[ddCountry.SelectedIndex].Text
                            , tbPhone.Text
                            , ddTimeZone.Items[ddTimeZone.SelectedIndex].Text
                            , tbLogin.Text
                            , tbPassword.Text
                            , new Guid(ResellerGuid)
                            , (int)tr
                            , message
                            );
                    }
                }
                catch
                {
#if DEBUG
                    //throw;
#endif
                }
            }
            tr1.Visible = false;
            tr2.Visible = false;
            tr3.Visible = false;
            tr4.Visible = true;
        }
コード例 #2
0
        public void Register_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid || portalName2.Text.Length > 0)
            {
                return;
            }

            Thread.CurrentThread.CurrentCulture   = new CultureInfo("ru-RU");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru-RU");

            localhost.TrialResult tr = localhost.TrialResult.Failed;
            string message           = String.Empty;

            int    requestId;
            string requestGuid;

            try
            {
                tr = TrialHelper.Request(
                    portalDomain.Text
                    , portalDomain.Text
                    , firstName.Text
                    , secondName.Text
                    , portalEmail.Text
                    , portalPhone.Text
                    , "46"
                    , portalLogin.Text
                    , portalPassword.Text
                    , GetReseller()
                    , Thread.CurrentThread.CurrentUICulture.Name
                    , 54
                    , CManage.GetReferrer(Request)
                    , out requestId
                    , out requestGuid

                    /*
                     * , cbSendMe.Checked
                     * , cbCallMe.Checked
                     */
                    );

                switch (tr)
                {
                case localhost.TrialResult.AlreadyActivated:
                    message = LocRM.GetString("TrialActivated");
                    lblErrorDomainMessage.Text = LocRM.GetString("TrialActivated");
                    break;

                case localhost.TrialResult.DomainExists:
                    message = LocRM.GetString("DomainExists");
                    lblErrorDomainMessage.Text = LocRM.GetString("DomainExists");
                    break;

                case localhost.TrialResult.Failed:
                    message = LocRM.GetString("UnknownReason");
                    lblErrorDomainMessage.Text = LocRM.GetString("UnknownReason");
                    break;

                case localhost.TrialResult.InvalidRequest:
                    message = LocRM.GetString("InvalidRequest");
                    lblErrorDomainMessage.Text = LocRM.GetString("InvalidRequest");
                    break;

                case localhost.TrialResult.RequestPending:
                    message = String.Format("Request Pending.");
                    //lblErrorDomainMessage.Text = String.Format("Request Pending.");
                    lblPendingMessage.Text = String.Format("Запрос на активацию принят.");
                    Register_Btn.Style.Add(HtmlTextWriterStyle.Display, "none");
                    break;

                case localhost.TrialResult.Success:
                    Response.Redirect(String.Format("http://{0}.{1}", portalDomain.Text, lblParentDomain.Text));
                    break;

                case localhost.TrialResult.UserRegistered:
                    message = LocRM.GetString("UserRegistered");
                    lblErrorDomainMessage.Text = LocRM.GetString("UserRegistered");
                    break;

                case localhost.TrialResult.WaitingForActivation:
                    Response.Redirect(String.Format("PmBoxActivate.aspx?rid={0}&guid={1}&locale={2}", requestId, requestGuid, Thread.CurrentThread.CurrentUICulture.Name), true);
                    return;

                default:
                    break;
                }
            }
            catch (Exception)
            {
                try
                {
                    string conStr = Settings.ConnectionString;
                    if (conStr != null && conStr.Length > 0)                     //Save request in local database.
                    {
                        CManage.CreateRequest(
                            portalDomain.Text
                            , "1 - 20"
                            , ""
                            , portalDomain.Text
                            , firstName.Text
                            , secondName.Text
                            , portalEmail.Text
                            , "46"
                            , portalPhone.Text
                            , "54"
                            , portalLogin.Text
                            , portalPassword.Text
                            , new Guid(Settings.UnknownResellerGuid)
                            , (int)tr
                            , message
                            );
                    }
                }
                catch
                {
                }
            }
            //lblErrorDomainMessage.Text = "Доменное имя занято";
        }