当前位置: 首页>>代码示例>>C#>>正文


C# Util.CreateMobiFlexAccount方法代码示例

本文整理汇总了C#中Util.CreateMobiFlexAccount方法的典型用法代码示例。如果您正苦于以下问题:C# Util.CreateMobiFlexAccount方法的具体用法?C# Util.CreateMobiFlexAccount怎么用?C# Util.CreateMobiFlexAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Util的用法示例。


在下文中一共展示了Util.CreateMobiFlexAccount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateAccountSubmit_ServerClick

    protected void CreateAccountSubmit_ServerClick(object sender, EventArgs e)
    {
        //check for competitors
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        string address = EmailTextBox.Text.ToLower();
        string bad_domains = Server.MapPath(".") + @"\App_Data\BadDomains.txt";
        string[] lines = File.ReadAllLines(bad_domains);
        foreach(string line in lines)
        {
            if (address.EndsWith(line))
            {
                MessageLabel.Text = "An email has been sent to you to complete your registration. Please follow the directions in the email.";
                return;
            }
        }

        Util util = new Util();
        DB db = new DB();

        Label Error = new Label();
        StringBuilder err = new StringBuilder();
        string username = UsernameBox.Text.Trim().ToLower();
        if (!Check.ValidateUsername(Error, username))
        {
            err.Append(Error.Text.Clone() + "<BR>");
        }
        else
        {
            string query = "SELECT username FROM customers WHERE username='" + username + "'";
            string prev_username = db.ViziAppsExecuteScalar(State,query);
            if (username == prev_username)
            {
               /* query = "SELECT password FROM customers WHERE username='" + username + "'";
                string password = db.ViziAppsExecuteScalar(State, query);
                if(password != PasswordTextBox.Text)*/
                     err.Append("The " + username + " account already exists.<BR>");
            }
            if (address.Length> 0 && address.ToLower() != "[email protected]") //for every email not for testing
            {
                query = "SELECT email FROM customers WHERE email='" + address + "'";
                string email = db.ViziAppsExecuteScalar(State, query);
                if (email == this.EmailTextBox.Text)
                {
                    err.Append("An account already exists with the same email.<BR>");
                }
            }
        }
        if (!Check.ValidatePassword(Error, PasswordTextBox.Text))
        {
            err.Append("Enter Password: " +Error.Text.Clone() + "<BR>");
        }
        if (!Check.ValidateEmail(Error, EmailTextBox.Text))
        {
            err.Append(Error.Text.Clone() + "<BR>");
        }
        if (PasswordTextBox.Text != ConfirmPasswordBox.Text)
        {
            err.Append("The password and confirming password do not match. Try again.<BR>");
        }
        if (!Check.ValidateName(Error,FirstNameTextBox.Text))
        {
            err.Append("Enter First Name: " + Error.Text.Clone() + "<BR>");
        }
        if (!Check.ValidateName(Error, LastNameTextBox.Text))
        {
            err.Append("Enter Last Name: " + Error.Text.Clone() + "<BR>");
        }

        string phone = PhoneTextBox.Text.Trim ();
        if (PhoneTextBox.Text.Length > 0) //optional field
        {
            if (!Check.ValidatePhone(Error, PhoneTextBox.Text))
            {
                err.Append("Enter a valid phone number: " + Error.Text.Clone() + "<BR>");
            }
        }
        if (err.Length > 0)
        {
            MessageLabel.Text = "The following input(s) are required:<BR>" + err.ToString();
            db.CloseViziAppsDatabase(State);
            return;
        }
        try
        {

            string account_type = "type=viziapps;"; //set default for now
            string security_question = "";
            string security_answer = "";

            string customer_id = util.CreateMobiFlexAccount(State, username, PasswordTextBox.Text.Trim(), security_question, security_answer, FirstNameTextBox.Text.Trim(), LastNameTextBox.Text.Trim(),
                    EmailTextBox.Text.ToLower().Trim(), phone, account_type, ReferralSourceList.SelectedValue,AppToBuild.Text, "inactive");

            string email_template_path = Server.MapPath(".") + @"\templates\EmailValidation.txt";
            string url =   HttpRuntime.Cache["PublicViziAppsUrl"].ToString() + "/ValidateEmail.aspx?id=" + customer_id;
            string from =   HttpRuntime.Cache["TechSupportEmail"].ToString();
            string body = File.ReadAllText(email_template_path)
                    .Replace("[NAME]", FirstNameTextBox.Text.Trim())
                    .Replace("[LINK]",url)
                    .Replace("[SUPPORT]",from);

//.........这里部分代码省略.........
开发者ID:dcolonvizi,项目名称:ViziAppsPortal,代码行数:101,代码来源:CreateAccount.aspx.cs


注:本文中的Util.CreateMobiFlexAccount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。