コード例 #1
0
        /// <summary>
        /// Termék gombok létrehozása és panelhez adása
        /// </summary>
        /// <param name="name">Név paraméter ha nem üres akkor ez alapján rendezve és szűrve kerülnek a gombok a panelre</param>
        /// <param name="barcode">Vonalkód paraméter ha nem üres akkor ez alapján kerülnek rendezve és szűrve a gombok a panelre</param>
        private void BuildProductButtonList(string name, string barcode)
        {
            var ProductList = Controller.GetProducts();

            if (name != "")
            {
                var Matches = from p in ProductList
                              where p.Name.StartsWith(name)
                              orderby p.Name
                              select p;
                ProductList = Matches.ToList();
            }

            if (barcode.Length > 0)
            {
                var Matches = from p in ProductList
                              where p.Barcode == barcode
                              orderby p.Name
                              select p;
                ProductList = Matches.ToList();
            }

            ProductBtnList.Children.Clear();
            foreach (var item in ProductList)
            {
                var PDC = new ProductDataContext();
                PDC.product = item;
                PDC.price   = item.Prices.Last();
                var btn = new DataBtn(PDC);
                btn.OnClickSelected += new EventHandler(ProductBtnClicked);
                ProductBtnList.Children.Add(btn);
            }
        }
コード例 #2
0
        /// <summary>
        /// Construktor és inicializálások
        /// </summary>
        public NewProduct()
        {
            InitializeComponent();


            Save.IsEnabled = false;

            DC         = new ProductDataContext();
            DC.product = new Product();
            DC.price   = new Price();

            MainGrid.DataContext = DC;

            timer           = new DispatcherTimer();
            timer.Interval  = TimeSpan.FromMilliseconds(30);
            timer.Tick     += new EventHandler(CheckData);
            timer.IsEnabled = true;


            SetComboBox();
        }
コード例 #3
0
        /// <summary>
        /// Név combobox selectionchanged eseménykezelője
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TBname_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((Product)ComboBoxName.SelectedItem != null)
            {
                var tmpDc = new ProductDataContext();
                tmpDc.product = ((Product)ComboBoxName.SelectedItem);

                var tmp = ((Product)ComboBoxName.SelectedItem).Prices;

                if (tmp.Count > 0)
                {
                    tmpDc.price = tmp.Last();
                }
                else
                {
                    tmpDc.price = new Price();
                }

                DC = tmpDc;
                MainGrid.DataContext = DC;
            }
        }
コード例 #4
0
        /// <summary>
        /// Mentés gomb eseménykezelője
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            Controller c = new Controller();

            if (ComboBoxName.SelectedItem == null)
            {
                DC.product.ProductId = 0;
                var tmp = c.AddOrUpdate(DC.product, DC.price);
                ComboBoxName.Items.Add(tmp);
            }
            else
            {
                var tmp = c.AddOrUpdate(DC.product, DC.price);
            }
            DC                   = new ProductDataContext();
            DC.product           = new Product();
            DC.price             = new Price();
            MainGrid.DataContext = DC;
            if (!Next.IsChecked.Value)
            {
                FinishedEntry();
            }
        }
コード例 #5
0
 public DataBtn(ProductDataContext productButtonDataContex)
 {
     InitializeComponent();
     this.productButtonDataContex    = productButtonDataContex;
     CustomProductButton.DataContext = productButtonDataContex;
 }