Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Load data from one form to another on a grid

$
0
0

good afternoon

Lords programmers

If someone can guide me please I am making a sale application for warehouse, with rod bar works that part when pistolear load the products on the grid ok

Search code product with bar code

Private void TxtCodeKeyBarras (object sender, KeyPressEventArgs e)
        {
            If (TxtCodigoBarras.Text.Length> 0)
            {
                If (e.KeyChar == Convert.ToChar (Keys.Return))
                {
                   DetailDentaDTO eDeta = new DetailDentaDTO ();
                    PRODUCT eProd = new PRODUCT ();
                    EProd = objProducto.GetByCodigoBarras (TxtCodigoBarras.Text);
                    If (eProd == null)
                    {
                        If (MessageBoxButton.Show ("Product does not exist, Do you want to add it?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            Form frm = this.MdiChildren.FirstOrDefault (x => x is FrmProducts);
                            If (frm! = Null)
                            {
                                Frm.BringToFront ();
                                Return;
                            }
                            Frm = new FrmProductos (idUsuario);
                            Frm.MdiParent = this.MdiParent;
                            Frm.Show ();
                        }
                        Return;
                    }
                    If (eProd.Stock <= 0)
                    {
                        MessageBox.Show ("Not enough stock to sell", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Return;
                    }
                    EDeta.Quantity = 1;

                    EDeta.CodigoBarras = eProd.CodigoBarras;
                    EDeta.FeedReg = DateTime.Now;
                    EDeta.IdDetalle = 0;
                    EDeta.IdProduct = eProd.IdProduct;
                    EDeta.IdVenta = 0;
                    EDeta.Import = eProd.Price * eDeta.Quantity;
                    EDeta.ProductName = ProductProductName;
                    EDeta.PorcentageIVA = Imposed. Tax rate;
                    EDeta.Price = eProd.Price;
                    Details.Add (eDeta);
                    //DgvDetalle.DataSource = null;
                    DgvDetalle.DataSource = Details;
                    TxtCodigoBarras.Clear ();
                    TxtCodigoBarras.Focus ();
                }
            }
        }



My problem is generated now example I have bulk products that are heavy on a digital scale these products weighs the seller example potatoes, lemons etc.

What the system should do now is to enter the price of the product weight example potato value kilo 1250

Then when I look for the code of the code code = 123 should appear the value 1250

I should show it in a kind of modal I type the price of the weight and give enter and load the data to the grid

Sales form

I have a table called measurement
Fields: measure, measure

I should have a query that brings me the data according to the code of the potato
And the united measure = kilogram

I need to sell bulk goods


Frm QuantityProduct

How to implement this form ie look for the code of the potato

That is for the unit kilogram

Then it should appear is form for me to enter the price of the weight of the pay

This is the product search code as you could add a new query to bring this form

Public PRODUCT GetByCodigoBarras (string Code)        {            DAL.IRepository repository = new Template.Repository ();            Try            {                Var product = repository.FindEntity <PRODUCT> (a => a.CodigoBarras == Code, "Venta_Details", "Shopping_Details", "Measure", "SubFamiliaProduct");                If (product! = Null)                {                    Product.IdFamilia = product.SubFamiliaProducto.IdFamilia;                    Var fami = new FamilyProduct ();                    Fami = repository.FindEntity <ProductProduct> (x => x.IdFamilia == product.SubfamilyProduct.IdFamily);                    Product.familyName = familyfamilyName;                    Product.MeasureName = product.Measure.Measure1;                    Product.SubfamilyName = product.SubfamilyProduct.SubfamilyName;                }                Else                {                    Product = null;                }                Return product;            }            Catch (Exception ex)            {                Throw new Exception (ex.Message);            }        }


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>