/// <summary>
 /// Create a new ML_Identification object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="id_Usuario">Initial value of the id_Usuario property.</param>
 public static ML_Identification CreateML_Identification(global::System.Decimal id, global::System.Decimal id_Usuario)
 {
     ML_Identification mL_Identification = new ML_Identification();
     mL_Identification.id = id;
     mL_Identification.id_Usuario = id_Usuario;
     return mL_Identification;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the ML_Identification EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToML_Identification(ML_Identification mL_Identification)
 {
     base.AddObject("ML_Identification", mL_Identification);
 }
        public ML_Usuario ConverteUsuario(Usuario us)
        {
            //DADOS DA BASE DA CLASSE
            ML_Usuario u = new ML_Usuario();

            try
            {

                u.country_id = us.country_id;
                u.email = us.email;
                u.first_name = us.first_name;
                u.id = us.id;
                u.last_name = us.last_name;
                u.logo = us.logo;
                u.nickname = us.nickname;
                u.permalink = us.permalink;
                u.points = us.points;
                //u.registration_date = us.registration_date;
                u.seller_experience = us.seller_experience;
                u.site_id = us.site_id;
                u.user_type = us.user_type;

                //IDENTIFICAÇÃO USUARIO
                if (us.identification != null)
                {
                    ML_Identification ident = new ML_Identification();
                    ident.number = us.identification.number;
                    ident.type = us.identification.type;
                    u.ML_Identification.Add(ident);
                }

                //if (us.billing_info != null)
                //{
                //    ML_Identification ident = new ML_Identification();
                //    ident.type = us.billing_info.doc_type;
                //    ident.number = us.billing_info.doc_number;
                //    u.ML_Identification.Add(ident);
                //}

                if (us.phone != null)
                {
                    //TELEFONES
                    ML_Phone pho = new ML_Phone();
                    pho.area_code = us.phone.area_code;
                    pho.extension = us.phone.extension;
                    pho.number = us.phone.number;
                    pho.varified = us.phone.verified.ToString();
                    u.ML_Phone.Add(pho);

                    if (us.alternative_phone != null)
                    {
                        pho = new ML_Phone();
                        pho.area_code = us.alternative_phone.area_code;
                        pho.extension = us.alternative_phone.extension;
                        pho.number = us.alternative_phone.number;
                        u.ML_Phone.Add(pho);
                    }
                }

                //TRATANDO REPUTAÇÃO DE VENDEDOR
                //if (us.seller_reputation != null)
                //{
                //    ML_SellerReputation sr = new ML_SellerReputation();
                //    sr.power_seller_status = us.seller_reputation.power_seller_status;
                //    sr.level_id = us.seller_reputation.level_id;
                //    u.ML_SellerReputation.Add(sr);

                //    ML_TransactionsSeller ts = new ML_TransactionsSeller();
                //    ts.canceled = us.seller_reputation.transactions.canceled;
                //    ts.completed = us.seller_reputation.transactions.completed;
                //    ts.period = us.seller_reputation.transactions.period;
                //    ts.total = us.seller_reputation.transactions.total;
                //    ts.ML_SellerReputation = sr;
                //    sr.ML_TransactionsSeller.Add(ts);

                //    ML_Ratings rt = new ML_Ratings();
                //    rt.ML_TransactionsSeller = ts;
                //    rt.negative = us.seller_reputation.transactions.ratings.negative;
                //    rt.neutral = us.seller_reputation.transactions.ratings.neutral;
                //    rt.positive = us.seller_reputation.transactions.ratings.positive;
                //    ts.ML_Ratings.Add(rt);
                //}

                //TRATANDO REPUTAÇÃO COMPRADOR
                //if (us.buyer_reputation != null)
                //{
                //    ML_BuyerReputation mb = new ML_BuyerReputation();
                //    mb.canceled_transactions = us.buyer_reputation.canceled_transactions;
                //    u.ML_BuyerReputation.Add(mb);

                //    ML_TransactionsBuyer tb = new ML_TransactionsBuyer();
                //    tb.completed = us.buyer_reputation.transactions.completed;
                //    tb.period = us.buyer_reputation.transactions.period;
                //    tb.total = us.buyer_reputation.transactions.total;
                //    tb.ML_BuyerReputation = mb;

                //    ML_ResumoTransBuyer canceled = new ML_ResumoTransBuyer();
                //    canceled.paid = us.buyer_reputation.transactions.canceled.paid;
                //    canceled.total = us.buyer_reputation.transactions.canceled.total;
                //    canceled.units = us.buyer_reputation.transactions.canceled.units;
                //    tb.ML_ResumoTransBuyer2 = canceled;

                //    ML_ResumoTransBuyer unrated = new ML_ResumoTransBuyer();
                //    unrated.paid = us.buyer_reputation.transactions.unrated.paid;
                //    unrated.total = us.buyer_reputation.transactions.unrated.total;
                //    unrated.units = us.buyer_reputation.transactions.unrated.units;
                //    tb.ML_ResumoTransBuyer1 = unrated;

                //    ML_ResumoTransBuyer not_yet_rated = new ML_ResumoTransBuyer();
                //    not_yet_rated.paid = us.buyer_reputation.transactions.not_yet_rated.paid;
                //    not_yet_rated.total = us.buyer_reputation.transactions.not_yet_rated.total;
                //    not_yet_rated.units = us.buyer_reputation.transactions.not_yet_rated.units;
                //    tb.ML_ResumoTransBuyer = not_yet_rated;
                //}

                return u;
            }
            catch (Exception ex)
            {
                throw new Exception("Erro na rotina ConverteUsuario2.", ex);
            }
        }