コード例 #1
0
ファイル: MatSelect.g.i.cs プロジェクト: WoodA7/Stakpolaket
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MaterChoice = ((Steclopaket.MatSelect)(target));

            #line 8 "..\..\MatSelect.xaml"
                this.MaterChoice.Loaded += new System.Windows.RoutedEventHandler(this.MaterChoice_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.lbMaterSelect = ((System.Windows.Controls.ListBox)(target));
                return;

            case 3:
                this.label = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.tbQty = ((System.Windows.Controls.TextBox)(target));

            #line 12 "..\..\MatSelect.xaml"
                this.tbQty.PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(this.tbQty_PreviewTextInput);

            #line default
            #line hidden
                return;

            case 5:
                this.btnOk = ((System.Windows.Controls.Button)(target));

            #line 13 "..\..\MatSelect.xaml"
                this.btnOk.Click += new System.Windows.RoutedEventHandler(this.btnOk_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.tbnCancel = ((System.Windows.Controls.Button)(target));

            #line 14 "..\..\MatSelect.xaml"
                this.tbnCancel.Click += new System.Windows.RoutedEventHandler(this.tbnCancel_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
コード例 #2
0
ファイル: NewProduct.xaml.cs プロジェクト: WoodA7/Stakpolaket
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (tbProdName.Text.Length <= 0)
            {
                MessageBox.Show("Enter name first!");
                return;
            }
            var res = from p in DbContext.Products
                      where p.Name == tbProdName.Text
                      select p.Name;

            if (res.Any())
            {
                return;
            }

            var mc = new MatSelect();

            if (mc.ShowDialog() == false)
            {
                return;
            }

            var    sel_name = mc.lbMaterSelect.SelectedValue.ToString();
            double mat_qty;

            if (!double.TryParse(mc.tbQty.Text, out mat_qty))
            {
                return;
            }
            mc.Close();

            var mat = (from m in DbContext.Materials
                       where m.Name == sel_name
                       select m.Id).First();

            var productMult = new ProductMult
            {
                Id        = Guid.NewGuid(),
                Mater_Id  = mat,
                Mater_Qty = mat_qty
            };

            DbContext.ProductMults.InsertOnSubmit(productMult);
            DbContext.SubmitChanges();

            UpdDataGrid();
        }