public async Task <IActionResult> PutPowder(int id, Powder powder)
        {
            if (id != powder.Id)
            {
                return(BadRequest());
            }

            _context.Entry(powder).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PowderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
 public Neighbors(ref NativeHashMap <int, int> positions, Powder p, int index)
 {
     this.p         = p;
     this.index     = index;
     this.positions = positions;
     top            = topLeft = topRight = left = right = bottomRight = bottomLeft = bottom = -2;
 }
Exemple #3
0
 void Steam(ref Powder p, ref Neighbors n)
 {
     if (!n.TopEmpty() && powders[n.Top()].type == PowderTypes.Stone)
     {
         ChangeElement(n.index, PowderTypes.Water);
     }
 }
Exemple #4
0
        // Tømmer alt indhold
        public string Empty()
        {
            filter = null;
            powder = null;

            return("The machine is now empty");
        }
Exemple #5
0
        public ActionResult EditPowders(ICollection <MenuItem> powders)
        {
            Models.Customer  customer   = GetLoggedInCustomer();
            Models.OrderItem orderItem  = GetOrderItem(customer.CurrentOrderItemId);
            List <Powder>    powderList = new List <Powder>();

            for (int i = 0; i < powders.Count(); i++)
            {
                MenuItem setPowder = powders.ElementAt(i);
                if (setPowder.Quantity == null)
                {
                    setPowder.Quantity = 0;
                }
                Powder newPowder = new Powder();
                newPowder.PowderType  = setPowder.Name;
                newPowder.Scoops      = setPowder.Quantity;
                newPowder.OrderItemId = orderItem.OrderItemId;
                newPowder.Price       = (setPowder.Price * setPowder.Quantity);

                powderList.Add(null);
                powderList[i]             = new Powder();
                powderList[i].PowderType  = newPowder.PowderType;
                powderList[i].Scoops      = newPowder.Scoops;
                powderList[i].OrderItemId = newPowder.OrderItemId;
                powderList[i].Price       = newPowder.Price;

                db.SaveChanges();
            }
            orderItem.Powders = powderList;

            db.SaveChanges();
            return(RedirectToAction("ReviewOrder", new { id = orderItem.OrderItemId }));
        }
        public void renamePowder(int id, string newName)
        {
            Powder powder = new Powder(id, newName);

            powderRepository.save(powder);
            PowdersUpdated();
        }
        public async Task <ActionResult <Powder> > PostPowder(Powder powder)
        {
            _context.Powder.Add(powder);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPowder", new { id = powder.Id }, powder));
        }
Exemple #8
0
    /// <summary>
    /// 粉ものの投入処理
    /// </summary>
    /// <param name="powder"></param>
    private void ThrowIn(Powder powder)
    {
        //contentsID.Enqueue(powder.type);
        contentsID.Add(powder.type);

        //見かけを変える処理
        //以下に記述
    }
Exemple #9
0
        public void testConstructor()
        {
            Powder powder = new Powder(1, "a");

            Assert.AreEqual(1, powder.Id);
            Assert.AreEqual("a", powder.PowderName);
            Assert.IsFalse(-1 == powder.Id);
        }
Exemple #10
0
 void Lava(ref Powder p, ref Neighbors n)
 {
     if (!n.BottomEmpty() &&
         powders[n.Bottom()].type != PowderTypes.Fire &&
         powders[n.Bottom()].type != PowderTypes.Lava &&
         powders[n.Bottom()].type != PowderTypes.Stone
         )
     {
         PowderSystemUtils.SchdeduleRemovePowder(ref toDeleteEntities, n.Bottom());
     }
 }
Exemple #11
0
        public void testDelete()
        {
            repository.deleteAll();
            repository.delete(null);

            Powder powder = new Powder("test");

            repository.save(powder);
            repository.delete(powder);

            Assert.AreEqual(0, repository.count());
        }
Exemple #12
0
        public override void GetDataFromComponents(CosmeticProduct currentProduct, Control.ControlCollection controls)
        {
            base.GetDataFromComponents(currentProduct, controls);
            Control[] controlList   = GetComponentsForInput(controls);
            Powder    currentPowder = (Powder)currentProduct;
            ComboBox  temp          = (ComboBox)controlList[powderPackageTypeIndex];

            currentPowder.Package = (Powder.TypeOfPackage)Enum.Parse(typeof(Powder.TypeOfPackage), temp.SelectedValue.ToString());
            CheckBox tempCheckBox = (CheckBox)controlList[talcIndex];

            currentPowder.isContainTalc = tempCheckBox.Checked;
        }
        //============================================================================*
        // Export()
        //============================================================================*

        public void Export(cRWXMLDocument XMLDocument, XmlElement XMLParentElement, bool fIncludeTransactions = true)
        {
            if (Count > 0)
            {
                XmlElement XMLElement = XMLDocument.CreateElement(ExportName);
                XMLParentElement.AppendChild(XMLElement);

                foreach (cPowder Powder in this)
                {
                    Powder.Export(XMLDocument, XMLElement, false, fIncludeTransactions);
                }
            }
        }
    void SendFireworks(GameObject instance, Charge charge, Powder powder)
    {
        float diff = Random.Range(-5.0f, 5.0f);

        instance.transform.position = new Vector3(instance.transform.position.x + diff, instance.transform.position.y, instance.transform.position.z);
        var particleSystem  = instance.GetComponent <ParticleSystem> ();
        var handleExplosion = particleSystem.GetComponent <HandleExplosion> ();

        handleExplosion.activateSceneTransition = false;
        handleExplosion.charge = charge;
        handleExplosion.powder = powder;
        StartCoroutine(Emit(particleSystem));
    }
Exemple #15
0
 private void AddPowder()
 {
     if (frmPowder.IsOpen)
     {
         System.Windows.MessageBox.Show("An instance of the add powder window is currently open.");
         return;
     }
     _SelectedPowder        = new Powder();
     _frmPowder             = new frmPowder();
     _frmPowder.DataContext = this;
     _frmPowder.ResizeMode  = System.Windows.ResizeMode.NoResize;
     _frmPowder.Show();
 }
        public ActionResult Create([Bind(Include = "Id,Name,ManufacturerId,PowderTypeId,PowderShapeId,Notes")] Powder modEntity)
        {
            if (ModelState.IsValid)
            {
                this.service.Add(modEntity);
                return(RedirectToAction("Index"));
            }

            ViewBag.MaufacturerId = new SelectList(this.manufacturers, "Id", "Name", modEntity.ManufacturerId);
            ViewBag.PowderShapeId = new SelectList(this.powderShapes, "Id", "Name", modEntity.PowderShapeId);
            ViewBag.PowderTypeId  = new SelectList(this.powderTypes, "Id", "Name", modEntity.PowderTypeId);

            return(View(modEntity));
        }
Exemple #17
0
 public static void Spawn(ref EntityCommandBuffer.Concurrent cmdBuffer, Powder p)
 {
     // Debug.Log("Spawn: " + x + ", " + y);
     cmdBuffer.CreateEntity(PowderGame.powderArchetype);
     cmdBuffer.SetComponent(p);
     cmdBuffer.SetComponent(new Position2D {
         Value = CoordToWorld(p.coord.x, p.coord.y)
     });
     cmdBuffer.SetComponent(new Heading2D {
         Value = new float2(0.0f, 1.0f)
     });
     cmdBuffer.AddSharedComponent(PowderTypes.values[p.type].renderer);
     powderCount++;
 }
Exemple #18
0
 void Fire(ref Powder p, ref Neighbors n)
 {
     if (!n.TopEmpty())
     {
         if (powders[n.Top()].type == PowderTypes.Wood)
         {
             ChangeElement(n.Top(), rand.Chance(2) ? PowderTypes.Fire : PowderTypes.Steam);
         }
         else if (powders[n.Top()].type == PowderTypes.Sand)
         {
             ChangeElement(n.Top(), PowderTypes.Glass);
         }
     }
 }
        //============================================================================*
        // ProcessPowders()
        //============================================================================*

        public void ProcessPowders()
        {
            m_nNumBadPowders = 0;

            foreach (cPowder Powder in m_DataFiles.PowderList)
            {
                if (!Powder.Validate())
                {
                    m_nNumBadPowders++;
                }

                ProcessTransactionList(Powder);
            }
        }
Exemple #20
0
 void Water(ref Powder p, ref Neighbors n)
 {
     if (!n.BottomEmpty())
     {
         if (powders[n.Bottom()].type == PowderTypes.Fire || powders[n.Bottom()].type == PowderTypes.Steam)
         {
             PowderSystemUtils.SchdeduleRemovePowder(ref toDeleteEntities, n.Bottom());
         }
         else if (powders[n.Bottom()].type == PowderTypes.Lava)
         {
             ChangeElement(n.index, PowderTypes.Steam);
         }
     }
 }
Exemple #21
0
 void Acid(ref Powder p, ref Neighbors n)
 {
     if (!n.LeftEmpty())
     {
         AcidTouch(n.Left());
     }
     if (!n.RightEmpty())
     {
         AcidTouch(n.Right());
     }
     if (!n.BottomEmpty())
     {
         AcidTouch(n.Bottom());
     }
 }
Exemple #22
0
        public override void LoadDataToComponets(CosmeticProduct currentProduct, Control.ControlCollection controls)
        {
            base.LoadDataToComponets(currentProduct, controls);
            Control[] controlList   = GetComponentsForInput(controls);
            Powder    currentPowder = (Powder)currentProduct;

            ComboBox tempComboBox = (ComboBox)controlList[powderPackageTypeIndex];

            tempComboBox.SelectedValue = Enum.GetName(typeof(Powder.TypeOfPackage), currentPowder.Package);


            CheckBox temp = (CheckBox)controlList[talcIndex];

            temp.Checked = currentPowder.isContainTalc;
        }
Exemple #23
0
        private static void DecoratorDosa()
        {
            IDosa plainDosa = new PlainDosa();
            //Console.WriteLine("Description : {0} - Price {1}", plainDosa.GetDescription(), plainDosa.GetPrice());

            Ghee ghee = new Ghee(plainDosa);

            Onion onion = new Onion(ghee);

            Console.WriteLine("Description : {0} - Total Price : Rs. {1}", onion.GetDescription(), onion.GetPrice());

            Powder powder = new Powder(onion);

            Console.WriteLine("Description : {0} - Total Price : Rs. {1}", powder.GetDescription(), powder.GetPrice());
        }
Exemple #24
0
    Powder Simulate(Powder p, int index)
    {
        if (p.life == 0 || p.coord.x < 0 || p.coord.x > PowderGame.width || p.coord.y < 0 || p.coord.y > PowderGame.height)
        {
            PowderSystemUtils.SchdeduleRemovePowder(ref toDeleteEntities, index);
            return(p);
        }

        if (p.life != -1)
        {
            p.life--;
        }

        var n = new Neighbors(ref hashMap, p, index);

        SimulateState(ref p, ref n);

        switch (p.type)
        {
        case PowderTypes.Acid:
            Acid(ref p, ref n);
            break;

        case PowderTypes.Fire:
            Fire(ref p, ref n);
            break;

        case PowderTypes.Steam:
            Steam(ref p, ref n);
            break;

        case PowderTypes.Water:
            Water(ref p, ref n);
            break;

        case PowderTypes.Lava:
            Lava(ref p, ref n);
            break;

        default:
            if (PowderTypes.values[p.type].IsGenerator())
            {
                Generate(ref p, ref n);
            }
            break;
        }
        return(p);
    }
Exemple #25
0
 // Fylder beholderen op med det pulver den har fået i sin parameter
 public string Fill(Powder powder)
 {
     if (HasFilter() && !HasPowder())
     {
         this.powder = powder;
         return("Powder is filled");
     }
     else if (!HasFilter())
     {
         return("The machine has no Filter");
     }
     else
     {
         return("The Machine is not Empty");
     }
 }
Exemple #26
0
        public Powder ConvertPowderToDTO(BllPowder bllPowder)
        {
            Powder dTOPowder = new Powder()
            {
                Id                    = bllPowder.Id,
                Name                  = bllPowder.Name,
                Brand                 = bllPowder.Brand,
                Price                 = bllPowder.Price,
                Volume                = bllPowder.Volume,
                QuantityBottles       = bllPowder.QuantityBottles,
                QuantityGeneralVolume = bllPowder.QuantityGeneralVolume,
                Color                 = bllPowder.Color,
                QuntityCount          = bllPowder.QuntityCount
            };

            return(dTOPowder);
        }
Exemple #27
0
        public BllPowder ConvertPowderToBll(Powder dTOPowder)
        {
            BllPowder bllPowder = new BllPowder()
            {
                Id                    = dTOPowder.Id,
                Name                  = dTOPowder.Name,
                Brand                 = dTOPowder.Brand,
                Price                 = dTOPowder.Price,
                Volume                = dTOPowder.Volume,
                QuantityBottles       = dTOPowder.QuantityBottles,
                QuantityGeneralVolume = dTOPowder.QuantityGeneralVolume,
                Color                 = dTOPowder.Color,
                QuntityCount          = dTOPowder.QuntityCount
            };

            return(bllPowder);
        }
Exemple #28
0
        public void doPowder(Color[] colors, Powder powder, VectorInt3 min, VectorInt3 max)
        {
            VectorInt3 mi = min + this._offset;

            //VectorInt3 mx = max + this._offset;
            foreach (VoxelFace.Rect r in powder.rect)
            {
                for (int x = r.min.x; x < r.max.x; ++x)
                {
                    for (int y = r.min.y; y < r.max.y; ++y)
                    {
                        for (int z = r.min.z; z < r.max.z; ++z)
                        {
                            VoxelHandler handler = _mesh.getVoxel(new VectorInt3(x, y, z) + mi);
//							Debug.Log ("x" + x + "y" +y +"z" + z);
                            if (handler != null)
                            {
                                foreach (VectorInt4 vertice in handler.vertices)
                                {
                                    colors[vertice.x] = r.color;
                                    colors[vertice.y] = r.color;
                                    colors[vertice.z] = r.color;
                                    colors[vertice.w] = r.color;
                                }
                            }
                        }
                    }
                }
            }

            foreach (VoxelFace.Point p in powder.point)
            {
                VoxelHandler handler = _mesh.getVoxel(p.position + mi);
                if (handler != null)
                {
                    foreach (VectorInt4 vertice in handler.vertices)
                    {
                        colors[vertice.x] = p.color;
                        colors[vertice.y] = p.color;
                        colors[vertice.z] = p.color;
                        colors[vertice.w] = p.color;
                    }
                }
            }
        }
Exemple #29
0
    void Generate(ref Powder p, ref Neighbors n)
    {
        var generatedType = PowderTypes.values[p.type].generatedElementType;

        if (PowderTypes.values[generatedType].state == PowderState.Liquid || PowderTypes.values[generatedType].state == PowderState.Powder)
        {
            if (n.TopEmpty())
            {
                var generatedPowder = PowderTypes.values[generatedType].creator(new Vector2Int(p.coord.x, p.coord.y - 1));
                PowderGame.Spawn(ref cmdBuffer, generatedPowder);
            }
        }
        else if (n.BottomEmpty())
        {
            var generatedPowder = PowderTypes.values[generatedType].creator(new Vector2Int(p.coord.x, p.coord.y + 1));
            PowderGame.Spawn(ref cmdBuffer, generatedPowder);
        }
    }
Exemple #30
0
    public RocketLayout(Powder powder, Charge charge, params RocketComponent[] components)
    {
        this.powder = powder;
        this.charge = charge;

        for (int i = 0; i < components.Length; i++)
        {
            RocketComponent comp = components[i];

            if (typeof(Powder) == comp.GetType())
            {
                this.powder = (Powder)comp;
            }
            else
            {
                this.charge = (Charge)comp;
            }
        }
    }
Exemple #31
0
	public void assemble(Bullet b, Powder p, Shell s)
	{
		bullet = b;
		powder = p;
		shell = s;
	}
Exemple #32
0
 public void doPowder(Powder powder, VectorInt3 min, VectorInt3 max)
 {
     Color[] colors = this.beginEmotions();
     doPowder (colors, powder, min, max);
     this.endEmotions (colors);
 }
Exemple #33
0
        public void doPowder(Color[] colors, Powder powder, VectorInt3 min, VectorInt3 max)
        {
            VectorInt3 mi = min + this._offset;
            //VectorInt3 mx = max + this._offset;
            foreach (VoxelFace.Rect r in powder.rect) {

                for (int x = r.min.x; x<r.max.x; ++x) {
                    for(int y = r.min.y; y< r.max.y; ++y){
                        for(int z = r.min.z;z<r.max.z; ++z ){
                            VoxelHandler handler = _mesh.getVoxel(new VectorInt3(x, y, z) + mi);
            //							Debug.Log ("x" + x + "y" +y +"z" + z);
                            if(handler != null){
                                foreach(VectorInt4 vertice in handler.vertices){

                                    colors[vertice.x] = r.color;
                                    colors[vertice.y] = r.color;
                                    colors[vertice.z] = r.color;
                                    colors[vertice.w] = r.color;
                                }
                            }
                        }
                    }
                }
            }

            foreach (VoxelFace.Point p in powder.point) {

                VoxelHandler handler = _mesh.getVoxel(p.position + mi);
                if(handler != null){
                    foreach(VectorInt4 vertice in handler.vertices){

                        colors[vertice.x] = p.color;
                        colors[vertice.y] = p.color;
                        colors[vertice.z] = p.color;
                        colors[vertice.w] = p.color;
                    }
                }

            }
        }