Ejemplo n.º 1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     DAL.DALCompras dalCompra = new DAL.DALCompras();
     Modelo.Compra  compra    = new Modelo.Compra(int.Parse(Request.QueryString["idCompra"]), Convert.ToDateTime(Calendar1.SelectedDate), double.Parse(TextBox3.Text), double.Parse(Label6.Text), int.Parse(DropDownList1.SelectedValue));
     dalCompra.AtualizarCompras(compra);
     Response.Redirect("./Compras.aspx");
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int idCompra = int.Parse(Request.QueryString["idCompra"].ToString());

            DAL.DALItemCompra dalitenscompra = new DAL.DALItemCompra();
            dalitenscompra.DeleteIdCompra(idCompra);
            DAL.DALCompras dalCompra = new DAL.DALCompras();
            Modelo.Compra  compra    = dalCompra.SelectCompras(idCompra)[0];
            compra.valorTotal = 0;
            dalCompra.Delete(compra.idCompra);
            Response.Redirect("./Compras.aspx");
        }
Ejemplo n.º 3
0
        protected void Button4_Click(object sender, EventArgs e)
        {
            int idCompra = int.Parse(Request.QueryString["idCompra"].ToString());

            DAL.DALItemCompra dalitenscompra = new DAL.DALItemCompra();
            dalitenscompra.DeleteIdCompra(idCompra);
            DAL.DALCompras dalCompra = new DAL.DALCompras();
            Modelo.Compra  compra    = dalCompra.SelectCompras(idCompra)[0];
            compra.valorTotal = 0;
            dalCompra.AtualizarCompras(compra);
            Response.Redirect("./InserirCompras.aspx?idCompra=" + idCompra);
        }
Ejemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DAL.DALItemCompra dalitem    = new DAL.DALItemCompra();
            double            precoTotal = (int.Parse(TextBox2.Text) * double.Parse(TextBox3.Text));
            int idCompra = int.Parse(Request.QueryString["idCompra"].ToString());

            Modelo.ItensCompra itemCompra = new Modelo.ItensCompra(TextBox1.Text, int.Parse(TextBox2.Text), double.Parse(TextBox3.Text), precoTotal, idCompra, int.Parse(DropDownList1.SelectedValue));
            dalitem.InserirItensCompra(itemCompra);
            DAL.DALCompras dalcompra = new DAL.DALCompras();
            Modelo.Compra  compra    = dalcompra.SelectCompras(idCompra)[0];
            compra.valorTotal = compra.valorTotal + precoTotal - compra.desconto;
            dalcompra.AtualizarCompras(compra);
            Response.Redirect("./InserirCompras.aspx?idCompra=" + idCompra);
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DAL.DALCompras       dalcompra  = new DAL.DALCompras();
            List <Modelo.Compra> listCompra = new List <Modelo.Compra>();

            listCompra = dalcompra.SelectAll();
            TableRow  tr1;
            TableCell tc0, tc1, tc2, tc3, tc4, tc5, tc6;

            for (int i = 0; i < listCompra.Count; i++)
            {
                Label l1 = new Label();
                l1.Text      = listCompra[i].datas.ToString("dd/MM/yyyy");
                l1.Font.Name = "Segoe UI Light";
                l1.Font.Size = 16;
                l1.Font.Bold = true;
                tc0          = new TableCell();
                tc0.Controls.Add(l1);
                tc0.Width = 150;

                Label l2 = new Label();
                l2.Text      = listCompra[i].Fornecedor.nome.ToString();
                l2.Font.Name = "Segoe UI Light";
                l2.Font.Size = 16;
                l2.Font.Bold = true;
                tc1          = new TableCell();
                tc1.Controls.Add(l2);
                tc1.Width = 150;

                Label l3 = new Label();
                l3.Text      = listCompra[i].desconto.ToString();
                l3.Font.Name = "Segoe UI Light";
                l3.Font.Size = 16;
                l3.Font.Bold = true;
                tc2          = new TableCell();
                tc2.Controls.Add(l3);
                tc2.Width = 150;

                Label l4 = new Label();
                l4.Text      = listCompra[i].valorTotal.ToString();
                l4.Font.Name = "Segoe UI Light";
                l4.Font.Size = 16;
                l4.Font.Bold = true;
                tc3          = new TableCell();
                tc3.Controls.Add(l4);
                tc3.Width = 170;

                HyperLink l5 = new HyperLink();
                l5.Text        = "Visualizar";
                l5.NavigateUrl = "~/AlterarItensCompra.aspx?idCompra=" + listCompra[i].idCompra;
                l5.Font.Name   = "Segoe UI Light";
                l5.Font.Size   = 16;
                l5.Font.Bold   = true;
                tc4            = new TableCell();
                tc4.Controls.Add(l5);
                tc4.Width = 190;

                HyperLink l6 = new HyperLink();
                l6.Text        = "Alterar";
                l6.NavigateUrl = "~/AlterarCompra.aspx?idCompra=" + listCompra[i].idCompra;
                l6.Font.Name   = "Segoe UI Light";
                l6.Font.Size   = 16;
                l6.Font.Bold   = true;
                tc5            = new TableCell();
                tc5.Controls.Add(l6);
                tc5.Width = 150;

                HyperLink l7 = new HyperLink();
                l7.Text        = "Excluir";
                l7.NavigateUrl = "~/ExcluirCompra.aspx?idCompra=" + listCompra[i].idCompra;
                l7.Font.Name   = "Segoe UI Light";
                l7.Font.Size   = 16;
                l7.Font.Bold   = true;
                tc6            = new TableCell();
                tc6.Controls.Add(l7);
                tc6.Width = 100;

                tr1 = new TableRow();
                tr1.Cells.Add(tc0);
                tr1.Cells.Add(tc1);
                tr1.Cells.Add(tc2);
                tr1.Cells.Add(tc3);
                tr1.Cells.Add(tc4);
                tr1.Cells.Add(tc5);
                tr1.Cells.Add(tc6);
                Table3.Rows.Add(tr1);
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DAL.DALItemCompra         dalitem   = new DAL.DALItemCompra();
                List <Modelo.ItensCompra> listItens = new List <Modelo.ItensCompra>();
                if (Request.QueryString["idCompra"] != null)
                {
                    DAL.DALCompras dalcompra = new DAL.DALCompras();
                    Modelo.Compra  compra    = dalcompra.SelectCompras(int.Parse(Request.QueryString["idCompra"]))[0];
                    TextBox3.Text          = compra.desconto.ToString();
                    Label6.Text            = compra.valorTotal.ToString();
                    Calendar1.SelectedDate = compra.datas;
                    int idCompra = int.Parse(Request.QueryString["idCompra"].ToString());
                    listItens = dalitem.SelectIdCompra(idCompra);
                    TableRow  tr1;
                    TableCell tc0, tc1, tc2, tc3, tc4;
                    for (int i = 0; i < listItens.Count; i++)
                    {
                        Label           l1      = new Label();
                        DAL.DALProdutos dalprod = new DAL.DALProdutos();
                        Modelo.Produtos produto = dalprod.SelectProdutos(listItens[i].idProduto)[0];
                        l1.Text      = produto.descricao;
                        l1.Font.Name = "Segoe UI Light";
                        l1.Font.Size = 16;
                        l1.Font.Bold = true;
                        tc0          = new TableCell();
                        tc0.Controls.Add(l1);
                        tc0.Width = 230;

                        Label l2 = new Label();
                        l2.Text      = listItens[i].unidade;
                        l2.Font.Name = "Segoe UI Light";
                        l2.Font.Size = 16;
                        l2.Font.Bold = true;
                        tc1          = new TableCell();
                        tc1.Controls.Add(l2);
                        tc1.Width = 200;

                        Label l3 = new Label();
                        l3.Text      = listItens[i].quantidade.ToString();
                        l3.Font.Name = "Segoe UI Light";
                        l3.Font.Size = 16;
                        l3.Font.Bold = true;
                        tc2          = new TableCell();
                        tc2.Controls.Add(l3);
                        tc2.Width = 200;

                        Label l4 = new Label();
                        l4.Text      = "&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;" + listItens[i].precoUnitario.ToString();
                        l4.Font.Name = "Segoe UI Light";
                        l4.Font.Size = 16;
                        l4.Font.Bold = true;
                        tc3          = new TableCell();
                        tc3.Controls.Add(l4);
                        tc3.Width = 220;

                        Label l5 = new Label();
                        l5.Text      = "&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;" + listItens[i].precoTotal.ToString();
                        l5.Font.Name = "Segoe UI Light";
                        l5.Font.Size = 16;
                        l5.Font.Bold = true;
                        tc4          = new TableCell();
                        tc4.Controls.Add(l5);
                        tc4.Width = 400;

                        tr1 = new TableRow();
                        tr1.Cells.Add(tc0);
                        tr1.Cells.Add(tc1);
                        tr1.Cells.Add(tc2);
                        tr1.Cells.Add(tc3);
                        tr1.Cells.Add(tc4);
                        Table1.Rows.Add(tr1);
                    }
                }
            }
        }