Пример #1
0
        private IList <PaymentResult> GetResultFromDataGrid()
        {
            if (ProductDataGridView.Rows.Count.Equals(0))
            {
                return(null);
            }

            IList <PaymentResult> resultsList = new List <PaymentResult>();

            foreach (DataGridViewRow r in ProductDataGridView.Rows)
            {
                var result = PaymentResult.CreateResult();
                result.PaymentId     = r.Cells["id_pago"].Value.ToString();
                result.SalesDate     = DateTime.Parse(r.Cells["Fecha venta"].Value.ToString());
                result.Quantity      = int.Parse(r.Cells["Cantidad"].Value.ToString());
                result.ProductName   = r.Cells["Producto"].Value.ToString();
                result.UnitPrice     = float.Parse(r.Cells["Valor unitario"].Value.ToString());
                result.ProductPrice  = float.Parse(r.Cells["Valor productos"].Value.ToString());
                result.ClientId      = r.Cells["id_cliente"].Value.ToString();
                result.ProducerName  = r.Cells["Productor"].Value.ToString();
                result.ProducerEmail = r.Cells["email"].Value.ToString();

                resultsList.Add(result);
            }
            return(resultsList);
        }