示例#1
0
        //H
        public IActionResult ProcessEditShoes()
        {
            if (!IsAdmin())
            {
                return(View(index));
            }
            bool   check       = true;
            int    shoesID     = int.Parse(Request.Form["txtShoesID"]);
            string name        = Request.Form["txtName"];
            int    categoryID  = int.Parse(Request.Form["slCategory"]);
            int    brandID     = int.Parse(Request.Form["slBrand"]);
            string material    = Request.Form["txtMaterial"];
            string description = Request.Form["txtDescription"];
            int    originID    = int.Parse(Request.Form["slOrigin"]);

            string[] colors     = Request.Form["txtColor"];
            string[] prices     = Request.Form["txtPrice"];
            string[] productIDs = Request.Form["txtProductID"];
            string[] newColors  = Request.Form["txtNewColor"];
            string[] newPrices  = Request.Form["txtNewPrice"];
            if (check = new ShoesData().UpdateShoes(new ShoesDTO {
                ShoesId = shoesID, Name = name, CategoryId = categoryID, BrandId = brandID, Material = material, Description = description, OriginId = originID
            }))
            {
                List <ProductDTO> listProducts = new List <ProductDTO>();
                for (int i = 0; i < colors.Length; i++)
                {
                    listProducts.Add(new ProductDTO {
                        ProductId = int.Parse(productIDs[i]), ShoesId = shoesID, Color = colors[i], Price = double.Parse(prices[i])
                    });
                }
                if (check = new ProductData().UpdateListProducstById(listProducts))
                {
                    if (newColors != null || newPrices != null)
                    {
                        List <ProductDTO> newList = new List <ProductDTO>();
                        for (int i = 0; i < newColors.Length; i++)
                        {
                            newList.Add(new ProductDTO {
                                ShoesId = shoesID, Color = colors[i], Price = double.Parse(prices[i]), IsDeleted = false
                            });
                        }
                        check = new ProductData().InsertProducts(newList);
                    }
                }
            }
            if (check)
            {
                ViewBag.Announcement = "Edit shoes successfully!";
            }
            else
            {
                ViewBag.Announcement = "Edit shoes failed!";
            }
            ViewBag.ListShoes = new ShoesData().GetAllShoes();
            return(View("ShoesManager"));
        }
示例#2
0
        //H
        public IActionResult ProcessUpdateShoes()
        {
            if (!IsAdmin())
            {
                return(View(index));
            }
            bool   check       = true;
            int    shoesID     = int.Parse(Request.Form["txtShoesID"]);
            string name        = Request.Form["txtName"];
            int    categoryID  = int.Parse(Request.Form["slCategory"]);
            int    brandID     = int.Parse(Request.Form["slBrand"]);
            string material    = Request.Form["txtMaterial"];
            string description = Request.Form["txtDescription"];
            int    originID    = int.Parse(Request.Form["slOrigin"]);

            string[] colors    = Request.Form["txtColor"];
            string[] prices    = Request.Form["txtPrice"];
            string[] newColors = Request.Form["txtNewColor"];
            string[] newPrices = Request.Form["txtNewPrice"];
            if (check = new ShoesData().UpdateShoes(new ShoesDTO {
                ShoesId = shoesID, Name = name, CategoryId = categoryID, BrandId = brandID, Material = material, Description = description, OriginId = originID
            }))
            {
                List <ProductDTO> listProducts = new List <ProductDTO>();
                for (int i = 0; i < colors.Length; i++)
                {
                    listProducts.Add(new ProductDTO {
                        ShoesId = shoesID, Color = colors[i], Price = double.Parse(prices[i]), IsDeleted = false
                    });
                }
            }
            if (check)
            {
                ViewBag.Successful = "Update successfully";
            }
            else
            {
                ViewBag.Failed = "Update failed";
            }
            return(View("ShoesManager"));
        }
示例#3
0
        public IActionResult ProcessAddNewShoes()
        {
            if (!IsAdmin())
            {
                return(View(index));
            }
            string name        = Request.Form["txtName"];
            int    categoryID  = int.Parse(Request.Form["slCategory"]);
            int    brandID     = int.Parse(Request.Form["slBrand"]);
            string material    = Request.Form["txtMaterial"];
            string description = Request.Form["txtDescription"];
            int    originID    = int.Parse(Request.Form["slOrigin"]);

            string[] colors = Request.Form["txtColor"];
            string[] prices = Request.Form["txtPrice"];
            if (new ShoesData().InsertShoes(new ShoesDTO {
                Name = name, CategoryId = categoryID, BrandId = brandID, Material = material, Description = description, OriginId = originID
            }))
            {
                int shoesID = new ShoesData().GetNewestShoesId();
                List <ProductDTO> listProducts = new List <ProductDTO>();
                for (int i = 0; i < colors.Length; i++)
                {
                    listProducts.Add(new ProductDTO {
                        ShoesId = shoesID, Color = colors[i], Price = double.Parse(prices[i]), IsDeleted = false
                    });
                }
                if (new ProductData().InsertProducts(listProducts))
                {
                    ViewBag.Anouncement = "Add new product successfully!";
                }
            }
            else
            {
                ViewBag.Anouncement = "Add new product failed!";
            }
            ViewBag.ListShoes = new ShoesData().GetAllShoes();
            return(View("ShoesManager"));
        }
示例#4
0
    private void loadCharacterCustomization()
    {
        charCustomData = JsonMapper.ToObject(File.ReadAllText(Application.dataPath + "/StreamingAssets/PlayerCustomization.json"));

        BodyPartsSprite bps = GameManager.instance.playerMovement.bodyPartsSprite;

        BodyTypeData bodyType = CharCustomManager.instance.GetBodyTypeDataById(charCustomData["bodyTypeId"].ToString());
        EyebrowsData eyebrows = CharCustomManager.instance.GetEyebrowsDataById(charCustomData["eyebrowsId"].ToString());
        EyesData     eyes     = CharCustomManager.instance.GetEyesDataById(charCustomData["eyesId"].ToString());
        HairData     hair     = CharCustomManager.instance.GetHairDataById(charCustomData["hairId"].ToString());
        MouthData    mouth    = CharCustomManager.instance.GetMouthDataById(charCustomData["mouthId"].ToString());
        PantsData    pants    = CharCustomManager.instance.GetPantsDataById(charCustomData["pantsId"].ToString());
        ShirtData    shirt    = CharCustomManager.instance.GetShirtDataById(charCustomData["shirtId"].ToString());
        ShoesData    shoes    = CharCustomManager.instance.GetShoesDataById(charCustomData["shoesId"].ToString());

        bps.southHead.sprite         = bodyType.frontHead;
        bps.southHair.sprite         = hair.frontHair;
        bps.southLeftEye.sprite      = eyes.frontEye;
        bps.southRightEye.sprite     = eyes.frontEye;
        bps.southLeftEyebrow.sprite  = eyebrows.eyebrow;
        bps.southRightEyebrow.sprite = eyebrows.eyebrow;
        bps.southMouth.sprite        = mouth.frontMouth;
        bps.southLeftLeg.sprite      = bodyType.leg;
        bps.southLeftPants.sprite    = pants.pants;
        bps.southLeftShoes.sprite    = shoes.frontShoes;
        bps.southRightLeg.sprite     = bodyType.leg;
        bps.southRightPants.sprite   = pants.pants;
        bps.southRightShoes.sprite   = shoes.frontShoes;
        bps.southChest.sprite        = bodyType.frontChest;
        bps.southShirt.sprite        = shirt.frontShirt;
        bps.southLeftArm.sprite      = bodyType.arm;
        bps.southLeftSleeve.sprite   = shirt.frontSleeve;
        bps.southRightArm.sprite     = bodyType.arm;
        bps.southRightSleeve.sprite  = shirt.frontSleeve;

        bps.northHead.sprite        = bodyType.frontHead;
        bps.northHair.sprite        = hair.backHair;
        bps.northLeftLeg.sprite     = bodyType.leg;
        bps.northLeftPants.sprite   = pants.pants;
        bps.northLeftShoes.sprite   = shoes.backShoes;
        bps.northRightLeg.sprite    = bodyType.leg;
        bps.northRightPants.sprite  = pants.pants;
        bps.northRightShoes.sprite  = shoes.backShoes;
        bps.northChest.sprite       = bodyType.frontChest;
        bps.northShirt.sprite       = shirt.backShirt;
        bps.northLeftArm.sprite     = bodyType.arm;
        bps.northLeftSleeve.sprite  = shirt.frontSleeve;
        bps.northRightArm.sprite    = bodyType.arm;
        bps.northRightSleeve.sprite = shirt.frontSleeve;

        bps.eastHead.sprite        = bodyType.sideHead;
        bps.eastHair.sprite        = hair.sideHair;
        bps.eastEye.sprite         = eyes.sideEye;
        bps.eastEyebrow.sprite     = eyebrows.eyebrow;
        bps.eastMouth.sprite       = mouth.sideMouth;
        bps.eastLeftLeg.sprite     = bodyType.leg;
        bps.eastLeftPants.sprite   = pants.pants;
        bps.eastLeftShoes.sprite   = shoes.sideShoes;
        bps.eastRightLeg.sprite    = bodyType.leg;
        bps.eastRightPants.sprite  = pants.pants;
        bps.eastRightShoes.sprite  = shoes.sideShoes;
        bps.eastChest.sprite       = bodyType.sideChest;
        bps.eastShirt.sprite       = shirt.sideShirt;
        bps.eastLeftArm.sprite     = bodyType.arm;
        bps.eastLeftSleeve.sprite  = shirt.sideSleeve;
        bps.eastRightArm.sprite    = bodyType.arm;
        bps.eastRightSleeve.sprite = shirt.sideSleeve;

        bps.westHead.sprite        = bodyType.sideHead;
        bps.westHair.sprite        = hair.sideHair;
        bps.westEye.sprite         = eyes.sideEye;
        bps.westEyebrow.sprite     = eyebrows.eyebrow;
        bps.westMouth.sprite       = mouth.sideMouth;
        bps.westLeftLeg.sprite     = bodyType.leg;
        bps.westLeftPants.sprite   = pants.pants;
        bps.westLeftShoes.sprite   = shoes.sideShoes;
        bps.westRightLeg.sprite    = bodyType.leg;
        bps.westRightPants.sprite  = pants.pants;
        bps.westRightShoes.sprite  = shoes.sideShoes;
        bps.westChest.sprite       = bodyType.sideChest;
        bps.westShirt.sprite       = shirt.sideShirt;
        bps.westLeftArm.sprite     = bodyType.arm;
        bps.westLeftSleeve.sprite  = shirt.sideSleeve;
        bps.westRightArm.sprite    = bodyType.arm;
        bps.westRightSleeve.sprite = shirt.sideSleeve;
    }