コード例 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ML_Payment EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToML_Payment(ML_Payment mL_Payment)
 {
     base.AddObject("ML_Payment", mL_Payment);
 }
コード例 #2
0
 private void AtualizaPagamento(ML_Payment p, Payment py, NSAADMEntities n)
 {
     try
     {
         p.currency_id = py.currency_id;
         p.date_created = py.date_created;
         p.date_last_updated = py.date_last_updated;
         p.status = py.status;
         p.transaction_amount = py.transaction_amount;
         if (p.id == 0) p.id = py.id;
     }
     catch (Exception ex)
     {
         throw new Exception("Erro na rotina AtualziaPagamento.",ex);
     }
 }
コード例 #3
0
 /// <summary>
 /// Create a new ML_Payment object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="id_order">Initial value of the id_order property.</param>
 public static ML_Payment CreateML_Payment(global::System.Decimal id, global::System.Decimal id_order)
 {
     ML_Payment mL_Payment = new ML_Payment();
     mL_Payment.id = id;
     mL_Payment.id_order = id_order;
     return mL_Payment;
 }
コード例 #4
0
        public ML_Order ConverteOrdem(Order o, NSAADMEntities n)
        {
            try
            {

                ControlaUsuario ControlaUsu = new ControlaUsuario();
                ControlaItem ControlaIt = new ControlaItem();
                ControlaEndereco ControlEnd = new ControlaEndereco();
                ConstruirEF cf = new ConstruirEF();

                ML_Order ord = new ML_Order();

                //CONVERTENDO COMPRADOR E VENDEDOR
                ML_Usuario buy = ControlaUsu.RetonarUsuario(o.buyer.id, n);
                if (buy == null)
                {
                    buy = ConverteUsuario(o.buyer);
                }

                ML_Usuario sel = ControlaUsu.RetonarUsuario(o.seller.id, n);
                if (sel == null)
                {
                    sel = ConverteUsuario(o.seller);
                }

                ord.ML_Usuario = sel;
                ord.ML_Usuario1 = buy;

                //ITENS DA ORDEM
                ML_OrderItem oi;
                foreach (OrderItem item in o.order_items)
                {
                    oi = new ML_OrderItem();
                    oi.currency_id = item.currency_id;
                    oi.quantity = item.quantity;
                    oi.unit_price = item.unit_price;

                    ML_Item mitem = ControlaIt.RetonarItem(o.order_items[0].item.id, n);
                    if (mitem == null)
                    {
                        mitem = ConverteItem(o.order_items[0].item);
                    }

                    oi.ML_Item = mitem;
                    ord.ML_OrderItem.Add(oi);
                }

                ML_Payment pa;
                foreach (Payment p in o.payments)
                {
                    pa = new ML_Payment();
                    pa.currency_id = p.currency_id;
                    pa.date_created = p.date_created;
                    pa.date_last_updated = p.date_last_updated;
                    pa.status = p.status;
                    pa.transaction_amount = p.transaction_amount;

                    pa.id = p.id;

                    ord.ML_Payment.Add(pa);

                }

                if (o.feedback != null)
                {
                    if (o.feedback.purchase != null)
                    {
                        ML_FeedbackBuyer feeb = new ML_FeedbackBuyer();
                        feeb.date_created = o.feedback.purchase.date_created;
                        feeb.fulfilled = o.feedback.purchase.fulfilled.ToString();
                        feeb.rating = o.feedback.purchase.rating;
                        feeb.id_order = o.id;

                        ord.ML_FeedbackBuyer.Add(feeb);

                    }

                    if (o.feedback != null)
                    {
                        if (o.feedback.sale != null)
                        {
                            ML_FeedbackSeller fees = new ML_FeedbackSeller();
                            fees.date_created = o.feedback.sale.date_created;
                            fees.fulfilled = o.feedback.sale.fulfilled.ToString();
                            fees.rating = o.feedback.sale.rating;
                            fees.id_order = o.id;

                            ord.ML_FeedbackSeller.Add(fees);
                        }
                    }
                }

                ML_Shipping s = new ML_Shipping();
                s = ConverteShipping(o, n);
                if (s != null) ord.ML_Shipping.Add(s);

                //DADOS DA ORDEM
                ord.id = o.id;
                ord.currency_id = o.currency_id;
                ord.date_closed = o.date_closed;
                ord.date_created = o.date_created;
                ord.status = o.status;
                //ord.status_detail = o.status_detail.description;
                ord.total_amount = o.total_amount;

                return ord;

            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Erro na rotina de ConverteOrdem. OrdemID: {0}",o.id), ex);
            }
        }