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)); } }
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); } }
public void Delete(Guid id) { using (var connection = context.CreateConnection()) { connection.Execute(ProductCategoryQuery.Delete(id)); } }
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); } }
public IEnumerable <Category> GetAll() { using (var connection = context.CreateConnection()) { return(connection.Query <Category>(CategoryQuery.All())); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); }