Example #1
0
        public int FinalizarVenda(int idCliente, int idtTipoVenda)
        {
            try
            {
                VendaBLL vendaBLL = new VendaBLL();
                ItemVendaBLL itemVendaBLL = new ItemVendaBLL();
                VENDA venda = new VENDA();

                venda.IDT_CLIENTE = idCliente;
                venda.IDT_TIPO_VENDA = idtTipoVenda;
                venda.DATA_VENDA = DateTime.Now;
                venda.VALOR_TOTAL = this.ValorTotal();

                vendaBLL.Add(venda);
                vendaBLL.SaveChanges();

                foreach (ITEM_VENDA itemvenda in Itens)
                {
                    itemvenda.IDT_VENDA = venda.IDT_VENDA;
                    itemVendaBLL.Add(itemvenda);
                    itemVendaBLL.SaveChanges();
                }

                itemVendaBLL = null;
                vendaBLL = null;

                return venda.IDT_VENDA;
            }
            catch
            {
                return 0;
            }
        }
        protected void grvVendas_SelectedIndexChanged(object sender, EventArgs e)
        {
            idtVenda = (int)grvVendas.SelectedValue;

            //Listar Itens da Venda
            Session.Add("idtVenda", idtVenda);

            Response.Redirect("ListarItensVenda.aspx");

            vendabll = null;
            venda = null;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the VENDA EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVENDA(VENDA vENDA)
 {
     base.AddObject("VENDA", vENDA);
 }
 /// <summary>
 /// Create a new VENDA object.
 /// </summary>
 /// <param name="iDT_VENDA">Initial value of the IDT_VENDA property.</param>
 /// <param name="iDT_CLIENTE">Initial value of the IDT_CLIENTE property.</param>
 /// <param name="iDT_TIPO_VENDA">Initial value of the IDT_TIPO_VENDA property.</param>
 /// <param name="dATA_VENDA">Initial value of the DATA_VENDA property.</param>
 /// <param name="vALOR_TOTAL">Initial value of the VALOR_TOTAL property.</param>
 /// <param name="sTATUS">Initial value of the STATUS property.</param>
 public static VENDA CreateVENDA(global::System.Int32 iDT_VENDA, global::System.Int32 iDT_CLIENTE, global::System.Int32 iDT_TIPO_VENDA, global::System.DateTime dATA_VENDA, global::System.Decimal vALOR_TOTAL, global::System.String sTATUS)
 {
     VENDA vENDA = new VENDA();
     vENDA.IDT_VENDA = iDT_VENDA;
     vENDA.IDT_CLIENTE = iDT_CLIENTE;
     vENDA.IDT_TIPO_VENDA = iDT_TIPO_VENDA;
     vENDA.DATA_VENDA = dATA_VENDA;
     vENDA.VALOR_TOTAL = vALOR_TOTAL;
     vENDA.STATUS = sTATUS;
     return vENDA;
 }
 /// <summary>
 /// Create a new VENDA object.
 /// </summary>
 /// <param name="iDT_VENDA">Initial value of the IDT_VENDA property.</param>
 /// <param name="iDT_CLIENTE">Initial value of the IDT_CLIENTE property.</param>
 /// <param name="iDT_TIPO_VENDA">Initial value of the IDT_TIPO_VENDA property.</param>
 /// <param name="dATA_CADASTRO">Initial value of the DATA_CADASTRO property.</param>
 /// <param name="vALOR_TOTAL">Initial value of the VALOR_TOTAL property.</param>
 public static VENDA CreateVENDA(global::System.Int32 iDT_VENDA, global::System.Int32 iDT_CLIENTE, global::System.Int32 iDT_TIPO_VENDA, global::System.DateTime dATA_CADASTRO, global::System.Decimal vALOR_TOTAL)
 {
     VENDA vENDA = new VENDA();
     vENDA.IDT_VENDA = iDT_VENDA;
     vENDA.IDT_CLIENTE = iDT_CLIENTE;
     vENDA.IDT_TIPO_VENDA = iDT_TIPO_VENDA;
     vENDA.DATA_CADASTRO = dATA_CADASTRO;
     vENDA.VALOR_TOTAL = vALOR_TOTAL;
     return vENDA;
 }