public IList<ZoneBinRelation> Select(ZoneBinRelation data)
        {

            IList<ZoneBinRelation> datos = new List<ZoneBinRelation>();
            datos = GetHsql(data).List<ZoneBinRelation>();
                if (!Factory.IsTransactional)
                    Factory.Commit();
                return datos;

        }
Beispiel #2
0
        public override Boolean Equals(object obj)
        {
            if ((obj == null) || (obj.GetType() != this.GetType()))
            {
                return(false);
            }
            ZoneBinRelation castObj = (ZoneBinRelation)obj;

            return((castObj != null) &&
                   (this.RowID == castObj.RowID));
        }
Beispiel #3
0
        //Asigna un Bin a un producto
        public void AssignBinToProduct(Product product, ZoneBinRelation zoneBin)
        {

            Zone zone;
            Factory.IsTransactional = true;

            try
            {

                //1. Crea Label zona const else nombre del producto si no existe
                IList<Zone> zoneList = Factory.DaoZone().Select(new Zone { Location = zoneBin.Bin.Location, Name = product.ProductCode });
                if (zoneList == null || zoneList.Count == 0)
                {
                    Status status = Wtype.GetStatus(new Status { StatusID = EntityStatus.Active });
                    //Create Zone 
                    zone = new Zone
                    {
                        Name = product.ProductCode,
                        CreationDate = DateTime.Now,
                        CreatedBy = zoneBin.CreatedBy,
                        Description = "Zone for Product " + product.ProductCode + ", " + product.Name,
                        Location = zoneBin.Bin.Location,
                        Status = status,
                        IsDefault = false
                    };

                    zone = Factory.DaoZone().Save(zone);

                }
                else
                    zone = zoneList.FirstOrDefault();




                //2. Crear el Zone entity relation
                ZoneEntityRelation zoneEntity = new ZoneEntityRelation
                {
                    Entity = Factory.DaoClassEntity().SelectById(new ClassEntity { ClassEntityID = EntityID.Product }),
                    EntityRowID = product.ProductID,
                    Zone = zone
                };

                //Revisa si existe la relacion Zone Entity
                IList<ZoneEntityRelation> zoneEntityList = Factory.DaoZoneEntityRelation().Select(zoneEntity);

                if (zoneEntityList == null || zoneEntityList.Count == 0)
                {
                    zoneEntity.CreationDate = DateTime.Today;
                    zoneEntity.CreatedBy = zoneBin.CreatedBy;
                    zoneEntity = Factory.DaoZoneEntityRelation().Save(zoneEntity);
                }


                //3. Crea el zone Bin Relation
                //ZoneBinRelation zoneBinRel = new ZoneBinRelation
                //{
                //    Bin = bin,
                //    Zone = zone,
                //    BinType = binDirection
                //};

                zoneBin.Zone = zone;

                //Revisa que no exista la Relacion ZoneBin
                IList<ZoneBinRelation> zoneBinList = Factory.DaoZoneBinRelation().Select(zoneBin);

                if (zoneBinList != null && zoneBinList.Count > 0)
                    throw new Exception("Bin already was assigned to the product.");

                zoneBin.CreationDate = DateTime.Today;
                zoneBin = Factory.DaoZoneBinRelation().Save(zoneBin);

                product = Factory.DaoProduct().SelectById(product);

                Factory.Commit();

            }
            catch (Exception ex)
            {
                Factory.Rollback();
                throw new Exception("Error creating Zone. " + ex.Message);
            }
        }
Beispiel #4
0
 public void AssignBinToProduct(Product product, ZoneBinRelation zoneBin)
 {
     BasicMngr.AssignBinToProduct(product, zoneBin);
 }
Beispiel #5
0
 public void DeleteZoneBinRelation(ZoneBinRelation data) { Factory.DaoZoneBinRelation().Delete(data); }
Beispiel #6
0
 public void UpdateZoneBinRelation(ZoneBinRelation data) { Factory.DaoZoneBinRelation().Update(data); }
Beispiel #7
0
 public ZoneBinRelation SaveZoneBinRelation(ZoneBinRelation data) { return Factory.DaoZoneBinRelation().Save(data); }
Beispiel #8
0
 public IList<ZoneBinRelation> GetZoneBinRelation(ZoneBinRelation data) { return Factory.DaoZoneBinRelation().Select(data); }
 public ZoneBinRelation SelectById(ZoneBinRelation data)
 {
     return (ZoneBinRelation)base.SelectById(data);
 }
 public Boolean Delete(ZoneBinRelation data)
 {
     return base.Delete(data);
 }
 public Boolean Update(ZoneBinRelation data)
 {
     return base.Update(data);
 }
 public ZoneBinRelation Save(ZoneBinRelation data)
 {
     return (ZoneBinRelation)base.Save(data);
 }