Exemple #1
0
 private void updateStock()
 {
     if (listBox1.SelectedIndex != -1 && listBox2.SelectedIndex != -1)
     {
         int           vid     = vendors.First(v => v.name == listBox1.Text).id;
         int           eid     = elements.First(v => v.name == listBox2.Text).id;
         VendorElement element = sql.GetVendorElement(vid, eid);
         textBox1.Text        = element.stock.ToString();
         numericUpDown2.Value = element.price;
         numericUpDown1.Value = 0;
     }
 }
Exemple #2
0
        /// <summary>
        /// Sets the vendor.
        /// </summary>
        /// <param name="vendor">The vendor.</param>
        /// <param name="stringComparison">The string comparison.</param>
        /// <returns></returns>
        /// <exception cref="NoSuchElementException"></exception>
        public virtual MappingComponent SetVendor(string vendor,
                                                  StringComparison stringComparison = StringComparison.Ordinal)
        {
            var index = VendorElement.Options.IndexOf(
                el => String.Equals(
                    el.TextHelper().InnerText,
                    vendor,
                    stringComparison));

            if (index == -1)
            {
                throw new NoSuchElementException();
            }

            VendorElement.SelectByIndex(index);

            return(this);
        }
Exemple #3
0
        /// <summary>
        /// Searches the specified order search model.
        /// </summary>
        /// <param name="orderSearchModel">The order search model.</param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public virtual IListPage Search(OrderSearchModel orderSearchModel)
        {
            StartDateComponent.SetValue(orderSearchModel.StartDate);
            EndDateComponent.SetValue(orderSearchModel.EndDate);
            ProductNameElement.SetValue(orderSearchModel.ProductName);
            OrderStatusesComponent.SelectOptions(orderSearchModel.OrderStatuses);
            PaymentStatusesComponent.SelectOptions(orderSearchModel.PaymentStatuses);
            ShippingStatusesComponent.SelectOptions(orderSearchModel.ShippingStatuses);

            if (!String.IsNullOrEmpty(orderSearchModel.StoreName))
            {
                var storeIndex = StoreElement.Options.IndexOf(
                    el => String.Equals(
                        el.TextHelper().InnerText,
                        orderSearchModel.StoreName,
                        StringComparison.Ordinal));

                if (storeIndex == -1)
                {
                    throw new NoSuchElementException();
                }

                StoreElement.SelectByIndex(storeIndex);
            }

            if (!String.IsNullOrEmpty(orderSearchModel.VendorName))
            {
                var vendorIndex = StoreElement.Options.IndexOf(
                    el => String.Equals(
                        el.TextHelper().InnerText,
                        orderSearchModel.VendorName,
                        StringComparison.Ordinal));

                if (vendorIndex == -1)
                {
                    throw new NoSuchElementException();
                }

                VendorElement.SelectByIndex(vendorIndex);
            }

            BillingPhoneNumberElement.SetValue(orderSearchModel.BillingPhone);
            BillingEmailAddressElement.SetValue(orderSearchModel.BillingEmail);
            BillingLastNameElement.SetValue(orderSearchModel.BillingLastName);

            if (!String.IsNullOrEmpty(orderSearchModel.BillingCountryName))
            {
                var billingCountryIndex = BillingCountryElement.Options.IndexOf(
                    el => String.Equals(
                        el.TextHelper().InnerText,
                        orderSearchModel.BillingCountryName,
                        StringComparison.Ordinal));

                if (billingCountryIndex == -1)
                {
                    throw new NoSuchElementException();
                }

                BillingCountryElement.SelectByIndex(billingCountryIndex);
            }

            if (!String.IsNullOrEmpty(orderSearchModel.PaymentMethodName))
            {
                var paymentMethodIndex = PaymentMethodElement.Options.IndexOf(
                    el => String.Equals(
                        el.TextHelper().InnerText,
                        orderSearchModel.PaymentMethodName,
                        StringComparison.Ordinal));

                if (paymentMethodIndex == -1)
                {
                    throw new NoSuchElementException();
                }

                PaymentMethodElement.SelectByIndex(paymentMethodIndex);
            }

            OrderNotesElement.SetValue(orderSearchModel.OrderNotes);

            return(this);
        }