예제 #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();
            }
        }
예제 #4
0
		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);
 }