Exemplo n.º 1
0
 public void Delete(Guid id)
 {
     using (var connection = context.CreateConnection())
     {
         connection.Execute(UserRoleQuery.Delete(id));
     }
 }
 public void Delete(Guid id)
 {
     using (var connection = context.CreateConnection())
     {
         connection.Execute(ContactDetailQuery.Delete(id));
     }
 }
Exemplo n.º 3
0
        public async Task <Link> CreateAsync(Link link)
        {
            if (link.Id == Guid.Empty)
            {
                link.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                await connection.ExecuteAsync(LinkQuery.Insert(link));

                return(link);
            }
        }
Exemplo n.º 4
0
 public void Delete(Guid id)
 {
     using (var connection = context.CreateConnection())
     {
         connection.Execute(ProductCategoryQuery.Delete(id));
     }
 }
Exemplo n.º 5
0
        public Unit Create(Unit unit)
        {
            if (unit.Id == Guid.Empty)
            {
                unit.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(UnitQuery.Insert(unit));
                return(unit);
            }
        }
Exemplo n.º 6
0
 public IEnumerable <Category> GetAll()
 {
     using (var connection = context.CreateConnection())
     {
         return(connection.Query <Category>(CategoryQuery.All()));
     }
 }
Exemplo n.º 7
0
 public void Delete(Guid id)
 {
     using (var connection = context.CreateConnection())
     {
         connection.Execute(SelectProduct.Delete(id));
     }
 }
        public OrderLine Create(OrderLine OrderLine)
        {
            if (OrderLine.Id == Guid.Empty)
            {
                OrderLine.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(OrderLineQuery.Insert(OrderLine));
                return(OrderLine);
            }
        }
Exemplo n.º 9
0
        public Entity Create(Entity entity)
        {
            if (entity.Id == Guid.Empty)
            {
                entity.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(EntityQuery.Insert(entity));
                return(entity);
            }
        }
Exemplo n.º 10
0
        public async Task <Employee> CreateAsync(Employee employee)
        {
            if (employee.Id == Guid.Empty)
            {
                employee.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                await connection.ExecuteAsync(EmployeeQuery.Insert(employee));

                return(employee);
            }
        }
Exemplo n.º 11
0
        public Currency Create(Currency currency)
        {
            if (currency.Id == Guid.Empty)
            {
                currency.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(CurrencyQuery.Insert(currency));
                return(currency);
            }
        }
Exemplo n.º 12
0
        public Order Create(Order order)
        {
            if (order.Id == Guid.Empty)
            {
                order.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(OrderQuery.Insert(order));
                return(order);
            }
        }
Exemplo n.º 13
0
        public OrderLineDetail Create(OrderLineDetail OrderLineDetail)
        {
            if (OrderLineDetail.Id == Guid.Empty)
            {
                OrderLineDetail.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(OrderLineDetailQuery.Insert(OrderLineDetail));
                return(OrderLineDetail);
            }
        }
Exemplo n.º 14
0
        public Uom Create(Uom uom)
        {
            if (uom.Id == Guid.Empty)
            {
                uom.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(UomQuery.Insert(uom));
                return(uom);
            }
        }
Exemplo n.º 15
0
        public Location Create(Location location)
        {
            if (location.Id == Guid.Empty)
            {
                location.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(LocationQuery.Insert(location));
                return(location);
            }
        }
Exemplo n.º 16
0
        public async Task <ProductSpecification> CreateAsync(ProductSpecification specification)
        {
            if (specification.Id == Guid.Empty)
            {
                specification.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                await connection.ExecuteAsync(ProductSpecificationQuery.Insert(ToModel(specification)));

                return(specification);
            }
        }
Exemplo n.º 17
0
        public Address Create(Address Address)
        {
            if (Address.Id == Guid.Empty)
            {
                Address.Id = Guid.NewGuid();
            }

            if (Address.Line2 == null)
            {
                Address.Line2 = String.Empty;
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(AddressQuery.Insert(Address));
                return(Address);
            }
        }
Exemplo n.º 18
0
        public ProductPrice Create(ProductPrice price)
        {
            if (price == null)
            {
                throw new ArgumentNullException("price");
            }

            if (price.Id == Guid.Empty)
            {
                price.Id = Guid.NewGuid();
            }

            if (price.ProductId == Guid.Empty)
            {
                throw new ArgumentNullException("ProductId");
            }

            using (var connection = context.CreateConnection())
            {
                connection.Open();

                using (var command = connection.CreateCommand())
                {
                    /// Check id
                    command.CommandText = string.Format("select 1 from [BUSINESS.WMS.PRICE] where [GUID_RECORD] = '{0}'", price.Id);
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            throw new Exception("Record already exists");
                        }
                    }

                    /// Check product id
                    command.CommandText = string.Format("select 1 from [BUSINESS.WMS.PRICE] where [ITEM_GUID] = '{0}'", price.ProductId);
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            throw new Exception("Record already exists");
                        }
                    }

                    command.CommandText = @"insert into [BUSINESS.WMS.PRICE] (
	                    [GUID_RECORD],
	                    [ITEM_GUID],
	                    [CURRENCY_GUID],
	                    [CURRENCY_CODE],
	                    [LOCATION_GUID],
	                    [PRICE],
	                    [BATCH_GUID],
	                    [HIDDEN],
	                    [DELETED]) 
                    values (@GUID_RECORD, @ITEM_GUID, @CURRENCY_GUID, @CURRENCY_CODE, @LOCATION_GUID, @PRICE, @BATCH_GUID, @HIDDEN, @DELETED)";

                    connection.Execute(command.CommandText, new {
                        GUID_RECORD   = price.Id,
                        ITEM_GUID     = price.ProductId,
                        CURRENCY_GUID = Guid.Empty,
                        CURRENCY_CODE = price.CurrencyCode,
                        LOCATION_GUID = (Guid?)null,
                        PRICE         = price.Price,
                        BATCH_GUID    = (Guid?)null,
                        HIDDEN        = 0,
                        DELETED       = 0
                    });
                }
            }

            return(price);
        }