コード例 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ML_Phone EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToML_Phone(ML_Phone mL_Phone)
 {
     base.AddObject("ML_Phone", mL_Phone);
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
 /// <summary>
 /// Create a new ML_Phone 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_Phone CreateML_Phone(global::System.Decimal id, global::System.Decimal id_Usuario)
 {
     ML_Phone mL_Phone = new ML_Phone();
     mL_Phone.id = id;
     mL_Phone.id_Usuario = id_Usuario;
     return mL_Phone;
 }
コード例 #4
0
        private void InserirMOvimentos(JObject t)
        {
            NSAADMEntities n;

            ConstruirEF cf = new ConstruirEF();
            n = (NSAADMEntities)cf.RecuperaEntity(Entities.MercadoLivre);

            decimal temp;
            Nullable<DateTime> tempd;

            foreach (var item in t)
            {

                string a = item.ToString();

                JToken j = t["response"];

                JToken s = j["results"];

                foreach (var i in s)
                {
                    JToken b = i["collection"];

                    if (VerificaPay(b) == false)
                    {

                        MP_Payments p = new MP_Payments();

                        p.id = (decimal)b["id"];
                        p.last_modified = (DateTime)b["last_modified"];
                        p.marketplace = (string)b["marketplace"];

                        p.installments = b["installments"].ToString();

                        Decimal.TryParse(b["marketplace_fee"].ToString(), out temp);
                        p.marketplace_fee = temp;

                        Decimal.TryParse(b["mercadopago_fee"].ToString(), out temp);
                        p.mercadopago_fee = temp;

                        Decimal.TryParse(b["net_received_amount"].ToString(), out temp);
                        p.net_received_amount = temp;

                        Decimal.TryParse(b["collector_id"].ToString(), out temp);
                        p.collector_id = temp;

                        Decimal.TryParse(b["currency_id"].ToString(), out temp);
                        p.currency_id = temp;

                        Decimal.TryParse(b["external_reference"].ToString(), out temp);
                        p.external_reference = temp;

                        Decimal.TryParse(b["total_paid_amount"].ToString(), out temp);
                        p.total_paid_amount = temp;

                        Decimal.TryParse(b["transaction_amount"].ToString(), out temp);
                        p.transaction_amount = temp;

                        Decimal.TryParse(b["account_money_amount"].ToString(), out temp);
                        p.account_money_amount = temp;

                        Decimal.TryParse(b["shipping_cost"].ToString(), out temp);
                        p.shipping_cost = temp;

                        p.operation_type = (string)b["operation_type"];
                        p.payment_type = (string)b["payment_type"];
                        p.reason = (string)b["reason"];
                        p.released = (string)b["released"];

                        p.site_id = (string)b["site_id"];
                        p.sponsor_id = (string)b["sponsor_id"];
                        p.status = (string)b["status"];
                        p.status_code = (string)b["status_code"];
                        p.status_detail = (string)b["status_detail"];

                        tempd = (Nullable<DateTime>)b["date_approved"];
                        p.date_approved = tempd;
                        p.date_created = (DateTime)b["date_created"];

                        tempd = (Nullable<DateTime>)b["money_release_date"];
                        p.money_release_date = tempd;
                        //p.money_release_date = (DateTime)b["money_release_date"];

                        //USUARIO
                        JToken user = b["payer"];
                        if (VerificaUser(user) == false)
                        {
                            ML_Usuario u = new ML_Usuario();
                            Decimal.TryParse(user["id"].ToString(), out temp);
                            u.id = temp;
                            u.nickname = (string)user["nickname"];
                            u.first_name = (string)user["first_name"];
                            u.last_name = (string)user["last_name"];
                            u.email = (string)user["email"];

                            JToken phone = user["phone"];
                            ML_Phone phon = new ML_Phone();
                            phon.area_code = (string)phone["area_code"];
                            phon.number = (string)phone["number"];
                            phon.extension = (string)phone["extension"];

                            u.ML_Phone.Add(phon);

                            n.ML_Usuario.AddObject(u);
                        }

                        n.AddToMP_Payments(p);

                        n.SaveChanges();
                    }
                }

            }
        }