Exemplo n.º 1
0
        public void TestInsertProduct()
        {
            //Arrange
            DataProduct    dataProduct = new DataProduct();
            ServiceProduct product     = new ServiceProduct();

            product.Name          = "Grafikkort";
            product.Price         = 1998;
            product.Description   = "For at få den bedste spiloplevelse er det vigtigt med et godt grafikkort";
            product.AmountOnStock = 20;
            bool check = false;

            //Act
            try
            {
                dataProduct.InsertProduct(product);
                check = true;
            }
            catch
            {
                check = false;
            }

            //Assert
            Assert.IsTrue(check);
        }
Exemplo n.º 2
0
    public void UpdateUI()
    {
        _data_Building = DataManager.instance.dataBuildingGroup.GetBuilding(_model_Building.id, _model_Building.level);

        //当前等级
        _currentLevel.text = "" + _model_Building.level;
        // 当前建筑名称
        _buildingName_left_Label.text = _data_Building.name;
        _descriptionInfo_Label.text   = _data_Building.description;

        DataProduct dataProduct = new DataProduct();

        if (_model_Building.buildingType == Model_Building.Building_Type.FoodFactory)
        {
            dataProduct = DataManager.instance.dataProductFoodGroup.GetProduct(_model_Building.level);
            ShowSpeedNum(dataProduct);
        }
        else if (_model_Building.buildingType == Model_Building.Building_Type.OilFactory)
        {
            dataProduct = DataManager.instance.dataProductOilGroup.GetProduct(_model_Building.level);
            ShowSpeedNum(dataProduct);
        }
        else if (_model_Building.buildingType == Model_Building.Building_Type.MetalFactory)
        {
            dataProduct = DataManager.instance.dataProductMetalGroup.GetProduct(_model_Building.level);
            ShowSpeedNum(dataProduct);
        }
        else if (_model_Building.buildingType == Model_Building.Building_Type.RareFactory)
        {
            dataProduct = DataManager.instance.dataProductRareGroup.GetProduct(_model_Building.level);
            ShowSpeedNum(dataProduct);
        }
    }
        public Product GetProduct(int id)
        {
            // går til database lag
            DataProduct dp = new DataProduct();

            return(dp.GetProduct(id));
        }
Exemplo n.º 4
0
        public DataProduct GetProduct(int id)
        {
            using (var httpClient = new HttpClient())
            {
                ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
                var url            = ConfigurationManager.AppSettings["baseApiUrl"] + "people/" + id;
                var httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
                httpWebRequest.Method = "GET";
                httpWebRequest.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
                var content = string.Empty;

                using (var response = (HttpWebResponse)httpWebRequest.GetResponse())
                {
                    using (var stream = response.GetResponseStream())
                    {
                        using (var sr = new StreamReader(stream))
                        {
                            content = sr.ReadToEnd();
                        }
                    }
                }
                JObject json = JObject.Parse(content);

                DataProduct data = new DataProduct();
                data.Id   = id;
                data.Name = json["name"].ToString();

                return(data);
            }
        }
Exemplo n.º 5
0
        public ActionResult AlleProducten(int productid)
        {
            Product p = DataProduct.GetProductById(productid);

            if (p != null)
            {
                return(RedirectToAction("EditSale", p));
            }
            return(View());
        }
Exemplo n.º 6
0
        public void TestGetAllProducts()
        {
            //Arrange
            DataProduct dataProduct = new DataProduct();

            //Act
            List <ServiceProduct> products = (List <ServiceProduct>)dataProduct.GetAllProducts();

            //Assert
            Assert.IsTrue(products.Count >= 1, "Number of products in list: " + products.Count);
        }
Exemplo n.º 7
0
 public ActionResult EditDateSale(Datum datum)
 {
     if (DataProduct.SetDate(datum.Date))
     {
         return(RedirectToAction("SpecialeActie"));
     }
     else
     {
         return(View("SpecialeActie"));
     }
 }
Exemplo n.º 8
0
        public ActionResult EditDateSale()
        {
            if (Login.loggedinUser.Admin == "niet")
            {
                return(RedirectToAction("SpecialeActie"));
            }
            string date  = DataProduct.GetDate();
            Datum  datum = new Datum(date);

            return(View("EditDateSale", datum));
        }
Exemplo n.º 9
0
        public void TestDeleteProduct()
        {
            //Arrange
            DataProduct dataProduct = new DataProduct();
            int         rowsAffected;

            //Act
            rowsAffected = dataProduct.DeleteProduct(8);

            //Assert
            Assert.IsTrue(rowsAffected >= 1, "Rows affected " + rowsAffected);
        }
Exemplo n.º 10
0
 public void ShowSpeedNum(DataProduct dataProduct)
 {
     if (dataProduct != null)
     {
         _propertyInfo_1_Label.gameObject.SetActive(true);
         _propertyValue_1_Label.gameObject.SetActive(true);
         _propertyInfo_2_Label.gameObject.SetActive(true);
         _propertyValue_2_Label.gameObject.SetActive(true);
         _propertyValue_1_Label.text = dataProduct.produceSpeed * 3600 + "";
         _propertyValue_2_Label.text = dataProduct.capacity + "";
     }
 }
Exemplo n.º 11
0
 public ActionResult EditSale(double Korting, int productid)
 {
     if (DataProduct.EditSale(productid, Korting))
     {
         return(RedirectToAction("AlleProducten"));
     }
     else
     {
         ViewBag.Message = "Er is iets mis gegaan, probeer het opnieuw.";
         return(View("AlleProducten"));
     }
 }
Exemplo n.º 12
0
 public ActionResult Winkelwagen(int productid)
 {
     if (Login.loggedinUser == null)
     {
         return(RedirectToAction("LogIn", "Home"));
     }
     else
     {
         Product p = DataProduct.GetProductById(productid);
         Login.loggedinUser.winkelwagenlist.Add(p);
         return(View(Login.loggedinUser.winkelwagenlist));
     }
 }
Exemplo n.º 13
0
        public ActionResult Bestellen()
        {
            if (Login.loggedinUser.winkelwagenlist == null)
            {
                return(RedirectToAction("Winkelwagen"));
            }
            else
            {
                Bestelling     b;
                int            productcount = 0;
                bool           countis3     = false;
                List <Product> plist        = DataProduct.SpecialeActie(DataProduct.GetDate());
                foreach (Product p in plist)
                {
                    for (int i = 0; i < Login.loggedinUser.winkelwagenlist.Count; i++)
                    {
                        if (p.ProductID == Login.loggedinUser.winkelwagenlist[i].ProductID)
                        {
                            productcount += 1;
                            if (productcount == 3)
                            {
                                countis3 = true;
                            }
                        }
                        else
                        {
                            countis3 = false;
                        }
                    }
                }

                if (countis3)
                {
                    b = new Bestelling(DataBestelling.GetLatestBestelnummer() + 1, Login.loggedinUser.KlantID, 10, 10, "1", DateTime.Now);
                }
                else
                {
                    b = new Bestelling(DataBestelling.GetLatestBestelnummer() + 1, Login.loggedinUser.KlantID, 10, 0, "1", DateTime.Now);
                }

                if (DataBestelling.SetBestellingWithProcedure(Login.loggedinUser.winkelwagenlist, b))
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    return(RedirectToAction("Winkelwagen"));
                }
            }
        }
Exemplo n.º 14
0
        public ActionResult Verwijder(int productid)
        {
            Product p = DataProduct.GetProductById(productid);

            foreach (Product product in Login.loggedinUser.winkelwagenlist)
            {
                if (p.ProductID == product.ProductID)
                {
                    Login.loggedinUser.winkelwagenlist.Remove(product);
                    return(View("Winkelwagen", Login.loggedinUser.winkelwagenlist));
                }
            }
            return(View("Winkelwagen", Login.loggedinUser.winkelwagenlist));
        }
Exemplo n.º 15
0
    private void Galery_Zoom(int Product_ID)
    {
        DataTable dt = db.QP("exec Product_Details @P0", Product_ID).Tables[0];

        if (dt.Rows.Count > 0)
        {
            productZoom.Src = (string)dt.Rows[0]["İmage"].ToString().Replace("~/", "");                                  //Ana Slide 512px
            productZoom.Alt = (string)dt.Rows[0]["Title"];
            productZoom.Attributes.Add("data-zoom-image", (string)dt.Rows[0]["İmageZoom"].ToString().Replace("~/", "")); // Zoom İmage 1024

            DataProduct.DataSource = dt;
            DataProduct.DataBind();
        }
    }
Exemplo n.º 16
0
        public void TestUpdateProdut()
        {
            //Arrange
            DataProduct    dataProduct = new DataProduct();
            ServiceProduct product     = dataProduct.GetProductById(6);
            int            rowsAffected;

            //Act
            product.Name = "SSD harddisk";
            rowsAffected = dataProduct.UpdateProduct(product);

            //Assert
            Assert.IsTrue(rowsAffected >= 1, "Rows affected " + rowsAffected + product.Name);
        }
Exemplo n.º 17
0
    public void BindDummyItem()
    {
        DataTable dtGetData = new DataTable();

        dtGetData.Columns.Add("Title");
        //  dtGetData.Columns.Add("Description");
        dtGetData.Columns.Add("Product_ID");
        dtGetData.Columns.Add("İmage");
        dtGetData.Columns.Add("İmageSmall");
        dtGetData.Columns.Add("İmageZoom");
        dtGetData.Rows.Add();

        DataProduct.DataSource = dtGetData;
        DataProduct.DataBind();
    }
Exemplo n.º 18
0
 public static void EliminarProducto(int Id)
 {
     if (Id.Equals(0))
     {
         //No se selecciono ningun producto
         MessageBox.Show("Seleccione un producto", "Atención");
     }
     else
     {
         if (MessageBox.Show("¿Está seguro que desea eliminar el producto?", "Eliminar Producto", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             DataProduct.Eliminar(Id);
         }
     }
 }
Exemplo n.º 19
0
    public void Load(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        _products = new Dictionary <int, DataProduct>();

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataProduct data = new DataProduct();
            data.Load(subNode);

            _products.Add(data.level, data);
        }
    }
Exemplo n.º 20
0
        public void TestGetAmountOnProduct()
        {
            //Arrange
            DataProduct    dataProduct = new DataProduct();
            ServiceProduct product     = new ServiceProduct();

            product.Name          = "Harddisk";
            product.Price         = 1234;
            product.Description   = "For at få den bedste spiloplevelse er det vigtigt med en god og hurtig harddisk";
            product.AmountOnStock = 30;

            //Act
            int insertedId         = dataProduct.InsertProduct(product);
            var getInsertedProduct = dataProduct.GetProductById(insertedId);

            //Assert
            Assert.AreEqual(product.AmountOnStock, getInsertedProduct.AmountOnStock);
        }
Exemplo n.º 21
0
        public void InsertOrderTest()
        {
            //Arrange
            DataProduct       dataProduct       = new DataProduct();
            DataCustomerOrder dataCustomerOrder = new DataCustomerOrder();

            ServiceCustomer customer = new ServiceCustomer();

            customer.Name    = "Peter J.";
            customer.Address = "Sofiendalsvej";
            customer.ZipCode = 9000;
            customer.PhoneNo = "12345678";

            ServiceProduct product = new ServiceProduct();

            product = dataProduct.GetProductById(4);

            ServiceProductLine productLine = new ServiceProductLine();

            productLine.Amount   = 1;
            productLine.SubTotal = product.Price;
            productLine.Product  = product;

            ServiceCustomerOrder order = new ServiceCustomerOrder();

            order.FinalPrice    = productLine.SubTotal;
            order.Status        = "Active";
            order.DateOrder     = DateTime.Now;
            order.PaymentMethod = 1;
            order.DiscountCode  = null;
            List <ServiceProductLine> productLines = new List <ServiceProductLine>();

            productLines.Add(productLine);
            order.ShoppingCart = productLines;

            //Act
            bool success = dataCustomerOrder.FinishCheckout(order);


            //Assert
            Assert.IsTrue(success);
        }
Exemplo n.º 22
0
 public static void GuardarProducto(Producto producto)
 {
     if ((producto.Id).Equals(0))
     {
         if (!CamposVacios(producto)) //Si no esta vacio, almacenar el producto
         {
             DataProduct.GuardarNuevo(producto);
             MessageBox.Show("El producto: " + producto.Nombre + " ha sido agregado con exito", "Producto Agregado con Exito");
         }
         else
         {
             MessageBox.Show("Debe completar todos los campos!", "Atención");
         }
     }
     else
     {
         DataProduct.Modificar(producto);
         MessageBox.Show("El producto ha sido modificado con exito", "Producto Modificado con Exito");
     }
 }
Exemplo n.º 23
0
    public void ShowSpeedNum(DataProduct dataProduct, DataProduct nextDataProduct)
    {
        _propertyInfo_1_Label.gameObject.SetActive(true);
        _propertyValue_1_Label.gameObject.SetActive(true);
        _propertyInfo_2_Label.gameObject.SetActive(true);
        _propertyValue_2_Label.gameObject.SetActive(true);

        if (dataProduct != null && nextDataProduct != null)
        {
            int addSpeed   = (int)(nextDataProduct.produceSpeed * 3600) - (int)(dataProduct.produceSpeed * 3600);
            int addCapaity = (int)nextDataProduct.capacity - (int)dataProduct.capacity;
            _propertyValue_1_Label.text = dataProduct.produceSpeed * 3600 + "[00FF00]" + " + " + addSpeed + "[-]";
            _propertyValue_2_Label.text = dataProduct.capacity + "[00FF00]" + " + " + addCapaity + "[-]";
        }

        if (nextDataProduct == null)
        {
            _propertyValue_1_Label.text = dataProduct.produceSpeed * 3600 + "";
            _propertyValue_2_Label.text = dataProduct.capacity + "";
        }
    }
Exemplo n.º 24
0
    public void Parse(Production production, int buildingLevel)
    {
        resourceType = production.resourceType;
        _num         = (float)production.num;

        DataProduct dataProduct = new DataProduct();

        switch ((Production_Type)resourceType)
        {
        case Production_Type.Food:
            dataProduct = DataManager.instance.dataProductFoodGroup.GetProduct(buildingLevel);
            break;

        case Production_Type.Metal:
            dataProduct = DataManager.instance.dataProductMetalGroup.GetProduct(buildingLevel);
            break;

        case Production_Type.Oil:
            dataProduct = DataManager.instance.dataProductOilGroup.GetProduct(buildingLevel);
            break;

        case Production_Type.Rare:
            dataProduct = DataManager.instance.dataProductRareGroup.GetProduct(buildingLevel);
            break;

        case Production_Type.Cash:
            dataProduct = DataManager.instance.dataProductCashGroup.GetProduct(buildingLevel);
            break;
        }

        if (dataProduct != null)
        {
            produceSpeed = dataProduct.produceSpeed;
            capacity     = dataProduct.capacity;
        }

        nextProductionTimeStamp = TimeHelper.GetCurrentRealTimestamp();

        ResumeTimer();
    }
Exemplo n.º 25
0
    public void InitProductUI()
    {
        DataProduct dataProduct     = new DataProduct();
        DataProduct nextDataProduct = new DataProduct();

        if (_model_Building.buildingType == Model_Building.Building_Type.FoodFactory)
        {
            dataProduct     = DataManager.instance.dataProductFoodGroup.GetProduct(_model_Building.level);
            nextDataProduct = DataManager.instance.dataProductFoodGroup.GetProduct(_model_Building.level + 1);
            ShowSpeedNum(dataProduct, nextDataProduct);
        }
        else if (_model_Building.buildingType == Model_Building.Building_Type.OilFactory)
        {
            dataProduct     = DataManager.instance.dataProductOilGroup.GetProduct(_model_Building.level);
            nextDataProduct = DataManager.instance.dataProductOilGroup.GetProduct(_model_Building.level + 1);
            ShowSpeedNum(dataProduct, nextDataProduct);
        }
        else if (_model_Building.buildingType == Model_Building.Building_Type.MetalFactory)
        {
            dataProduct     = DataManager.instance.dataProductMetalGroup.GetProduct(_model_Building.level);
            nextDataProduct = DataManager.instance.dataProductMetalGroup.GetProduct(_model_Building.level + 1);
            ShowSpeedNum(dataProduct, nextDataProduct);
        }
        else if (_model_Building.buildingType == Model_Building.Building_Type.RareFactory)
        {
            dataProduct     = DataManager.instance.dataProductRareGroup.GetProduct(_model_Building.level);
            nextDataProduct = DataManager.instance.dataProductRareGroup.GetProduct(_model_Building.level + 1);
            ShowSpeedNum(dataProduct, nextDataProduct);
        }

        int budingIdCount    = _data_Building.buildingID.Length;
        int budinglevelCount = _data_Building.buildingLevel.Length;

        if (budingIdCount != 2)
        {
            SetResPosition(2 - budingIdCount);
        }
    }
Exemplo n.º 26
0
 public ProductControl()
 {
     dataProduct = new DataProduct();
 }
        public bool UpdateProductVersion(int styleNumber, string sizeCode, string colorCode, int newStock)
        {
            DataProduct dp = new DataProduct();

            return(dp.UpdateProductVersion(styleNumber, sizeCode, colorCode, newStock));
        }
        public bool UpdateProduct(Product productToUpdate)
        {
            DataProduct dp = new DataProduct();

            return(dp.UpdateProduct(productToUpdate));
        }
Exemplo n.º 29
0
        public static List <Producto> ObtenerProducto()
        {
            List <Producto> lista = DataProduct.Obtener();

            return(lista);
        }
Exemplo n.º 30
0
 public void BindDummyItem(string Product_ID, string Variant)
 {
     DataProduct.DataSource = GetingDatas(Product_ID, Variant);
     DataProduct.DataBind();
 }