public bool Delete(Guid Id) { bool toReturn = false; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { ShippingEntity _ShippingEntity = new ShippingEntity(Id); if (adapter.FetchEntity(_ShippingEntity)) { adapter.DeleteEntity(_ShippingEntity); toReturn = true; } } return toReturn; }
ShippingEntity getShipping(OrdersEntity order) { ShippingEntity ship = new ShippingEntity(); ship.Id = Guid.NewGuid(); ship.OrderId = order.Id; ship.ReceiverName = Filter.GetStringNoHtml(txtShipCustomerName.Text.Trim(), ShippingFields.ReceiverName.MaxLength); ship.RecerverEmail = Filter.GetMaxString(txtShipCustomerEmail.Text.Trim(), ShippingFields.RecerverEmail.MaxLength); ship.Address = Filter.GetStringNoHtml(txtShipCustomerAddress.Text.Trim(), ShippingFields.Address.MaxLength); ship.Phone1 = Filter.GetStringNoHtml(txtShipCustomerPhone.Text.Trim(), ShippingFields.Phone1.MaxLength); ship.Note = Filter.GetStringNoHtml(txtShipNote.Text.Trim(), ShippingFields.Note.MaxLength); ship.ShipDate = getDateTime(); return ship; }
ShippingDetailEntity[] getShipDetail(ShippingEntity ship, OrderDetailEntity[] orderDetail) { ShippingDetailEntity[] items = new ShippingDetailEntity[orderDetail.Length]; for (int i = 0; i < orderDetail.Length; i++) { items[i] = new ShippingDetailEntity(); items[i].Id = Guid.NewGuid(); items[i].ShippingId = ship.Id; items[i].OrderDetailId = orderDetail[i].Id; items[i].Amount = orderDetail[i].Amount; } return items; }
public ShippingEntity Insert(Guid OrderId, string ReceiverName, string RecerverEmail, string Address, string Phone1, string Phone2, decimal Cost, string Note, DateTime ShipDate) { ShippingEntity _ShippingEntity = new ShippingEntity(); using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { _ShippingEntity.OrderId = OrderId; _ShippingEntity.ReceiverName = ReceiverName; _ShippingEntity.RecerverEmail = RecerverEmail; _ShippingEntity.Address = Address; _ShippingEntity.Phone1 = Phone1; _ShippingEntity.Phone2 = Phone2; _ShippingEntity.Cost = Cost; _ShippingEntity.Note = Note; _ShippingEntity.ShipDate = ShipDate; adapter.SaveEntity(_ShippingEntity, true); } return _ShippingEntity; }
public ShippingEntity Insert(ShippingEntity _ShippingEntity) { using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { adapter.SaveEntity(_ShippingEntity, true); } return _ShippingEntity; }
public bool Update(Guid Id, Guid OrderId, string ReceiverName, string RecerverEmail, string Address, string Phone1, string Phone2, decimal Cost, string Note, DateTime ShipDate) { bool toReturn = false; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { ShippingEntity _ShippingEntity = new ShippingEntity(Id); if (adapter.FetchEntity(_ShippingEntity)) { _ShippingEntity.OrderId = OrderId; _ShippingEntity.ReceiverName = ReceiverName; _ShippingEntity.RecerverEmail = RecerverEmail; _ShippingEntity.Address = Address; _ShippingEntity.Phone1 = Phone1; _ShippingEntity.Phone2 = Phone2; _ShippingEntity.Cost = Cost; _ShippingEntity.Note = Note; _ShippingEntity.ShipDate = ShipDate; adapter.SaveEntity(_ShippingEntity, true); toReturn = true; } } return toReturn; }
public bool Update(ShippingEntity _ShippingEntity, RelationPredicateBucket filter) { bool toReturn = false; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { adapter.UpdateEntitiesDirectly(_ShippingEntity, filter); toReturn = true; } return toReturn; }
public bool Update(ShippingEntity _ShippingEntity) { bool toReturn = false; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { RelationPredicateBucket filter = new RelationPredicateBucket(); IPredicateExpression _PredicateExpression = new PredicateExpression(); _PredicateExpression.Add(ShippingFields.Id == _ShippingEntity.Id); filter.PredicateExpression.Add(_PredicateExpression); adapter.UpdateEntitiesDirectly(_ShippingEntity, filter); toReturn = true; } return toReturn; }
public ShippingEntity SelectOne(Guid Id) { ShippingEntity toReturn = null; using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter()) { ShippingEntity _ShippingEntity = new ShippingEntity(Id); if (adapter.FetchEntity(_ShippingEntity)) { toReturn = _ShippingEntity; } } return toReturn; }