示例#1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            ProductForm productForm = new ProductForm();

            if (productForm.ShowDialog() == DialogResult.OK)
            {
                CRUDManager crudManager = new CRUDManager();
                crudManager.InsertRecord(DatabaseStrings.ProductTable, productForm.Product);
            }
            UpdateGrid();
        }
示例#2
0
文件: Form1.cs 项目: KoTuK3/CSharp
 private void ShowProductBtn_Click(object sender, EventArgs e)
 {
     if (ProductList.SelectedItem is Product)
     {
         Product     prod        = ProductList.SelectedItem as Product;
         ProductForm productForm = new ProductForm(prod);
         if (productForm.ShowDialog() == DialogResult.OK)
         {
             ;
         }
     }
 }
示例#3
0
        private void ButtonAddProductClick(object sender, EventArgs e)
        {
            var form = new ProductForm(new Product());

            if (form.ShowDialog() == DialogResult.OK)
            {
                AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoWork;
                AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoFilteringWork;
                AnimatedThreadWorker.DoWork += AnimatedThreadWorkerDoWork;

                AnimatedThreadWorker.RunWorkerAsync();
            }
        }
		protected override void RadGridView1_DoubleClick(object sender, EventArgs e)
		{
			if (SelectedItem != null)
			{
				var editForm = new ProductForm(SelectedItem.Product);
				if (editForm.ShowDialog() == DialogResult.OK)
				{
					var subs = GetListViewSubItems(SelectedItem);
					for (int i = 0; i < subs.Count; i++)
						radGridView1.SelectedRows[0].Cells[i].Value = subs[i].Text;
				}
			}
		}
示例#5
0
        private void Button2_Click(object sender, EventArgs e)
        {
            var form = new ProductForm(new Product());

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (textBoxPartNumber.Text != "")
                {
                    metroProgressSpinner1.Visible = true;
                    Task.Run(() => DoWork())
                    .ContinueWith(task => Complete(), TaskScheduler.FromCurrentSynchronizationContext());
                }
            }
        }
示例#6
0
 private void addnewProduct()
 {
         ProductForm pf = new ProductForm();
         pf.Title = "New Product for " + supplier.CompanyName;
         if (pf.ShowDialog().Value)
         {
             Product newProd = new Product();
             newProd.ProductName = pf.productName.Text;
             newProd.QuantityPerUnit = pf.quantityPerUnit.Text;
             newProd.UnitPrice = Decimal.Parse(pf.unitPrice.Text);
             this.supplier.Products.Add(newProd);
             this.productsInfo.Add(newProd);
             saveChanges.IsEnabled = true;
         }
 }
示例#7
0
        public void EditAction(ProductIdParameter parameter)
        {
            Product product = Products.GetInstance().GetProduct(parameter.Id);
            ProductDataParameters productParameters = new ProductDataParameters()
            {
                Id      = product.Id,
                Article = product.Article,
                Title   = product.Title,
                Price   = product.Price
            };

            ProductForm form = Application.OpenForms["ProductForm"] == null ? new ProductForm() : (ProductForm)Application.OpenForms["ProductForm"];

            form.productParameters = productParameters;
            form.ShowDialog();
        }
示例#8
0
        public void Update()
        {
            prodsAdapter.FillBy(prods, Node.Id);

            if (prods.Rows.Count != 1)
            {
                throw new Exception();
            }

            var         row  = prods.Rows[0];
            ProductForm form = new ProductForm(Convert.ToInt32(row[2]), Convert.ToInt32(row[3]));

            form.ShowDialog();

            int     product;
            int     copies;
            decimal cost;

            if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                product = form.Product;
                copies  = form.Copies;
                cost    = form.Cost;
            }
            else
            {
                return;
            }

            UpdateProdSales(Node.Id, product, copies, cost);

            prodShowAdapter.FillByPSaleId(prodShow, Node.Id);
            UpdateParentDeal(false);

            if (prodShow.Rows.Count != 1)
            {
                throw new Exception();
            }

            row       = prodShow.Rows[0];
            Node.Text = Convert.ToString(row[2]);
        }
示例#9
0
        public void Add()
        {
            ProductForm form = new ProductForm();

            form.ShowDialog();

            int     product;
            int     copies;
            decimal cost;

            if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                product = form.Product;
                copies  = form.Copies;
                cost    = form.Cost;
            }
            else
            {
                return;
            }

            int id = InsertIntoProdSales(Node.Id, product, copies, cost);

            prodShowAdapter.FillByPSaleId(prodShow, id);
            UpdateParentDeal(true);

            if (prodShow.Rows.Count != 1)
            {
                throw new Exception();
            }

            var        row     = prodShow.Rows[0];
            CustomNode newNode =
                new CustomNode(text: Convert.ToString(row[2]), type: CustomNode.PRODUCT, id: Convert.ToInt32(row[1]),
                               pId: Convert.ToInt32(row[0]));

            newNode.ContextMenu =
                new CustomMenu(new Controller().GetProductsMenuItems(), newNode);


            Node.Nodes.Add(newNode);
        }
示例#10
0
        private void product_Click(object sender, EventArgs e)
        {
            ProductForm productForm = new ProductForm();

            productForm.ShowDialog();
        }
示例#11
0
        private void newProductToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ProductForm frm = new ProductForm(new MasterProduct(), this);

            frm.ShowDialog();
        }
示例#12
0
        public override void EditSelectedItem()
        {
            ProductForm frm = new ProductForm(_selectedProId, MdiParentForm);

            frm.ShowDialog();
        }
示例#13
0
        private void ButtonAddProduct_Click(object sender, EventArgs e)
        {
            var form = new ProductForm(new Product());

            form.ShowDialog();
        }
示例#14
0
        private void editProduct(Product product)
        {
            ProductForm pf = new ProductForm();
            pf.Title = "Edit Product Details";
            pf.productName.Text = product.ProductName;
            pf.quantityPerUnit.Text = product.QuantityPerUnit;
            pf.unitPrice.Text = product.UnitPrice.ToString();

            if (pf.ShowDialog().Value)
            {
                product.ProductName = pf.productName.Text;
                product.QuantityPerUnit = pf.quantityPerUnit.Text;
                product.UnitPrice = Decimal.Parse(pf.unitPrice.Text);
                saveChanges.IsEnabled = true;
            }
        }
示例#15
0
 private void listControl1_DoubleClick(object sender, EventArgs e)
 {
     ProductInfo pi = SelectedProduct;
     if (pi == null) return;
     ProductForm form = new ProductForm(DataService.Instance.IsAdmin);
     form.InitialData(pi);
     form.ShowDialog(this);
 }