Beispiel #1
0
 public void GetInfo(ref string name, ref ProductType type, ref ProductLabel label, ref int price)
 {
     name  = this.name;
     type  = this.type;
     label = this.label;
     price = this.price;
 }
        void ReleaseDesignerOutlets()
        {
            if (NameProdLabel != null)
            {
                NameProdLabel.Dispose();
                NameProdLabel = null;
            }

            if (ProductLabel != null)
            {
                ProductLabel.Dispose();
                ProductLabel = null;
            }

            if (TotalLabel != null)
            {
                TotalLabel.Dispose();
                TotalLabel = null;
            }

            if (UsersLabel != null)
            {
                UsersLabel.Dispose();
                UsersLabel = null;
            }
        }
Beispiel #3
0
 public void SetInfo(string name, ProductType type, ProductLabel label, int price)
 {
     this.name  = name;
     this.type  = type;
     this.label = label;
     this.price = price;
 }
Beispiel #4
0
 public void getInfo(out string name, out ProductType type, out ProductLabel label, out int price)
 {
     name  = this.name;
     type  = this.type;
     label = this.label;
     price = this.price;
 }
        /// <summary>
        /// 新标签列表【2014-3-19新建的】
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <param name="nodeName"></param>
        /// <returns></returns>
        private List <ProductLabel> GetLabelListNew(XmlDocument xmlDoc, string nodeName)
        {
            List <ProductLabel> labList  = new List <ProductLabel>();
            XmlNodeList         nodeList = GetNodeList(xmlDoc, "result/facets/facet[@name='" + nodeName + "']/item");

            if (nodeList != null && nodeList.Count > 0)
            {
                ProductLabel lab;
                foreach (XmlNode node in nodeList)
                {
                    string[] columns = node.Attributes["name"].Value.Split('|');
                    if (columns != null && columns.Length > 0)
                    {
                        lab = new ProductLabel
                        {
                            ParentNo   = columns[0],
                            ParentName = columns[1],
                            LabelNo    = columns[2],
                            LabelName  = columns[3]
                        };
                        labList.Add(lab);
                    }
                }
            }

            return(labList);
        }
Beispiel #6
0
        /// <summary>
        /// 选择打印语言
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void krpbChange_Click(object sender, EventArgs e)
        {
            List <ProductLabel> models = new List <ProductLabel>();
            string productName         = "";
            string barcodeNo           = product.Barcode;

            if (krpcLanguage.SelectedIndex == 0)
            {
                productName = product.ProductName0;
            }
            else if (krpcLanguage.SelectedIndex == 1)
            {
                productName = product.ProductName1;
            }
            else if (krpcLanguage.SelectedIndex == 2)
            {
                productName = product.ProductName2;
            }


            for (int i = 0; i < krpcCount.Value; i++)
            {
                ProductLabel model = new ProductLabel();
                model.BarcodeNo   = barcodeNo;
                model.Price       = product.Price;
                model.ProductName = productName;

                models.Add(model);
            }


            Res.Tools.Print.Instance.PrintBarcode(models, krpcSize.SelectedIndex, krpcLanguage.SelectedIndex);

            Resources.GetRes().DefaultPrintLang        = krpcLanguage.SelectedIndex;
            Resources.GetRes().DefaultBarcodePrintSize = krpcSize.SelectedIndex;
            DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
Beispiel #7
0
        public ProductLabel getMostExpensiveSeller(ProductType type)
        {
            double averagePriceApple = 0, averagePriceAsus = 0, averagePriceMicrosoft = 0, averagePriceDell = 0;
            int    countApple = 0, countAsus = 0, countDell = 0, countMicrosoft = 0;

            foreach (Store store in stores)
            {
                foreach (Product product in store.getProducts())
                {
                    if (product.GetType().Equals(type))
                    {
                        if (product.getValue("label").Equals(ProductLabel.Apple))
                        {
                            averagePriceApple += (int)product.getValue("price");
                            countApple++;
                        }
                        if (product.getValue("label").Equals(ProductLabel.Apple))
                        {
                            averagePriceAsus += (int)product.getValue("price");
                            countAsus++;
                        }
                        if (product.getValue("label").Equals(ProductLabel.Dell))
                        {
                            averagePriceDell += (int)product.getValue("price");
                            countDell++;
                        }
                        if (product.getValue("label").Equals(ProductLabel.Microsoft))
                        {
                            averagePriceMicrosoft += (int)product.getValue("price");
                            countMicrosoft++;
                        }
                    }
                }
            }

            if (countApple > 0)
            {
                averagePriceApple /= countApple;
            }
            if (countAsus > 0)
            {
                averagePriceAsus /= countAsus;
            }
            if (countDell > 0)
            {
                averagePriceDell /= countDell;
            }
            if (countMicrosoft > 0)
            {
                averagePriceMicrosoft /= countMicrosoft;
            }

            double       maxPrice = averagePriceApple;
            ProductLabel winner   = ProductLabel.Apple;

            if (averagePriceAsus > maxPrice)
            {
                maxPrice = averagePriceAsus;
                winner   = ProductLabel.Asus;
            }
            if (averagePriceDell > maxPrice)
            {
                maxPrice = averagePriceDell;
                winner   = ProductLabel.Dell;
            }
            if (averagePriceMicrosoft > maxPrice)
            {
                maxPrice = averagePriceMicrosoft;
                winner   = ProductLabel.Microsoft;
            }

            return(winner);
        }
Beispiel #8
0
 /// <summary>
 /// Sets the current questions labels.
 /// </summary>
 /// <param name="varlabel"></param>
 /// <param name="domain"></param>
 /// <param name="topic"></param>
 /// <param name="content"></param>
 /// <param name="product"></param>
 public void SetLabels(string varlabel, DomainLabel domain, TopicLabel topic, ContentLabel content, ProductLabel product)
 {
     CurrentQuestion.VarName.VarLabel = varlabel;
     CurrentQuestion.VarName.Domain   = domain;
     CurrentQuestion.VarName.Topic    = topic;
     CurrentQuestion.VarName.Content  = content;
     CurrentQuestion.VarName.Product  = product;
 }