Exemple #1
0
 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;
 }
Exemple #2
0
    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;
    }
Exemple #3
0
    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;
    }
Exemple #4
0
        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;
        }
Exemple #5
0
 public ShippingEntity Insert(ShippingEntity _ShippingEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_ShippingEntity, true);
     }
     return _ShippingEntity;
 }
Exemple #6
0
        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;
        }
Exemple #7
0
 public bool Update(ShippingEntity _ShippingEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_ShippingEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }
Exemple #8
0
        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;
        }
Exemple #9
0
 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;
 }