Ejemplo n.º 1
0
        public frmHienThiCheckPrice(CheckPrice objcheck)
        {
            InitializeComponent();
            objcheckprice = objcheck;
            MemoryStream fs1 = new MemoryStream(objcheck.CameraImage, true);

            if (fs1.Length != 1)
            {
                pictureEdit1.Image = Image.FromStream(fs1);
                pictureEdit1.Refresh();
            }
            MemoryStream fs2 = new MemoryStream(objcheck.Signature, true);

            if (fs2.Length != 1)
            {
                pictureEdit2.Image = Image.FromStream(fs2);
                pictureEdit2.Refresh();
            }
            txtIP.Text      = objcheck.IP_Address;
            txtSeriNum.Text = objcheck.SeriNum;
            txtBarcode.Text = objcheck.BarcodeNew;
            txtName.Text    = objcheck.NameNew;
            txtUnit.Text    = objcheck.UnitNew;
            txtPrice.Text   = objcheck.SalePriceNew.ToString();
        }
Ejemplo n.º 2
0
        private void AssignTexboxesProshop(string rawHtml)
        {
            var pScraper = new ProshopScraper();

            if (pScraper.FetchProshopTitle(rawHtml) != string.Empty ||
                pScraper.FetchProshopPNumber(rawHtml) != string.Empty ||
                pScraper.FetchProshopPrice(rawHtml) != string.Empty ||
                pScraper.FetchProshopStockStatus(rawHtml) != string.Empty)
            {
                try
                {
                    _addedProduct.pPrice = CheckPrice.CheckPriceFormat(pScraper.FetchProshopPrice(rawHtml));
                }
                catch (FormatException)
                {
                    MessageBox.Show("Please provide a price containing only numbers and a single dot.",
                                    "Price contains letters.",
                                    MessageBoxButton.OK, MessageBoxImage.Warning);
                    _addedProduct.pPrice = 0.00;
                }
                catch (OverflowException)
                {
                    MessageBox.Show("The price is too high.", "Price too high.",
                                    MessageBoxButton.OK, MessageBoxImage.Warning);
                    _addedProduct.pPrice = 0.00;
                }
                catch (PriceTooLongException)
                {
                    MessageBox.Show("The price is too long.", "Price too long.",
                                    MessageBoxButton.OK, MessageBoxImage.Warning);
                    _addedProduct.pPrice = 0.00;
                }
                catch (PriceContainsCommaException)
                {
                    MessageBox.Show("Please use a dot instead of comma in the product price.", "Price contains comma.",
                                    MessageBoxButton.OK, MessageBoxImage.Warning);
                    _addedProduct.pPrice = 0.00;
                }
                _addedProduct.pName   = pScraper.FetchProshopTitle(rawHtml);
                _addedProduct.pNumber = pScraper.FetchProshopPNumber(rawHtml);

                _addedProduct.PStockStatus = pScraper.FetchProshopStockStatus(rawHtml);
                _addedProduct.pType        =
                    (Product.ProductType)
                    Enum.Parse(typeof(Product.ProductType),
                               pScraper.ProshopPTypeMapping(pScraper.FetchProshopPType(AddProductUrlTextBox.Text)));
            }
            else
            {
                MessageBox.Show("No product found at the given URL.");
            }
        }
Ejemplo n.º 3
0
 private bool SaveData()
 {
     try
     {
         _choosenProduct.pPrice = CheckPrice.CheckPriceFormat(PPriceTxtBox.Text);
     }
     catch (FormatException)
     {
         MessageBox.Show("Please provide a price containing only numbers and a single dot.",
                         "Price contains letters.",
                         MessageBoxButton.OK, MessageBoxImage.Warning);
         return(false);
     }
     catch (OverflowException)
     {
         MessageBox.Show("The price is too high.", "Price too high.",
                         MessageBoxButton.OK, MessageBoxImage.Warning);
         return(false);
     }
     catch (PriceTooLongException)
     {
         MessageBox.Show("The price is too long.", "Price too long.",
                         MessageBoxButton.OK, MessageBoxImage.Warning);
         return(false);
     }
     catch (PriceContainsCommaException)
     {
         MessageBox.Show("Please use a dot instead of comma in the product price.", "Price contains comma.",
                         MessageBoxButton.OK, MessageBoxImage.Warning);
         return(false);
     }
     _choosenProduct.pName        = PNameTxtBox.Text;
     _choosenProduct.PUrl         = PUrlTxtBox.Text;
     _choosenProduct.pNumber      = PNumberTxtBox.Text;
     _choosenProduct.pType        = (Product.ProductType)PTypeCombobox.SelectedItem;
     _choosenProduct.PStockStatus = PStockStatus.Text;
     return(true);
 }
Ejemplo n.º 4
0
        private List <CheckPrice> MapCheckPrice(DataTable dt)
        {
            List <CheckPrice> rs = new List <CheckPrice>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                CheckPrice obj = new CheckPrice();
                if (dt.Columns.Contains("STT"))
                {
                    obj.STT = long.Parse(dt.Rows[i]["STT"].ToString());
                }
                if (dt.Columns.Contains("IP_Address"))
                {
                    obj.IP_Address = (dt.Rows[i]["IP_Address"].ToString());
                }
                if (dt.Columns.Contains("SeriNum"))
                {
                    obj.SeriNum = (dt.Rows[i]["SeriNum"].ToString());
                }
                if (dt.Columns.Contains("Location"))
                {
                    obj.Location = dt.Rows[i]["Location"].ToString();
                }
                if (dt.Columns.Contains("Barcode"))
                {
                    obj.Barcode = (dt.Rows[i]["Barcode"].ToString());
                }
                if (dt.Columns.Contains("AXcode"))
                {
                    obj.AXcode = (dt.Rows[i]["AXcode"].ToString());
                }
                if (dt.Columns.Contains("Name"))
                {
                    obj.Name = (dt.Rows[i]["Name"].ToString());
                }
                if (dt.Columns.Contains("Unit"))
                {
                    obj.Unit = (dt.Rows[i]["Unit"].ToString());
                }
                if (dt.Columns.Contains("SalePrice"))
                {
                    obj.SalePrice = double.Parse(dt.Rows[i]["SalePrice"].ToString());
                }
                if (dt.Columns.Contains("BarcodeNew"))
                {
                    obj.BarcodeNew = (dt.Rows[i]["BarcodeNew"].ToString());
                }
                if (dt.Columns.Contains("AXcodeNew"))
                {
                    obj.AXcodeNew = (dt.Rows[i]["AXcodeNew"].ToString());
                }
                if (dt.Columns.Contains("NameNew"))
                {
                    obj.NameNew = (dt.Rows[i]["NameNew"].ToString());
                }
                if (dt.Columns.Contains("UnitNew"))
                {
                    obj.UnitNew = (dt.Rows[i]["UnitNew"].ToString());
                }
                if (dt.Columns.Contains("SalePriceNew"))
                {
                    obj.SalePriceNew = double.Parse(dt.Rows[i]["SalePriceNew"].ToString());
                }
                if (dt.Columns.Contains("CameraImage"))
                {
                    obj.CameraImage = (byte[])(dt.Rows[i]["CameraImage"]);
                }
                if (dt.Columns.Contains("Signature"))
                {
                    obj.Signature = (byte[])(dt.Rows[i]["Signature"]);
                }
                if (dt.Columns.Contains("Sticknote"))
                {
                    obj.Sticknote = int.Parse(dt.Rows[i]["Sticknote"].ToString());
                }
                if (dt.Columns.Contains("Timerow"))
                {
                    obj.Timerow = DateTime.Parse(dt.Rows[i]["Timerow"].ToString());
                }
                rs.Add(obj);
            }
            return(rs);
        }