Ejemplo n.º 1
0
        public string LeerTipoProductoPorID(string id)
        {
            TipoProducto tipo = new TipoProducto();

            tipo.Id = int.Parse(id);
            tipo.Read();
            return(tipo.Serializar());
        }
        private void CargarDatos()
        {
            if (IdProducto != null)
            {
                Producto prod = new Producto();
                prod.Id = IdProducto;
                string xml = prod.Serializar();
                xml = _servicio.LeerProducto(xml);
                if (xml != null)
                {
                    btnCrear.IsEnabled = false;
                    prod = new Producto(xml);
                    TipoProducto tp = new TipoProducto();
                    tp.Id = prod.IdTipoProducto;
                    xml   = tp.Serializar();
                    xml   = _servicio.LeerTipoProducto(xml);
                    if (xml != null)
                    {
                        tp = new TipoProducto(xml);
                        txtProducto.Text = prod.Nombre;
                        if (prod.FechaVencimiento != null)
                        {
                            dpFechaVenc.SelectedDate = prod.FechaVencimiento.Value;
                        }
                        txtStock.Text        = prod.Stock.ToString();
                        txtStockCritico.Text = prod.StockCritico.ToString();
                        txtPrecioCompra.Text = prod.PrecioCompra.ToString();
                        txtPrecioVenta.Text  = prod.PrecioVenta.ToString();
                        int val = 0;
                        for (int i = 0; i < cboFamiliaProducto.Items.Count; i++)
                        {
                            FamiliaProducto p = (FamiliaProducto)cboFamiliaProducto.Items[i];
                            if (p.Id == tp.FamiliaProducto.Id)
                            {
                                val = i;
                            }
                        }

                        cboFamiliaProducto.SelectedIndex = val;

                        for (int i = 0; i < cboTipoProducto.Items.Count; i++)
                        {
                            TipoProducto p = (TipoProducto)cboTipoProducto.Items[i];
                            if (p.Id == tp.Id)
                            {
                                val = i;
                            }
                        }


                        cboTipoProducto.SelectedIndex = val;
                        //cboFamiliaProducto.SelectedIndex = 0;
                        //cboTipoProducto.SelectedIndex = 0;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public string LeerTipoProducto(string xml)
        {
            TipoProducto tp = new TipoProducto(xml);

            if (tp.Read())
            {
                return(tp.Serializar());
            }
            else
            {
                return(null);
            }
        }