Пример #1
0
        private Articoli CreateArtTest()
        {
            var Articolo = new Articoli()
            {
                CodArt        = "124ProvaIns",
                Descrizione   = "Articolo Test Inserimento",
                Um            = "PZ",
                CodStat       = "TESTART",
                PzCart        = 6,
                PesoNetto     = 1.750,
                IdIva         = 10,
                IdFamAss      = 1,
                IdStatoArt    = "1",
                DataCreazione = DateTime.Today
            };

            //Creazione Barcode
            List <Ean> Barcodes = new List <Ean>();
            var        Barcode  = new Ean {
                CodArt = "124ProvaIns", Barcode = "85698742", IdTipoArt = "CP"
            };

            Barcodes.Add(Barcode);

            //Passiamo il Barcode all'Articolo
            Articolo.Barcode = Barcodes;

            return(Articolo);
        }
Пример #2
0
        public void Encode_InvalidContentLength_ShouldThrowException()
        {
            Action action = () => Ean.Encode("123");

            action.Should().Throw <InvalidOperationException>()
            .WithMessage("Invalid content length. Should be 7 or 12 if the code does not include a checksum, 8 or 8 if the code already includes a checksum");
        }
Пример #3
0
        public void Encode_InvalidCode_ShouldThrowException()
        {
            Action action = () => Ean.Encode("invalid");

            action.Should().Throw <InvalidOperationException>()
            .WithMessage("Can only encode numerical digits (0-9)");
        }
Пример #4
0
        private void ShearchEan(string s_EAN)
        {
            try
            {
                for (int i = 0; i < DataGridSQL.Items.Count; i++)
                {
                    DataGridRow row = (DataGridRow)DataGridSQL.ItemContainerGenerator.ContainerFromIndex(i);

                    TextBlock cellContent = DataGridSQL.Columns[8].GetCellContent(row) as TextBlock;

                    if (cellContent != null && cellContent.Text.Equals(s_EAN))
                    {
                        object item = DataGridSQL.Items[i];
                        //DataGridSQL.SelectedItem = item;
                        DataGridSQL.ScrollIntoView(item);


                        row.Background = System.Windows.Media.Brushes.Pink;
                        row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
                        Ean.Focus();
                        break;
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
Пример #5
0
        public void Encode_InvalidChecksum_ShouldThrowException()
        {
            Action action = () => Ean.Encode("55123458");

            action.Should().Throw <InvalidOperationException>()
            .WithMessage("Checksum mismatch");
        }
 private void OnKeyDownHandler(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         operationSelect();
         Ean.Text = "";
         Ean.Focus();
     }
 }
Пример #7
0
        private void TextBox_Catalog_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.SystemKey == Key.F10)
            {
                AddNewLocation();
                Ean.Text = "";
                Ean.Focus();
            }

            if (e.Key == Key.Enter)
            {
                Ean.Text = "";
                Ean.Focus();
            }
        }
        private void Image_JPG_MouseDown(object sender, MouseButtonEventArgs e)
        {
            BitmapImage bitmap      = new BitmapImage();
            DataRowView dataRowView = (DataRowView)((Image)e.Source).DataContext;
            string      s_IndexRow  = dataRowView[8].ToString();

            if (s_IndexRow != "")
            {
                bitmap = new BitmapImage(new Uri(s_IndexRow));
            }

            Window_Image window_Image = new Window_Image(bitmap);

            window_Image.ShowDialog();

            Ean.Focus();
        }
Пример #9
0
        private void Button_Shearch_Click(object sender, RoutedEventArgs e)
        {
            Window_SelectionList window_SelectionList = new Window_SelectionList();

            window_SelectionList.ShowDialog();

            string s_xml = Clipboard.GetText();

            Clipboard.Clear();

            if (s_xml.Contains(".xml"))
            {
                DataGridSQL.ItemsSource = (responseFromService.m_GetSelectOrder(s_xml).DefaultView);
            }

            Ean.Text = "";
            Ean.Focus();
        }
Пример #10
0
        private void CheckBox_Grid_Click(object sender, RoutedEventArgs e)
        {
            DataRowView dataRowView = (DataRowView)((CheckBox)e.Source).DataContext;
            CheckBox    checkBox    = (CheckBox)e.Source;
            bool        isChecked   = checkBox.IsChecked ?? false;

            if (TableCatalogEmpty == null)
            {
                TableCatalogEmpty = new string[DataGridSQL.Items.Count];
            }
            //Check list
            if (isChecked == true)
            {
                foreach (string g in TableCatalogEmpty)
                {
                    if (g == dataRowView[1].ToString())
                    {
                        return;
                    }
                }

                for (int i = 0; i < TableCatalogEmpty.Length; i++)
                {
                    if (TableCatalogEmpty[i] == null || TableCatalogEmpty[i] == "")
                    {
                        TableCatalogEmpty[i] = dataRowView[1].ToString();
                        return;
                    }
                }
            }
            else //Delete record if exixis on list checked
            {
                for (int i = 0; i < TableCatalogEmpty.Length; i++)
                {
                    if (TableCatalogEmpty[i] == dataRowView[1].ToString())
                    {
                        TableCatalogEmpty[i] = "";
                        return;
                    }
                }
            }
            Ean.Text = "";
            Ean.Focus();
        }
        private void button_Picture_Click(object sender, RoutedEventArgs e)
        {
            if (TableCatalogEmpty == null)
            {
                MessageBox.Show("Błąd, Dodaj produkty do listy...");
                return;
            }

            if (c_responseFromService.m_BadPicture(TableCatalogEmpty, 0))
            {
                MessageBox.Show("OK!!", "Operacja zakończona z sukcesem.");
            }
            else
            {
                MessageBox.Show("Błąd", "Wystąpił pewien błąd...");
            }

            Ean.Focus();
        }
Пример #12
0
        public void Encode(string testCode, string testResult, string kind, bool checkContent)
        {
            IBarcodeIntCS code = Ean.Encode(testCode);

            if (checkContent)
            {
                code.Content.Should().Be(testCode);
            }

            code.Bounds.X.Should().Be(testResult.Length);
            code.Bounds.Y.Should().Be(1);
            code.Metadata.CodeKind.Should().Be(kind);
            code.Metadata.Dimensions.Should().Be(1);

            string encoded = string.Empty;
            int    i       = 0;

            foreach (var r in testResult)
            {
                encoded += code.At(i++, 0) ? "1" : "0";
            }
            encoded.Should().Be(testResult);
        }
Пример #13
0
        private void Ean_KeyDown(object sender, KeyEventArgs e)
        {
            //if (e.Key == Key.Enter)
            //{
            //    if (Ean.Text.Length == 13 & Ean.IsFocused)
            //    {
            //        ShearchEan(Ean.Text);
            //        Ean.Text = "";
            //    }
            //    else Ean.Text = "";
            //}

            if (e.Key == Key.Enter)
            {
                if (Ean.IsFocused)
                {
                    ShearchEan(Ean.Text);
                }


                Ean.Text = "";
                Ean.Focus();
            }
        }
Пример #14
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Ean != null)
         {
             hashCode = hashCode * 59 + Ean.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Streams != null)
         {
             hashCode = hashCode * 59 + Streams.GetHashCode();
         }
         if (LevelSubjects != null)
         {
             hashCode = hashCode * 59 + LevelSubjects.GetHashCode();
         }
         if (Models != null)
         {
             hashCode = hashCode * 59 + Models.GetHashCode();
         }
         if (TrialAccessUrl != null)
         {
             hashCode = hashCode * 59 + TrialAccessUrl.GetHashCode();
         }
         if (DefaultAccessUrl != null)
         {
             hashCode = hashCode * 59 + DefaultAccessUrl.GetHashCode();
         }
         if (ShortDescription != null)
         {
             hashCode = hashCode * 59 + ShortDescription.GetHashCode();
         }
         if (LongDescription != null)
         {
             hashCode = hashCode * 59 + LongDescription.GetHashCode();
         }
         if (Media != null)
         {
             hashCode = hashCode * 59 + Media.GetHashCode();
         }
         if (RelatedProducts != null)
         {
             hashCode = hashCode * 59 + RelatedProducts.GetHashCode();
         }
         if (BundledProducts != null)
         {
             hashCode = hashCode * 59 + BundledProducts.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #15
0
        /// <summary>
        /// Returns true if Product instances are equal
        /// </summary>
        /// <param name="other">Instance of Product to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Product other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Ean == other.Ean ||
                     Ean != null &&
                     Ean.Equals(other.Ean)
                     ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Streams == other.Streams ||
                     Streams != null &&
                     Streams.SequenceEqual(other.Streams)
                 ) &&
                 (
                     LevelSubjects == other.LevelSubjects ||
                     LevelSubjects != null &&
                     LevelSubjects.SequenceEqual(other.LevelSubjects)
                 ) &&
                 (
                     Models == other.Models ||
                     Models != null &&
                     Models.SequenceEqual(other.Models)
                 ) &&
                 (
                     TrialAccessUrl == other.TrialAccessUrl ||
                     TrialAccessUrl != null &&
                     TrialAccessUrl.Equals(other.TrialAccessUrl)
                 ) &&
                 (
                     DefaultAccessUrl == other.DefaultAccessUrl ||
                     DefaultAccessUrl != null &&
                     DefaultAccessUrl.Equals(other.DefaultAccessUrl)
                 ) &&
                 (
                     ShortDescription == other.ShortDescription ||
                     ShortDescription != null &&
                     ShortDescription.Equals(other.ShortDescription)
                 ) &&
                 (
                     LongDescription == other.LongDescription ||
                     LongDescription != null &&
                     LongDescription.Equals(other.LongDescription)
                 ) &&
                 (
                     Media == other.Media ||
                     Media != null &&
                     Media.Equals(other.Media)
                 ) &&
                 (
                     RelatedProducts == other.RelatedProducts ||
                     RelatedProducts != null &&
                     RelatedProducts.SequenceEqual(other.RelatedProducts)
                 ) &&
                 (
                     BundledProducts == other.BundledProducts ||
                     BundledProducts != null &&
                     BundledProducts.SequenceEqual(other.BundledProducts)
                 ));
        }
Пример #16
0
        /// <summary>
        /// Returns true if Item instances are equal
        /// </summary>
        /// <param name="other">Instance of Item to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Item other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Upc == other.Upc ||
                     Upc != null &&
                     Upc.Equals(other.Upc)
                     ) &&
                 (
                     Ean == other.Ean ||
                     Ean != null &&
                     Ean.Equals(other.Ean)
                 ) &&
                 (
                     Isbn == other.Isbn ||
                     Isbn != null &&
                     Isbn.Equals(other.Isbn)
                 ) &&
                 (
                     Asin == other.Asin ||
                     Asin != null &&
                     Asin.Equals(other.Asin)
                 ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Sku == other.Sku ||
                     Sku != null &&
                     Sku.Equals(other.Sku)
                 ) &&
                 (
                     Mpn == other.Mpn ||
                     Mpn != null &&
                     Mpn.Equals(other.Mpn)
                 ) &&
                 (
                     PartNumber == other.PartNumber ||
                     PartNumber != null &&
                     PartNumber.Equals(other.PartNumber)
                 ) &&
                 (
                     Upcs == other.Upcs ||
                     Upcs != null &&
                     other.Upcs != null &&
                     Upcs.SequenceEqual(other.Upcs)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Brand == other.Brand ||
                     Brand != null &&
                     Brand.Equals(other.Brand)
                 ) &&
                 (
                     Manufacturer == other.Manufacturer ||
                     Manufacturer != null &&
                     Manufacturer.Equals(other.Manufacturer)
                 ) &&
                 (
                     Color == other.Color ||
                     Color != null &&
                     Color.Equals(other.Color)
                 ) &&
                 (
                     NewPrice == other.NewPrice ||

                     NewPrice.Equals(other.NewPrice)
                 ) &&
                 (
                     UsedPrice == other.UsedPrice ||

                     UsedPrice.Equals(other.UsedPrice)
                 ) &&
                 (
                     CurrencyCode == other.CurrencyCode ||
                     CurrencyCode != null &&
                     CurrencyCode.Equals(other.CurrencyCode)
                 ) &&
                 (
                     Url == other.Url ||
                     Url != null &&
                     Url.Equals(other.Url)
                 ) &&
                 (
                     Features == other.Features ||
                     Features != null &&
                     other.Features != null &&
                     Features.SequenceEqual(other.Features)
                 ) &&
                 (
                     Dimensions == other.Dimensions ||
                     Dimensions != null &&
                     other.Dimensions != null &&
                     Dimensions.SequenceEqual(other.Dimensions)
                 ) &&
                 (
                     Images == other.Images ||
                     Images != null &&
                     other.Images != null &&
                     Images.SequenceEqual(other.Images)
                 ) &&
                 (
                     MatchedItems == other.MatchedItems ||
                     MatchedItems != null &&
                     other.MatchedItems != null &&
                     MatchedItems.SequenceEqual(other.MatchedItems)
                 ) &&
                 (
                     IsoCountryCodes == other.IsoCountryCodes ||
                     IsoCountryCodes != null &&
                     other.IsoCountryCodes != null &&
                     IsoCountryCodes.SequenceEqual(other.IsoCountryCodes)
                 ) &&
                 (
                     CompanyName == other.CompanyName ||
                     CompanyName != null &&
                     CompanyName.Equals(other.CompanyName)
                 ) &&
                 (
                     CompanyAddress == other.CompanyAddress ||
                     CompanyAddress != null &&
                     CompanyAddress.Equals(other.CompanyAddress)
                 ) &&
                 (
                     Categories == other.Categories ||
                     Categories != null &&
                     other.Categories != null &&
                     Categories.SequenceEqual(other.Categories)
                 ) &&
                 (
                     CategoryHierarchies == other.CategoryHierarchies ||
                     CategoryHierarchies != null &&
                     other.CategoryHierarchies != null &&
                     CategoryHierarchies.SequenceEqual(other.CategoryHierarchies)
                 ));
        }
 private void Button_Shearch_Click(object sender, RoutedEventArgs e)
 {
     operationSelect();
     Ean.Focus();
 }
Пример #18
0
 public void Ean_Validos()
 {
     var a = new Ean(7790520017352);
     var b = new Ean(7792799000011);
 }
Пример #19
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Upc != null)
                {
                    hashCode = hashCode * 59 + Upc.GetHashCode();
                }
                if (Ean != null)
                {
                    hashCode = hashCode * 59 + Ean.GetHashCode();
                }
                if (Isbn != null)
                {
                    hashCode = hashCode * 59 + Isbn.GetHashCode();
                }
                if (Asin != null)
                {
                    hashCode = hashCode * 59 + Asin.GetHashCode();
                }
                if (Title != null)
                {
                    hashCode = hashCode * 59 + Title.GetHashCode();
                }
                if (Sku != null)
                {
                    hashCode = hashCode * 59 + Sku.GetHashCode();
                }
                if (Mpn != null)
                {
                    hashCode = hashCode * 59 + Mpn.GetHashCode();
                }
                if (PartNumber != null)
                {
                    hashCode = hashCode * 59 + PartNumber.GetHashCode();
                }
                if (Upcs != null)
                {
                    hashCode = hashCode * 59 + Upcs.GetHashCode();
                }
                if (Description != null)
                {
                    hashCode = hashCode * 59 + Description.GetHashCode();
                }
                if (Brand != null)
                {
                    hashCode = hashCode * 59 + Brand.GetHashCode();
                }
                if (Manufacturer != null)
                {
                    hashCode = hashCode * 59 + Manufacturer.GetHashCode();
                }
                if (Color != null)
                {
                    hashCode = hashCode * 59 + Color.GetHashCode();
                }

                hashCode = hashCode * 59 + NewPrice.GetHashCode();

                hashCode = hashCode * 59 + UsedPrice.GetHashCode();
                if (CurrencyCode != null)
                {
                    hashCode = hashCode * 59 + CurrencyCode.GetHashCode();
                }
                if (Url != null)
                {
                    hashCode = hashCode * 59 + Url.GetHashCode();
                }
                if (Features != null)
                {
                    hashCode = hashCode * 59 + Features.GetHashCode();
                }
                if (Dimensions != null)
                {
                    hashCode = hashCode * 59 + Dimensions.GetHashCode();
                }
                if (Images != null)
                {
                    hashCode = hashCode * 59 + Images.GetHashCode();
                }
                if (MatchedItems != null)
                {
                    hashCode = hashCode * 59 + MatchedItems.GetHashCode();
                }
                if (IsoCountryCodes != null)
                {
                    hashCode = hashCode * 59 + IsoCountryCodes.GetHashCode();
                }
                if (CompanyName != null)
                {
                    hashCode = hashCode * 59 + CompanyName.GetHashCode();
                }
                if (CompanyAddress != null)
                {
                    hashCode = hashCode * 59 + CompanyAddress.GetHashCode();
                }
                if (Categories != null)
                {
                    hashCode = hashCode * 59 + Categories.GetHashCode();
                }
                if (CategoryHierarchies != null)
                {
                    hashCode = hashCode * 59 + CategoryHierarchies.GetHashCode();
                }
                return(hashCode);
            }
        }