Beispiel #1
0
        public void CheckState(GarmetBM garmentBM)
        {
            Garment garmet = Mapper.Map <GarmetBM, Garment>(garmentBM);

            this.Context.Entry(garmet).State = EntityState.Modified;
            this.Context.SaveChanges();
        }
Beispiel #2
0
    public Garment RemoveGarmentFromLine(int position)
    {
        //Check whether position contains a garment
        bool actionCalled = false;

        if (hungGarments[position] != null)
        {
            Garment garment = hungGarments[position];
            for (int i = 0; i < hungGarments.Length; i++)
            {
                if (hungGarments[i] != null && hungGarments[i].Equals(garment))
                {
                    hungGarments[i] = null;
                    if (!actionCalled)
                    {
                        if (GarmentRemoved != null)
                        {
                            GarmentRemoved(i);
                        }
                        actionCalled = true;
                    }
                }
            }
            return(garment);
        }
        return(null);
    }
Beispiel #3
0
 public void Delete(Garment garment)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, garment);
     }
 }
    private void GrabGarmentFromContainer(Garment garment)
    {
        LaundryGarment laundryGarment = garment.CreateLaundryGarment(cursor.transform.position, cursor.transform.rotation, activeWorkStation.laundryTaskArea.transform);

        target = laundryGarment;
        Grab();
    }
Beispiel #5
0
 public virtual void AddComponent(Garment g)
 {
     if (g != null && !components.Contains(g))
     {
         this.components.Add(g);
     }
 }
Beispiel #6
0
        public void AddGarment(Garment garment)
        {
            var id = Users.AddGarment(Username, garment);

            garment.ID = id;
            (Garments as IList <Garment>).Add(garment);
        }
 public NewGarmentViewModel(Action closeAction, CollectViewModel collectViewModel)
 {
     AddNewGarmentCommand = new RelayCommand(AddNewGarment);
     ExitCommand          = new RelayCommand(closeAction);
     _garment             = new Garment();
     _collectViewModel    = collectViewModel;
 }
Beispiel #8
0
        public virtual ClosetGarment AddGarment(Garment g)
        {
            ClosetGarment cg = new ClosetGarment(g, this);

            garments.Add(cg);
            return(cg);
        }
Beispiel #9
0
        public GarmetDetailsVM GetDetails(int?id)
        {
            Garment         garmet = this.Context.Clothes.Where(g => g.Id == id).FirstOrDefault();
            GarmetDetailsVM vm     = Mapper.Map <Garment, GarmetDetailsVM>(garmet);

            return(vm);
        }
Beispiel #10
0
        public void instantiationProduct(Product product, ProductDetailCalculatorParameter parameter)
        {
            ProductDetail productDetail = null;

            if (product.ProductType != null)
            {
                if (product.ProductType.Equals("FoodAndBeverageItems"))
                {
                    productDetail = new FoodAndBeverage(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("MaterialItems"))
                {
                    productDetail = new Material(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("GarmentItems"))
                {
                    productDetail = new Garment(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("TransportationServices"))
                {
                    productDetail = new Transportation(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("TelecommunicationServices"))
                {
                    productDetail = new Telecommunication(this.Delimeter, product);
                }
                else
                {
                    throw new Exception("Unknown Product Type");
                }
            }
        }
        public void calculateProductUnitPrice(Product product, ProductDetailCalculatorParameter parameter)
        {
            ProductDetail productDetail = null;

            if (product.ProductType != null)
            {
                if (product.ProductType.Equals("FoodAndBeverageItems"))
                {
                    productDetail = new FoodAndBeverage(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("MaterialItems"))
                {
                    productDetail = new Material(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("GarmentItems"))
                {
                    productDetail = new Garment(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("TransportationServices"))
                {
                    productDetail = new Transportation(this.Delimeter, product);
                }
                else if (product.ProductType.Equals("TelecommunicationServices"))
                {
                    productDetail = new Telecommunication(this.Delimeter, product);
                }
                else
                {
                    throw new Exception("Unknown Product Type");
                }

                productDetail.setAdditionalParameter(parameter);
                product.UnitPrice = productDetail.calculateProductCost() * productDetail.getDecCostRate();
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("GarmentID,GarmentName,Gender,Description,ImageUrl,Colour,Size,Price,SpecialOfferPrice,IsAccessory,Department,Sleeves,Length")] Garment garment)
        {
            if (id != garment.GarmentID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(garment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GarmentExists(garment.GarmentID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(garment));
        }
Beispiel #13
0
        public virtual void AddPreGarment(Garment garment)
        {
            int pos = OutfitValidationService.GetClosetOutfitPosition(garment);

            PropertyInfo pi = new PreCombination().GetType().GetProperty(string.Format("Garment{0}", pos + 1));

            pi.SetValue(this, garment.PreGarment, null);
        }
Beispiel #14
0
 public bool AddGarment(Garment garment)
 {
     if (CurrentLoad() + garment.size <= Capacity)
     {
         contents.Add(garment);
         return(true);
     }
     return(false);
 }
 private void OnGarmentHung(int i)
 {
     if (index == i)
     {
         //Enable the right renderer, based on the garment's type
         //Give it a reference to the garment
         Garment garment = clothesline.hungGarments[i];
         if (garment is GarmentTop)
         {
             Top.gameObject.SetActive(true);
             Top.garment = garment;
             Top.UpdateAppearance();
         }
         else if (garment is GarmentPants)
         {
             Pants.gameObject.SetActive(true);
             Pants.garment = garment;
             Pants.UpdateAppearance();
         }
         else if (garment is GarmentUnderwear)
         {
             Underwear.gameObject.SetActive(true);
             Underwear.garment = garment;
             Underwear.UpdateAppearance();
         }
         else if (garment is GarmentSock)
         {
             Sock.gameObject.SetActive(true);
             Sock.garment = garment;
             Sock.UpdateAppearance();
         }
         else if (garment is GarmentDress)
         {
             Dress.gameObject.SetActive(true);
             Dress.garment = garment;
             Dress.UpdateAppearance();
         }
         else if (garment is GarmentShirt)
         {
             Shirt.gameObject.SetActive(true);
             Shirt.garment = garment;
             Shirt.UpdateAppearance();
         }
         else if (garment is GarmentSkirt)
         {
             Skirt.gameObject.SetActive(true);
             Skirt.garment = garment;
             Skirt.UpdateAppearance();
         }
         else if (garment is OllieFemur)
         {
             Bone.gameObject.SetActive(true);
             Bone.garment = garment;
             Bone.UpdateAppearance();
         }
     }
 }
Beispiel #16
0
 protected void btnSaveUpdate_Click(object sender, EventArgs e)
 {
     garment                    = GM.GetGarmentByKey(long.Parse(gvGarmentList.SelectedRow.Cells[2].Text));
     garment.GarmentCode        = txtGarmentCodeUpdate.Text.ToUpper();
     garment.GarmentDescription = txtGarmentDescriptionUpdate.Text.ToUpper();
     garment.TopOrBottom        = char.Parse(rdioTopOrBottomUpdate.SelectedValue);
     GM.Save(garment);
     LoadAllGarments();
 }
Beispiel #17
0
        /// <summary>
        /// Obtain the correct garment position given the passed garment, starting from zero.
        /// </summary>
        /// <returns>A number between 0 and 12</returns>
        public static int GetClosetOutfitPosition(Garment garment)
        {
            if (garment.Tags.Silouhette.Layers.Count == 0)
            {
                throw new Exception(string.Format("No layer defined for garment {0}.", garment.Id));
            }

            return(dict[garment.Tags.Silouhette.Layers[0]]);
        }
Beispiel #18
0
 public Garment RemoveTopGarment()
 {
     if (contents.Count > 0)
     {
         Garment garment = contents[contents.Count - 1];
         contents.RemoveAt(contents.Count - 1);
         return(garment);
     }
     return(null);
 }
    public override void OnGrab()
    {
        //Grab garment from machine
        Garment garment = sewingMachine.RemoveGarmentFromMachine();

        if (garment != null)
        {
            GarmentGrabbed(garment);
        }
    }
Beispiel #20
0
 public override void OnGrab()
 {
     if (basketCollider.enabled)
     {
         if (TakeOutGarment != null)
         {
             TakeOutGarment(Garment.GetRandomGarment());
         }
     }
 }
        public ActionResult RemoveGarmentFromCloset(int garmentSelected)
        {
            Closet        closet = closetRepository.Get(this.ClosetId);
            ClosetGarment cg     = new List <ClosetGarment>(closet.Garments).Find(e => e.Id.Equals(garmentSelected));
            Garment       g      = cg.Garment;

            closet.RemoveGarment(cg);
            closetRepository.SaveOrUpdate(closet);
            closetRepository.RemoveGarmentFromCloset(closet.Id, g.Id);
            return(Json(new { Success = true }));
        }
Beispiel #22
0
 public virtual void AddGarment(Garment g)
 {
     if (!(new List <WishGarment>(this.garments)).Exists(delegate(WishGarment record) { if (record.Garment.Id == g.Id)
                                                                                        {
                                                                                            return(true);
                                                                                        }
                                                                                        return(false); }))
     {
         garments.Add(new WishGarment(g));
     }
 }
Beispiel #23
0
        public void RemoveById(int id)
        {
            Garment garmet = this.Context.Clothes.Where(g => g.Id == id).FirstOrDefault();

            if (garmet != null)
            {
                garmet.Pictures.Clear();
                this.Context.Clothes.Remove(garmet);
                this.Context.SaveChanges();
            }
        }
 private void AddNewGarment()
 {
     if (IsValidate())
     {
         _garment.Paid = false;
         _collectViewModel.Garments.Add(_garment);
         _collectViewModel.CalculateTotalAmount();
         _garment = new Garment();
         Reset();
     }
 }
        public async Task <IActionResult> Create([Bind("GarmentID,GarmentName,Gender,Description,ImageUrl,Colour,Size,Price,SpecialOfferPrice,IsAccessory,Department,Sleeves,Length")] Garment garment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(garment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(garment));
        }
Beispiel #26
0
 /// <summary>
 /// Determines if a garment is an accessory
 /// </summary>
 /// <param name="garment">Garment</param>
 /// <returns>True if it is an accessory</returns>
 public static bool IsAccessory(Garment garment)
 {
     return(garment.Tags.Silouhette.Layers.Contains(LayerCode.ACC1) ||
            garment.Tags.Silouhette.Layers.Contains(LayerCode.ACC2) ||
            garment.Tags.Silouhette.Layers.Contains(LayerCode.ACC3) ||
            garment.Tags.Silouhette.Layers.Contains(LayerCode.ACC4) ||
            garment.Tags.Silouhette.Layers.Contains(LayerCode.ACC5) ||
            garment.Tags.Silouhette.Layers.Contains(LayerCode.ACC6) ||
            garment.Tags.Silouhette.Layers.Contains(LayerCode.ACC7) ||
            garment.Tags.Silouhette.Layers.Contains(LayerCode.ACC8));
 }
Beispiel #27
0
 public virtual bool HasGarment(Garment g)
 {
     return((new List <ClosetGarment>(this.garments)).Exists(delegate(ClosetGarment record)
     {
         if (record.Garment.Id == g.Id)
         {
             return true;
         }
         return false;
     }));
 }
Beispiel #28
0
        public Garment AddAGarment(Garment garmentToAdd)
        {
            var sql = @"INSERT INTO Garments ( Name, Description, UserId)
                     output inserted.*
                     VALUES(@Name, @Description, @UserId);";

            using (var db = new SqlConnection(connectionString))
            {
                var newGarment = db.QueryFirstOrDefault <Garment>(sql, garmentToAdd);
                return(newGarment);
            }
        }
Beispiel #29
0
        public Garment CreateGarment(PreGarment pregarment)
        {
            Garment g = new Garment();

            SharpArch.Testing.EntityIdSetter.SetIdOf <int>(g, pregarment.Id);

            g.Tags.Silouhette = new Silouhette {
                PreSilouhette = pregarment.PreSilouhette
            };
            g.Tags.Pattern = new Pattern {
                Type = pregarment.PatternType
            };
            g.Tags.Colors.Add(new Color {
                Family = pregarment.ColorFamily
            });

            g.Tags.Seasons.Add(Season.Summer);
            g.Tags.EventTypes.Add(CreateEventTypes()[0]);
            g.PreGarment = pregarment;

            //if (rnd.Next(0, 5) != 0) // Some could be for all seasons.
            //{
            //    // Most logically they will be used on two seasons.
            //    if (rnd.Next(0, 2) == 0)
            //    {
            //        g.Tags.Seasons.Add(Season.Summer);
            //        g.Tags.Seasons.Add(Season.Spring);
            //    }
            //    else
            //    {
            //        g.Tags.Seasons.Add(Season.Winter);
            //        g.Tags.Seasons.Add(Season.Fall);
            //    }
            //}
            //else
            //{
            //foreach (Season season in Enum.GetValues(typeof(Season)))
            //    g.Tags.Seasons.Add(season);
            //}

            //if (rnd.Next(0, 5) != 0) // Some could be for all seasons.
            //{
            //    g.Tags.EventTypes.Add(GetRandomEventType());
            //    g.Tags.EventTypes.Add(GetRandomEventType());
            //}
            //else
            //{
            //foreach (EventType eventType in CreateEventTypes())
            //    g.Tags.EventTypes.Add(eventType);
            //}

            return(g);
        }
Beispiel #30
0
    //private void Initialize() {

    //}

    private void UpdateAppearance()
    {
        garment = GetComponentInParent <LaundryGarment>().garment;
        if (garment != null)
        {
            TXT_Fabric.text  = "100% " + garment.fabric.name;
            TXT_Owner.text   = "Owner: #" + garment.customerID.ToString("D3");
            WashIcon.sprite  = WashSprites[(int)garment.fabric.washingRestrictions];
            DryIcon.sprite   = DrySprites[(int)garment.fabric.dryingRestrictions];
            PressIcon.sprite = PressSprites[(int)garment.fabric.pressingRestrictions];
        }
    }