Inheritance: BaseClass
    protected void EsDataSource1_esCreateEntity(object sender, EntitySpaces.Web.esDataSourceCreateEntityEventArgs e)
    {
        ProductsQuery p = new ProductsQuery("p");
        CategoriesQuery c = new CategoriesQuery("c");

        p.Select(p, c.CategoryName);
        p.InnerJoin(c).On(p.CategoryID == c.CategoryID);

        if (e.PrimaryKeys != null)
        {
            p.Where(p.ProductID == (int)e.PrimaryKeys[0]);
        }
        else
        {
            // They want to add a new one, lets do a select that brings back
            // no records so that our CategoryName column (virutal) will be
            // present in the underlying record format
            p.Where(1 == 0);
        }

        Products prd = new Products();
        prd.Load(p);  // load the data (if any)

        // Assign the Entity
        e.Entity = prd;
    }
Exemplo n.º 2
0
    void PrintProductVSByCategory(Remix.Category category, StringBuilder sb)
    {
        Products products = new Products();
        int.TryParse(Request["page"], out products.CurrentPage);
        products.CurrentPage = products.CurrentPage == 0 ? 1 : products.CurrentPage;
        BestBuyCategoryProductsFiller.Do(products, category);

        sb.Append("<div>");
        sb.Append("<h2>Product VS Pair List - Total " + products.TotalPages + " Pages</h2>");

        sb.Append("<ul class='better-ranked'>");

        foreach (var product in products)
        {
            ProductPool.Cache(product, CacheType.Simple);

            sb.Append(@"
        <li>
        <a href='/P.aspx?upc=" + product.UPC + @"&title=" + HttpUtility.UrlEncode(HttpUtility.HtmlEncode(product.Name)) + @"' title='" + product.Name + (product.BBYSalePrice > 0 ? " $" + product.BBYSalePrice : "") + @"'>
        <img src='" + (string.IsNullOrEmpty(product.LargeImageUrl) ? product.ThumbnailImageUrl : product.LargeImageUrl) + @"' /><br />
        " + product.Name + @"
        " + (product.BBYSalePrice > 0 ? "<br /><span style='color:#000'>$" + product.BBYSalePrice + "</span>" : "") + @"
        </a>
        </li>
        ");
        }
        sb.Append("</ul>");
        sb.Append("<div class='clear' style='width:100%;'></div>");

        sb.Append("</div>");

        //page
        string baseUrl = "/Category.aspx?id=" + HttpUtility.UrlEncode(category.Id);
        HTMLGenerator.PrintPageNav(products.CurrentPage, products.TotalPages, baseUrl, sb);
    }
Exemplo n.º 3
0
        public static void PrintProductVSByCategory(string categoryId)
        {
            Products products = new Products();
            BestBuyCategoryProductsFiller.Do(products, new Remix.Category() { Id = categoryId });

            foreach (var product in products)
            {
                ProductPool.Cache(product, CacheType.Simple);
            }

            Dictionary<string, string> VSDic = new Dictionary<string, string>();
            foreach (var product in products)
            {
                foreach (var similarProduct in product.SimilarProducts)
                {
                    Product filledSimilarProduct = ProductPool.GetByBestBuySKU(similarProduct.BBYSKU, CacheType.Simple);
                    ProductPool.Cache(filledSimilarProduct, CacheType.Simple);

                    if (filledSimilarProduct.BBYCategoryPath != null
                        && filledSimilarProduct.BBYCategoryPath[filledSimilarProduct.BBYCategoryPath.Length - 1].Id
                        == product.BBYCategoryPath[product.BBYCategoryPath.Length - 1].Id)
                    {
                        VSDic[product.UPC] = filledSimilarProduct.UPC;
                    }
                }
            }

            foreach (var key in VSDic.Keys)
            {
                Product product1 = ProductPool.GetByUPC(key, CacheType.Simple);
                Product product2 = ProductPool.GetByUPC(VSDic[key], CacheType.Simple);
                Console.WriteLine("{0},{1} -|- {2},{3}", product1.UPC, product1.Name, product2.UPC, product2.Name);
            }
        }
Exemplo n.º 4
0
        protected override void BuildControl(System.Web.Mvc.TagBuilder builder, Products.CustomFieldDefinition field, string value, object htmlAttributes, System.Web.Mvc.ViewContext viewContext)
        {
            builder.AddCssClass("form-list");

            var itemsHtml = new StringBuilder();
            var i = 0;

            foreach (var item in field.SelectionItems)
            {
                itemsHtml.AppendLine("<li>");

                var radioId = field.Name + "_" + i;
                var radio = new TagBuilder("input");
                radio.MergeAttribute("id", radioId);
                radio.MergeAttribute("type", "radio");
                radio.MergeAttribute("name", field.Name);
                radio.MergeAttribute("value", item.Value);

                var label = new TagBuilder("label");
                label.InnerHtml = item.Text;
                label.AddCssClass("inline");
                label.MergeAttribute("for", radioId);

                itemsHtml.AppendLine(radio.ToString(TagRenderMode.SelfClosing));
                itemsHtml.AppendLine(label.ToString());

                itemsHtml.AppendLine("</li>");

                i++;
            }

            builder.InnerHtml = itemsHtml.ToString();

            base.BuildControl(builder, field, value, htmlAttributes, viewContext);
        }
        private static int chooseProducts(ref Products cupcakes, ref Products bisquit, ref Products wafers)
        {
            Console.WriteLine(' ');
            Console.WriteLine("Вы внесли {0} руб.", Machine.coinsSum);
            Console.WriteLine(' ');
            Console.WriteLine("Выберите товар:");
            Console.WriteLine("1) {0} по цене {1} руб. (Осталось {2} шт.)", cupcakes.name, cupcakes.price, cupcakes.count);
            Console.WriteLine("2) {0} по цене {1} руб. (Осталось {2} шт.)", bisquit.name, bisquit.price, bisquit.count);
            Console.WriteLine("3) {0} по цене {1} руб. (Осталось {2} шт.)", wafers.name, wafers.price, wafers.count);
            Console.WriteLine("4) Забрать продукты и сдачу");
            Console.WriteLine(' ');

            int chosenPoint;
            int.TryParse(Console.ReadLine(), out chosenPoint);
            while (chosenPoint <= 0 || chosenPoint > 4)
            {
                Console.WriteLine("Пожалуйста, выберите один из четырех пунктов меню:");
                int.TryParse(Console.ReadLine(), out chosenPoint);
            }

            int count;
            Console.WriteLine("Количество?");
            int.TryParse(Console.ReadLine(), out count);

            while (count == 0)
            {
                Console.WriteLine("Неверное количество товара");
                Console.WriteLine("Количество?");
                int.TryParse(Console.ReadLine(), out count);
            }

            switch (chosenPoint)
            {
                case 1:
                    cupcakes.chooseProduct(count);
                    break;
                case 2:
                    bisquit.chooseProduct(count);
                    break;
                case 3:
                    wafers.chooseProduct(count);
                    break;
                case 4:
                    Machine.returnChange();
                    Console.WriteLine(" ");
                    Console.WriteLine("Вы забрали:");
                    Console.WriteLine("{0} x {1} руб.", cupcakes.name, 4 - cupcakes.count);     //ur order
                    Console.WriteLine("{0} x {1} руб.", bisquit.name, 3 - bisquit.count);       //ur order
                    Console.WriteLine("{0} x {1} руб.", wafers.name, 10 - wafers.count);        //ur order
                    Environment.Exit(0);

                    break;
                default:
                    Console.WriteLine("Пожалуйста, выберите один из четырех пунктов меню:");
                    chooseProducts(ref cupcakes, ref bisquit, ref wafers);
                    break;
            }

            return 0;
        }
Exemplo n.º 6
0
 public ActionResult Details(string id)
 {
     var product = new Products().FirstOrDefault(x => x.ProductNumber == id);
     if (product == null)
         return View("Error");
     return View(product);
 }
Exemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Products products = new Products();
     products._clientid = new Guid(Session["id"].ToString());
     Repeater1.DataSource = products.RetrieveProductsBySeller();
     Repeater1.DataBind();
 }
        // PUT odata/Product(5)
        public async Task<IHttpActionResult> Put([FromODataUri] int key, Products products)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (key != products.ProductId)
            {
                return BadRequest();
            }

            db.Entry(products).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductsExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(products);
        }
Exemplo n.º 9
0
        public IHttpActionResult PutProducts(int id, Products products)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != products.Product_ID)
            {
                return BadRequest();
            }

            db.Entry(products).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductsExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Exemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     divSuccess.Visible = false;
     divError.Visible = false;
     Products products = new Products();
     //Validates if it has a name parameter to filter the products
     string name = Request.Params.Get("name");
     string type = Request.Params.Get("type");
     if (name != null && name != "")
     {
         products._name = name;
         Repeater1.DataSource = products.RetrieveProductsByName();
     }
     //Validates if it has a type parameter
     else if (type != null && type != "")
     {
         products._type = type;
         Repeater1.DataSource = products.RetrieveProductsByType();
     }
     else
     {
         Repeater1.DataSource = products.RetrieveAllProducts();
     }
     Repeater1.DataBind();
 }
Exemplo n.º 11
0
 /// <summary>
 /// Gets the list of products.
 /// </summary>
 /// <returns>
 /// Returns the list of products.
 /// </returns>
 public static Products GetProducts()
 {
     var products =
         new Products(
             new List<Product>()
                 {
                     new Product()
                         {
                             ProductId = 1,
                             Name = "ABC",
                             Description = "Product ABC",
                             Href = "/product/1",
                             Links =
                                 {
                                     new Link() { Rel = "collection", Href = "/products" },
                                     new Link() { Rel = "template", Href = "/product/{productId}" },
                                 }
                         },
                     new Product()
                         {
                             ProductId = 2,
                             Name = "XYZ",
                             Description = "Product XYZ",
                             Href = "/product/2",
                             Links =
                                 {
                                     new Link() { Rel = "collection", Href = "/products" },
                                     new Link() { Rel = "template", Href = "/product/{productId}" },
                                 }
                         },
                 });
     return products;
 }
Exemplo n.º 12
0
    protected void RptExport_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
        {
            Label lblName = (Label)e.Item.FindControl("lblName");
            Label lblPrice = (Label)e.Item.FindControl("lblPrice");
            //Label lblQuantity = (Label)e.Item.FindControl("lblQuantity");
            //Label lblProductTotal = (Label)e.Item.FindControl("lblProductTotal");

            int nQuantity = 1;
            int nProductID = ConvertData.ConvertToInt(DataBinder.Eval(e.Item.DataItem, "ProductID2"));

            Products objProduct = new Products();
            objProduct.LoadById(nProductID);

            string sNameProduct = ConvertData.ConvertToString(objProduct.Data.ProductName);
            int nPrice = ConvertData.ConvertToInt(objProduct.Data.Price);

            lblName.Text = sNameProduct;
            lblPrice.Text = ConvertData.ConvertToString(Support.FormatCurrency(nPrice)) + " " + "vn₫";

            //lblQuantity.Text = ConvertData.ConvertToString(nQuantity);

            int nTotal = nPrice * nQuantity;

            //lblProductTotal.Text = ConvertData.ConvertToString(Support.FormatCurrency(nTotal)) + " " + "vn₫";

            int nTotalOrder = nTotal;
            fSubTotal += ConvertData.ConvertToDouble(nTotal);
        }
        lblTotal.Text = ConvertData.ConvertToString(Support.FormatCurrency(fSubTotal)) + " " + "vn₫";
    }
Exemplo n.º 13
0
 public Upgrade(UpgradeType type, Products target, string name, BigInteger price)
 {
     this.Type = type;
     this.Target = target;
     this.Name = name;
     this.Price = price;
 }
Exemplo n.º 14
0
        public IHttpActionResult Put(ProductsModel model)
        {
            var product = manager.GetById(model.Id);

            var newProduct = new Products()
            {
                Comment = product.Comment,
                ProductTypeId = product.ProductTypeId,
                Price = product.Price,
                ProceedsAccountId = product.ProceedsAccountId,
                Number = String.Empty,
                ProductMaterialRsps = new List<ProductMaterialRsp>(),
                CreateDate = DateTime.Now,
                ChangeDate = DateTime.Now,
            };
            
            manager.AddEntity(newProduct);

            foreach(var material in product.ProductMaterialRsps.Where(o => !o.DeleteDate.HasValue).ToList())
            {
                var newPosition = new ProductMaterialRsp()
                {
                    Amount = material.Amount,
                    MaterialId = material.MaterialId,
                    Products = newProduct
                };

                //positionManager.AddEntity(newPosition);
                newProduct.ProductMaterialRsps.Add(newPosition);
            }

            manager.SaveChanges();

            return Ok(new { id = newProduct.Id });
        }
Exemplo n.º 15
0
 public ProductsPresenter(Products view)
 {
     productDAO = new productDAO();
     cached = new List<Product>();
     this.view = view;
     this.state = FormState.UPDATE_OLD;
 }
Exemplo n.º 16
0
    public void UpdateTable(Products ps, int id, string datar)
    {
        cn = new MySqlConnection("database=y;server=x;user id=b;password=a");
        string qry = "INSERT INTO SHOPPINGCART VALUES (@IDCUSTOMER, @IDPRODUCT, @ORDERDATE, @PICKUPDATE, @TOTAL, @PAYMETHOD, @NOTES)";

        foreach (Product p in ps)
        {
            MySqlCommand cmd = new MySqlCommand(qry, cn);
            cmd.Parameters.AddWithValue("@IDCUSTOMER",                         id);
            cmd.Parameters.AddWithValue("@IDPRODUCT",                 p.IdProduct);
            cmd.Parameters.AddWithValue("@ORDERDATE",                DateTime.Now);
            cmd.Parameters.AddWithValue("@PICKUPDATE",                      datar);
            cmd.Parameters.AddWithValue("@TOTAL",                         p.Price);
            cmd.Parameters.AddWithValue("@PAYMETHOD", "\"" + "not defined" + "\"");
            cmd.Parameters.AddWithValue("@NOTES",        "\"" + "no notes" + "\"");

            cn.Open();
            cmd.ExecuteNonQuery();
            cn.Close();
        }

        Session.Clear();
        Session.RemoveAll();

        Response.Redirect("index.aspx");
    }
Exemplo n.º 17
0
    /// <summary>
    /// Method which loads the gridview with all the Products.
    /// </summary>
    protected void loadGridView()
    {
        Products product = new Products();

        GridView1.DataSource = product.getAllProducts();
        GridView1.DataBind();
    }
Exemplo n.º 18
0
        public void Test_CK_einProduktZweiMal_InsPaket()
        {
            var sut = new Solution();

            var products = new Products { { "Apfel", 10 } };

            var success = false;

            var productPackages = new ProductPackages
            {
                new ProductPackage(){ Price = 15, Products = { "Apfel", "Apfel" }},

            };

            sut.Setup(products, productPackages);

            var price = 0;
            sut.SendPrice += p =>
            {
                price = p;
                Debug.WriteLine("{0},", price);
            };

            sut.Order("Apfel");
            price.Should().Be(10);
            sut.Order("Apfel");
            price.Should().Be(15);
        }
Exemplo n.º 19
0
        public NewVersionEventArgs(Products products)
        {
            products.Sort((obj, obj1) => (new Version(obj.ProductVersion) < new Version(obj1.ProductVersion)) ? +1 : -1);

            this.Products = products;
            this.NewVersion = products.FirstOrDefault();
        }
Exemplo n.º 20
0
    protected void rpNews_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string strCommand = e.CommandName;
        int nID = ConvertData.ConvertToInt(e.CommandArgument);
        Products objProduct = new Products();
        switch (strCommand)
        {
            case "Delete":
                objProduct.LoadById(nID);
                Support.DeleteFile("product", objProduct.Data.Images);
                Support.DeleteFolder("productimg",nID);
                int nDelete = objProduct.DeleteById(nID);
                BindDataToGrid(1);
                break;

            case "Edit":

                string sEdit = Constants.ROOT + Pages.BackEnds.ADMIN + "?" + Constants.PAGE + "=" + Pages.BackEnds.STR_PRODUCT_ADD + "&" + Constants.ACTION + "=" + Constants.ACTION_EDIT + "&" + Constants.ACTION_ID + "=" + nID;
                Response.Redirect(sEdit);
                break;
            case "Active":
                int nActive = objProduct.UpdateStatus(nID, EnumeType.INACTIVE);

                BindDataToGrid(1);
                break;

            case "Inactive":
                int nInactive = objProduct.UpdateStatus(nID, EnumeType.ACTIVE);

                BindDataToGrid(1);
                break;
        }
    }
Exemplo n.º 21
0
 public ActionResult AjaxRecommandOperation(FormCollection fm)
 {
     if (base.UserPrincipal.HasPermissionID(base.GetPermidByActID(base.Act_ApproveList)))
     {
         string str = fm["Type"];
         string str2 = fm["TargetType"];
         int productId = Globals.SafeInt(fm["TargetId"], 0);
         if (((productId > 0) && !string.IsNullOrEmpty(str)) && !string.IsNullOrEmpty(str2))
         {
             if (str2 == "product")
             {
                 Products products = new Products();
                 if (products.UpdateRecomend(productId, (str == "recommand") ? 1 : 0))
                 {
                     return base.Content("Yes");
                 }
             }
             else
             {
                 Photos photos = new Photos();
                 if (photos.UpdateRecomend(productId, (str == "recommand") ? 1 : 0))
                 {
                     return base.Content("Yes");
                 }
             }
         }
     }
     return base.Content("No");
 }
        public void CanPaginateProductsTest()
        {
            Products productsBeforePagination = new Products();
            Products productsAfterPagination =
                productsBeforePagination.Paginate<Product>() as Products;

            Assert.That(productsAfterPagination, Is.Not.Null);
        }
Exemplo n.º 23
0
 public IEnumerable<System.Web.Mvc.ModelClientValidationRule> GetClientValidationRules(Products.CustomFieldDefinition field, Products.FieldValidationRule rule)
 {
     if (!String.IsNullOrWhiteSpace(rule.ValidatorConfig))
     {
         var data = JsonConvert.DeserializeObject<RegexValidatorConfig>(rule.ValidatorConfig);
         yield return new ModelClientValidationRegexRule(rule.ErrorMessage, data.Pattern);
     }
 }
Exemplo n.º 24
0
 public Product(string id)
 {
     this.Id = id;
     Products product = new Products();
     product = ProductsDB.GetProducts(id);
     this.Name = product.Name;
     this.ImageFile = product.ImageFile;
     this.Price = Convert.ToDecimal(product.UnitPrice);
 }
        public void ShowProduct(Products.Model.Products.ProductEntity product)
        {
            string price = Activity.Resources.GetString (Resource.String.price);

            ProductTitle.Text = product.Name;
            ProductPrice.Text = $"{price}: {product.Price} Kč";
            ProductDescription.Text = product.Description;
            ProductLink.Text = product.Link?.ToString ();
        }
Exemplo n.º 26
0
 private void BindData()
 {
     int nProductCat=1;
     int nPageCount = 0;
     Products objProduct = new Products();
     DataTable dtb = objProduct.Search("", 0, 1000000000, nProductCat, 1, 1, 16,ref nPageCount);
     rptProducts.DataSource = dtb;
     rptProducts.DataBind();
 }
Exemplo n.º 27
0
 List<Product> remove(Products product, int number)
 {
     List<Product> l = new List<Product>();
     for(int i=0; i<number; i++)
     {
         l.Add(stock[product][i]);
         stock[product].Remove(l[i]);
     }
     return l;
 }
Exemplo n.º 28
0
 int count(Products product)
 {
     if (stock.ContainsKey(product))
     {
         return stock[product].Count;
     }
     else
     {
         return 0;
     }
 }
Exemplo n.º 29
0
    /// <summary>
    /// Assigns the selected Products to the selected Seller
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        int idSeller = 0;
        try
        {
            idSeller = Convert.ToInt16(DropDownList1.SelectedValue.ToString());
        }
        catch (Exception ex)
        {
            idSeller = 0;
        }

        string idProducts = Page.Request["Productos"];
        string Amounts = Page.Request["Cantidad"];
        string[] aidProducts;
        string[] aAmounts;

        try
        {
            aidProducts = idProducts.Split(new char[] { ',' });
        }
        catch(Exception ex)
        {
            aidProducts = new string[0];
        }

        try
        {
            aAmounts = Amounts.Split(new char[] { ',' });
        }
        catch(Exception ex)
        {
            aAmounts = new string[0];
        }

        if (idSeller == 0)
        {
            this.setNotification("error", "¡Ooooops!", "Selecciona un vendedor...");
        }
        else if (aidProducts.Length == 0)
        {
            this.setNotification("warning", "¡No hay productos seleccionados!", "Selecciona un producto como mínimo...");
        }
        else if (aidProducts.Length != aAmounts.Length)
        {
            this.setNotification("error", "¡Ooooops!", "No hay el mismo número de productos seleccionados que cantidades...");
        }
        else
        {
            Products products = new Products();
            products.assignProducts(idSeller, aidProducts, aAmounts);
            this.setNotification("success", "¡Éxito!", "Los productos han sido asignados");
        }
    }
Exemplo n.º 30
0
        public ActionResult Create(Products products)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(products);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(products);
        }
Exemplo n.º 31
0
 public void AddToProducts(Products products)
 {
     base.AddObject("Products", products);
 }
Exemplo n.º 32
0
        public ActionResult <Products> Create(Products product)
        {
            _productService.Create(product);

            return(CreatedAtRoute("GetProduct", new { id = product.Id.ToString() }, product));
        }
Exemplo n.º 33
0
        private void button4_Click(object sender, EventArgs e)
        {
            Products pr = new Products();

            pr.Show();
        }
Exemplo n.º 34
0
 public void AddProduct(Product product)
 {
     Products.Add(product);
     Total += product.Price;
 }
Exemplo n.º 35
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            Selected.RoomDisplay = false;

            Common.GetCommon().OpenPriceMonitor("0");

            // 刷新第二屏幕
            if (FullScreenMonitor.Instance._isInitialized)
            {
                FullScreenMonitor.Instance.RefreshSecondMonitorList(null);
            }

            // 语言默认, 或者上次选择
            if (Resources.GetRes().DefaultOrderLang == -1)
            {
                LanguageMode = Resources.GetRes().MainLang.LangIndex;
            }
            else
            {
                LanguageMode = Resources.GetRes().DefaultOrderLang;
            }

            // 刷新第二屏语言
            if (FullScreenMonitor.Instance._isInitialized)
            {
                FullScreenMonitor.Instance.RefreshSecondMonitorLanguage(Resources.GetRes().GetMainLangByLangIndex(LanguageMode).LangIndex, -1);
            }


            DisplayMode = 2;


            Selected.TotalPrice = 0;


            Selected.CurrentSelectedList.Clear();
            Selected.CurrentSelectedListNew.Clear();

            Products.ProductList.Clear();
            Products.ProductListNew.Clear();

            Selected.ResetPage();

            // 刷新产品
            Products.Init(-1);

            Selected.HasAddress = 1;


            RefreshState();

            if (!IsScanReady)
            {
                IsScanReady = true;
                // 扫条码
                Notification.Instance.NotificationBarcodeReader += Instance_NotificationBarcodeReader;

                // 扫码,刷卡

                // 扫条码处理
                hookBarcode = new KeyboardHook();

                var    availbleScanners = hookBarcode.GetKeyboardDevices();
                string first            = availbleScanners.Where(x => String.Format("{0:X}", x.GetHashCode()) == Resources.GetRes().BarcodeReader).FirstOrDefault();

                if (!string.IsNullOrWhiteSpace(first))
                {
                    hookBarcode.SetDeviceFilter(first);

                    hookBarcode.KeyPressed += OnBarcodeKey;

                    hookBarcode.AddHook(_element as Window);
                }


                hookCard = new KeyboardHook();
                first    = availbleScanners.Where(x => String.Format("{0:X}", x.GetHashCode()) == Resources.GetRes().CardReader).FirstOrDefault();

                if (!string.IsNullOrWhiteSpace(first))
                {
                    hookCard.SetDeviceFilter(first);

                    hookCard.KeyPressed += OnCardKey;

                    hookCard.AddHook(_element as Window);
                }
            }
        }
Exemplo n.º 36
0
 public virtual void AddProduct(Product product)
 {
     product.StoresStockedIn.Add(this);
     Products.Add(product);
 }
Exemplo n.º 37
0
 private void SetProductsByCategory(ProductCategory category)
 {
     ProductsPerCategory = new ObservableCollection <Product>(Products.Where(p => p.ProductCategoryId == category.Id));
 }
Exemplo n.º 38
0
 public Task <long> Save(Products products)
 {
     return(_productsRestRepository.Save(products, "http://xamBusinessApp.azure.com/products"));
 }
Exemplo n.º 39
0
 public Task SaveOrUpdate(Products products, long id)
 {
     return(_productsRestRepository.SaveOrUpdate(id, products, "http://xamBusinessApp.azure.com/products/update/"));
 }
Exemplo n.º 40
0
        public Product FindProduct(ObjectId id)
        {
            Product product = Products.Find(x => x.Id == id).FirstOrDefault();

            return(product);
        }
Exemplo n.º 41
0
 public void AddProduct(Products product)
 {
     _productsService.AddProduct(product);
 }
Exemplo n.º 42
0
 public void UpdateProduct(Products product, int id)
 {
     _productsService.UpdateProduct(product, id);
 }
        public async void LoadMoreData(string DisplayPageType)
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                try
                {
                    //isBusy = false;
                    IsLoading = true;
                    int pageno = 0;
                    //To show ActivityIndicator if the items are loaded in the view. 
                    if (products.Count > 0)
                    {
                        pageno = (products.Count / 5) + 1;
                        //await Task.Delay(3000);
                    }
                    else
                    {
                        pageno = 1;
                    }
                    //To ignore if items are being added till delayed time.
                    //if (isBusy)
                    /* if (!isBusy)
                         return;
                     */
                    if(DisplayPageType == "categorypage")
                    {
                        try
                        {
                            ObservableCollection<Product> productlist = await CategoryDataService.Instance.GetItems(category, pageno);
                            if (productlist.Count != 0)
                            {
                                foreach (var item in productlist)
                                {
                                    try
                                    {
                                        /*
                                        if (string.IsNullOrEmpty(item.productDesc))
                                        {
                                            item.productDesc = " ";
                                        }*/
                                        try
                                        {
                                            if (item.productDesc.ToLower() == "null")
                                            {
                                                item.productDesc = " ";
                                            }
                                        }
                                        catch { }
                                        var isProductAlreadyAdded = products.Any(s => s.CitrineProdId == item.CitrineProdId);
                                        if (!isProductAlreadyAdded)
                                        {
                                            if (item.Availability_Status.ToString().ToLower() == "no")
                                                item.AvailabilityStatusBool = false;
                                            else
                                                item.AvailabilityStatusBool = true;
                                            Products.Add(item);
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                        var temp = e.Message;
                                    }
                                }
                                await Task.Delay(2000);
                            }
                        }
                        catch
                        {

                        }

                    }
                    else if (DisplayPageType == "offerpage")
                    {
                        try
                        {
                            ObservableCollection<Product> productlist = await OfferDataService.Instance.GetOfferProducts(offerCode, pageno);
                            if (productlist.Count != 0)
                            {
                                foreach (var item in productlist)
                                {
                                    try
                                    {
                                        if (string.IsNullOrEmpty(item.productDesc))
                                        {
                                            item.productDesc = " ";
                                        }
                                        var isProductAlreadyAdded = products.Any(s => s.CitrineProdId == item.CitrineProdId);
                                        if (!isProductAlreadyAdded)
                                        {
                                            if (item.Availability_Status.ToString().ToLower() == "no")
                                                item.AvailabilityStatusBool = false;
                                            else
                                                item.AvailabilityStatusBool = true;
                                            Products.Add(item);
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                        var temp = e.Message;
                                    }
                                }
                                await Task.Delay(2000);
                            }
                        }
                        catch { }
                    }
                    //isBusy = true;
                    //isBusy = false;
                }
                catch (Exception e)
                {

                }
                finally
                {
                    IsLoading = false;
                }
            }
            else
            {
                DependencyService.Get<IToastMessage>().LongTime("No Internet Connection");
                IsLoading = false;
            }
        }
 /// <summary>Returns an enumerator that iterates through the resources in this response.</summary>
 public scg::IEnumerator <Product> GetEnumerator() => Products.GetEnumerator();
Exemplo n.º 45
0
 public void AddItem(Product product)
 {
     Products.Add(product);
 }
Exemplo n.º 46
0
        public async void GetProducts()
        {
            var data = await App.ProdManager.GetTasksAsync();

            data.ForEach(d => Products.Add(d));
        }
Exemplo n.º 47
0
 public Product GetProduct(int productId)
 {
     return(Products.FirstOrDefault(p => p.Id == productId));
 }
Exemplo n.º 48
0
 /// <summary>
 /// Convert <see cref="Products"/> to <see cref="ProductData"/> value.
 /// </summary>
 /// <param name="product"><see cref="Products"/> value.</param>
 /// <returns><see cref="ProductData"/> value.</returns>
 public static ProductData FromEnum(this Products product)
 {
     return(_productsMapping[product]);
 }
Exemplo n.º 49
0
        private dynamic GetAssortment(dynamic parameters)
        {
            var productService = new Products();

            return(null);
        }