Exemple #1
0
    public string CreateMobiFlexAccount(Hashtable State,
        string username, string password, string security_question, string security_answer, string first_name, string last_name,
        string email, string phone, string account_type, string referral_source, string app_to_build, string status)
    {
        StringBuilder sql = new StringBuilder("INSERT INTO customers SET ");
        string customer_id = Guid.NewGuid().ToString();
        sql.Append("customer_id='" + customer_id + "'");
        sql.Append(",username='******'");
        sql.Append(",password='******'");
        if (security_question.Length > 0)
            sql.Append(",security_question='" + security_question.Replace("'", "''") + "'");
        if (security_answer.Length > 0)
            sql.Append(",security_answer='" + security_answer.Replace("'", "''") + "'");
        sql.Append(",first_name='" + MySqlFilter(first_name) + "'");
        sql.Append(",last_name='" + MySqlFilter(last_name) + "'");
        sql.Append(",email='" + email + "'");
        double DefaultTimeZoneDeltaHours = Convert.ToDouble( HttpRuntime.Cache["DefaultTimeZoneDeltaHours"].ToString());
        TimeZones zone_util = new TimeZones();
        string zone = Convert.ToString(DefaultTimeZoneDeltaHours + zone_util.GetDaylightSavingsTimeOffset(DateTime.Now.ToUniversalTime()));
        sql.Append(",default_time_zone_delta_hours='" + zone + "'");
        if (phone != null && phone.Length > 0)
        {
            sql.Append(",phone='" + phone + "'");
        }

        sql.Append(",account_type='" + account_type + "'");
        if (referral_source != null && referral_source.IndexOf("->") < 0)
        {
            sql.Append(",referral_source='" + referral_source + "'");
        }
        if (app_to_build != null && app_to_build.Length > 0)
        {
            sql.Append(",app_to_build='" + MySqlFilter(app_to_build) + "'");
        }
        string NOW = DateTime.Now.ToUniversalTime().ToString("s").Replace("T", " ");

        sql.Append(",registration_date_time='" + NOW + "',status='" + status + "'");
        DB db = new DB();
        db.ViziAppsExecuteNonQuery(State, sql.ToString());
        db.CloseViziAppsDatabase(State);
        return customer_id;
    }