コード例 #1
0
        private void PopulaDataDeposito()
        {
            //esse código popula a DataDeposito
            string    sql    = @"SELECT tVendaBilheteriaFormaPagamento.ID,tVendaBilheteria.DataVenda, tVendaBilheteriaFormaPagamento.Dias FROM tVendaBilheteriaFormaPagamento
                            INNER JOIN tVendaBilheteria ON tVendaBilheteriaFormaPagamento.VendaBilheteriaID = tVendaBilheteria.ID ORDER BY tVendaBilheteriaFormaPagamento.ID";
            DataTable tabela = new DataTable();

            tabela.Columns.Add("ID", typeof(int));
            tabela.Columns.Add("DataVenda", typeof(string));
            tabela.Columns.Add("Dias", typeof(int));
            bd.Executar(sql);
            while (bd.Consulta().Read())
            {
                DataRow linha = tabela.NewRow();
                linha["ID"]        = bd.LerInt("ID");
                linha["DataVenda"] = bd.LerString("DataVenda");
                linha["Dias"]      = bd.LerInt("Dias");
                tabela.Rows.Add(linha);
            }
            DateTime data = new DateTime();

            bd.Fechar();
            bd.IniciarTransacao();
            foreach (DataRow linha in tabela.Rows)
            {
                data = DateTime.ParseExact((string)linha["DataVenda"], "yyyyMMddHHmmss", null);
                data = data.AddDays((int)linha["Dias"]);
                string sql2 = "UPDATE tVendaBilheteriaFormaPagamento SET DataDeposito = '" + data.ToString("yyyyMMddHHmmss") + "' WHERE ID = " + (int)linha["ID"];
                bd.Executar(sql2);
            }


            DataTable tabela2 = new DataTable();

            tabela2.Columns.Add("ID", typeof(int));
            tabela2.Columns.Add("EmpresaID", typeof(int));
            bd.FecharConsulta();
            bd.Consulta(@"SELECT tCaixa.ID, EmpresaID FROM tCaixa
                                                    INNER JOIN tLoja ON tLoja.ID= tCaixa.LojaID
                                                    INNER JOIN tCanal ON tLoja.CanalID= tCanal.ID");
            while (bd.Consulta().Read())
            {
                DataRow linha = tabela2.NewRow();
                linha["ID"]        = bd.LerInt("ID");
                linha["EmpresaID"] = bd.LerInt("EmpresaID");
                tabela2.Rows.Add(linha);
            }

            //insere na VendaBilheteriaFormaPagamentoItem
            VendaBilheteriaFormaPagamentoItem vb = new VendaBilheteriaFormaPagamentoItem();

            foreach (DataRow item in tabela2.Rows)
            {
                vb.Inserir((int)item["ID"], (int)item["EmpresaID"], bd);
            }


            bd.FinalizarTransacao();
        }
コード例 #2
0
 // passar o Usuario logado no sistema
 public VendaBilheteriaFormaPagamentoItemLista_B()
 {
     vendaBilheteriaFormaPagamentoItem = new VendaBilheteriaFormaPagamentoItem();
 }