Exemple #1
0
        public void Create(Pedido entity)
        {
            string SQL = "INSERT INTO Pedido (Id, Cliente, DataPedido) Values ('"
                         + entity.Id.ToString() + "', '" + entity.Cliente.Id.ToString() + "', '" + entity.DataPedido.ToString("yyyyMMdd") + "')";

            BDSQL.ExecutarComandoSQL(SQL);
        }
        public void Create(Produto entity)
        {
            string SQL = "INSERT INTO Produto (Id, Nome, Descricao) Values ('"
                         + entity.Id.ToString() + "', '" + entity.Nome.ToString() + "', '" + entity.Descricao.ToString() + "')";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #3
0
        public void Create(PedidoFotoProduto entity)
        {
            string SQL = "INSERT INTO PedidoFotoProduto (Id, Pedido, FotoProduto) Values ('"
                         + entity.Id.ToString() + "', '" + entity.Pedido.Id.ToString() + "', '" + entity.FotoProduto.Id.ToString() + "')";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #4
0
        public void Create(Album entity)
        {
            string SQL = "INSERT INTO Album (ID, Nome, Descricao,Cliente) Values ('"
                         + entity.Id.ToString() + "', '" + entity.Nome + "', '" + entity.Descricao + "', '" + entity.Cliente.Id.ToString() + "')";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #5
0
        public void Update(Login login)
        {
            string SQL = "UPDATE Login SET Password = '******' WHERE Username = '******'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #6
0
        public void AtualizarSituacao(Foto entity)
        {
            string SQL = "UPDATE Foto SET Situacao = '" + entity.Situacao.ToString() +
                         "' WHERE Id = '" + entity.Id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #7
0
        public void Create(FotoProduto entity)
        {
            string SQL = "INSERT INTO FotoProduto (Id, Foto, Produto, Quantidade) Values ('"
                         + entity.Id.ToString() + "', '" + entity.Foto.Id.ToString() + "', '" + entity.Produto.Id.ToString() + "', '" + entity.Quantidade.ToString() + "')";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #8
0
        public void Update(PedidoFotoProduto entity)
        {
            string SQL = "UPDATE PedidoFotoProduto SET Pedido = '" + entity.Pedido.Id.ToString() +
                         "', FotoProduto = '" + entity.FotoProduto.Id.ToString() +
                         "' WHERE Id = '" + entity.Id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
        public void Update(Cliente entity)
        {
            string SQL = "UPDATE Cliente SET Nome = '" + entity.Nome.ToString() +
                         "', email = '" + entity.Login.Username.ToString() +
                         "' WHERE Id = '" + entity.Id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
        public void Delete(Guid id)
        {
            var    username = Read(id).Login.Username;
            string SQL      = "DELETE FROM Cliente WHERE Id = '" + id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
            new LoginADORepository().Delete(username);
        }
Exemple #11
0
        public void Update(Pedido entity)
        {
            string SQL = "UPDATE Pedido SET Cliente = '" + entity.Cliente.Id.ToString() +
                         "', DataPedido = '" + entity.DataPedido.ToString("yyyyMMdd") +
                         "' WHERE Id = '" + entity.Id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #12
0
        public void Create(Login entity)
        {
            Guid   guid = Guid.NewGuid();
            string SQL  = "INSERT INTO Login (Username, Password) Values ('"
                          + entity.Username.ToString() + "', '" + entity.Password.ToString() + "')";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #13
0
        public void Update(Album entity)
        {
            string SQL = "UPDATE Album SET Nome = '" + entity.Nome +
                         "', Descricao = '" + entity.Descricao +
                         "' WHERE Id = '" + entity.Id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
        public void Update(Produto entity)
        {
            string SQL = "UPDATE Produto SET Nome = '" + entity.Nome.ToString() +
                         "', Descricao = '" + entity.Descricao.ToString() +
                         "' WHERE Id = '" + entity.Id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #15
0
        public void Update(FotoProduto entity)
        {
            string SQL = "UPDATE FotoProduto SET Foto = '" + entity.Foto.Id.ToString() +
                         "', Produto = '" + entity.Produto.Id.ToString() +
                         "', Quantidade = '" + entity.Quantidade.ToString() +
                         "' WHERE Id = '" + entity.Id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
        public void Create(Cliente entity)
        {
            Guid guid = Guid.NewGuid();

            new LoginADORepository().Create(entity.Login);
            string SQL = "INSERT INTO Cliente (Id, Nome, email) Values ('"
                         + guid.ToString() + "', '" + entity.Nome.ToString() + "', '" + entity.Login.Username.ToString() + "')";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #17
0
        public void Delete(Guid id)
        {
            foreach (var pedidoFotoProduto in pedidoFotoProdutoRepository.ReadAll().Where(p => p.Pedido.Id == id))
            {
                fotoProdutoRepository.Delete(pedidoFotoProduto.FotoProduto.Id);
                pedidoFotoProdutoRepository.Delete(pedidoFotoProduto.Id);
            }
            string SQL = "DELETE FROM Pedido WHERE Id = '" + id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #18
0
        public void CreateWithId(Foto entity)
        {
            List <SqlParameter> parametros = new List <SqlParameter>();
            SqlParameter        parametro  = new SqlParameter();

            parametro.ParameterName = "@ID";
            parametro.SqlDbType     = System.Data.SqlDbType.UniqueIdentifier;
            parametro.Value         = entity.Id;
            parametros.Add(parametro);
            parametro = new SqlParameter();
            parametro.ParameterName = "@Album";
            parametro.SqlDbType     = System.Data.SqlDbType.UniqueIdentifier;
            parametro.Value         = entity.Album.Id;
            parametros.Add(parametro);
            parametro = new SqlParameter();
            parametro.ParameterName = "@Nome";
            parametro.SqlDbType     = System.Data.SqlDbType.VarChar;
            parametro.Value         = entity.Nome;
            parametros.Add(parametro);
            parametro = new SqlParameter();
            parametro.ParameterName = "@Descricao";
            parametro.SqlDbType     = System.Data.SqlDbType.VarChar;
            parametro.Value         = entity.Descricao;
            parametros.Add(parametro);
            parametro = new SqlParameter();
            parametro.ParameterName = "@Situacao";
            parametro.SqlDbType     = System.Data.SqlDbType.Int;
            parametro.Value         = entity.Situacao == null ? 0 : entity.Situacao;
            parametros.Add(parametro);
            //parametro = new SqlParameter();
            //parametro.ParameterName = "@Imagem";
            //parametro.SqlDbType = System.Data.SqlDbType.Image;
            //parametro.Value = entity.Imagem;
            //parametros.Add(parametro);
            parametro = new SqlParameter();
            parametro.ParameterName = "@fotourl";
            parametro.SqlDbType     = System.Data.SqlDbType.VarChar;
            parametro.Value         = entity.FotoUrl;
            parametros.Add(parametro);
            parametro = new SqlParameter();
            parametro.ParameterName = "@Minifotourl";
            parametro.SqlDbType     = System.Data.SqlDbType.VarChar;
            parametro.Value         = entity.MiniFotoUrl;
            parametros.Add(parametro);

            string SQL = "INSERT INTO Foto (Id, Album, Nome, descricao,Situacao, FotoUrl, MiniFotoUrl) Values (@ID, @Album, @Nome, @Descricao, @situacao, @fotourl, @minifotourl)";


            BDSQL.ExecutarComandoSQL(SQL, parametros.ToArray());
        }
        public void Delete(Guid id)
        {
            string SQL = "DELETE FROM Produto WHERE Id = '" + id.ToString() + "'";

            BDSQL.ExecutarComandoSQL(SQL);
        }
Exemple #20
0
        public void Delete(String username)
        {
            string SQL = "DELETE FROM Login WHERE Username = '******'";

            BDSQL.ExecutarComandoSQL(SQL);
        }