示例#1
0
        public static Profile GetFrom(CustomerAccount user)
        {
            if (user == null)
                return null;


            return new Profile
            {
                uid = user.id,
                account = user.username,
                email = user.email,
                nickname = user.nickname,
                gender = user.gender,
                vip = user.vip,
                avatar = user.GetValidAvatarUrl(),
                cover = user.GetValidCoverUrl(),
                country_code = user.country_code,
                country_name = user.country_name,
                bio = user.bio ?? string.Empty, // string is reference type, default is null //
                inviter = user.inviter_username,
                gtoken = user.gtoken,
                locale = string.IsNullOrEmpty(user.locale) ? ConstantCommon.BABEL_DEFAULT_LOCALE : user.locale,
                is_venvici_member = user.is_venvici_member

            };
        }
示例#2
0
 public bool AddMember(CustomerAccount user)
 {
     var venvici = new VenviciModel()
     {
         enumAction = VenviciAction.Addmember,
         username = user.username,
         email = user.email,
         password = user.unhashed_password,
         md5Password = user.password,
         introducerId = user.inviter_username,
         country = user.country_code
     };
     var result = SendAPIRequest(venvici);
     bool suscess = result.Contains(Helper.GetDescription(VenviciReult.success));
     Api.Instance.LogApi("1", "web/addMember.jsp", suscess, HttpContext.Current.Request.UserAgent,
        "venvici", user.username, HttpContext.Current.Request.UserHostAddress, string.Empty, JsonConvert.SerializeObject(venvici) + " ---- Result: " + result);
     return suscess;
 }
示例#3
0
        /// <summary>
        /// insert data into customer_account table --> dob field is not inserted
        /// </summary>
        /// <param name="db"></param>
        /// <param name="customerAccount"></param>
        /// <returns>id of new user</returns>
        //        public int CreateCustomerAccount(NpgsqlConnection db, CustomerAccount customerAccount)
        //        {
        //            string sql = @"INSERT INTO customer_account 
        //            (nickname, email, username, password, gender, vip, country_code, country_name,partner_identifier, unhashed_password) 
        //            VALUES 
        //            (@nickname, @email, @username, @password, @gender, @vip, @country_code, @country_name,@partner_identifier, @unhashed_password)
        //             RETURNING id";

        //            return db.Query<int>(sql, customerAccount).FirstOrDefault();
        //        }

        public int CreateCustomerAccount(IDbConnection db, CustomerAccount customerAccount)
        {
            string sql = @"INSERT INTO customer_account 
            (nickname, email, username, password, gender, vip, country_code, country_name, unhashed_password, partner_identifier) 
            VALUES 
            (@nickname, @email, @username, @password, @gender, @vip, @country_code, @country_name, @unhashed_password, @partner_identifier)
             RETURNING id";

            return db.Query<int>(sql, customerAccount).FirstOrDefault();
        }
 private void checkUserLocale(Platform.Core.Api api, CustomerAccount user)
 {
     if (Session["locale"] != null)
     {
         if (user.locale != Session["locale"].ToString())
         {
             api.SetUserLocale(user.id, Session["locale"].ToString());
         }
     }
 }