private void ugMaquinas_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
 {
     if (ugMaquinas.ActiveRow == null)
     {
         return;
     }
     ItemListaCostosMaquina = (ItemListaCostosMaquina)ugMaquinas.ActiveRow.Tag;
     MostrarUnidades(ItemListaCostosMaquina);
 }
        public void MostrarItem(UltraGridRow Row)
        {
            ItemListaCostosMaquina Item = (ItemListaCostosMaquina)Row.Tag;

            Row.Cells[colMaquina].Value          = (Item.Maquina != null)?Item.Maquina.Nombre:"";
            Row.Cells[colCostoPreparacion].Value = Item.CostoPreparacion;
            Row.Cells[colCostoProduccion].Value  = Item.CostoProduccion;
            MostrarUnidades(Item);
        }
 public void MostrarUnidades(ItemListaCostosMaquina ItemListaCostosMaquina)
 {
     base.ClearAllRows(ref ugUnidades);
     foreach (UnidadListaCostosMaquina Item in ItemListaCostosMaquina.Unidades)
     {
         UltraGridRow Row = ugUnidades.DisplayLayout.Bands[0].AddNew();
         Row.Tag = Item;
         MostrarUnidad(Row);
     }
 }
        private void ubNuevaMaquina_Click(object sender, EventArgs e)
        {
            FrmSelectedEntity FrmSeleccionar = new FrmSelectedEntity();
            Maquina           Maquina        = (Maquina)FrmSeleccionar.GetSelectedEntity(typeof(Maquina), "Máquina", ListaCostosMaquina.FiltroMaquinas);

            if (Maquina != null)
            {
                UltraGridRow Row = ugMaquinas.DisplayLayout.Bands[0].AddNew();
                Row.Tag = ListaCostosMaquina.AddItem(Maquina);
                ItemListaCostosMaquina = (ItemListaCostosMaquina)Row.Tag;
                MostrarItem(Row);
            }
        }
        private void ugMaquinas_CellChange(object sender, CellEventArgs e)
        {
            ItemListaCostosMaquina Item = (ItemListaCostosMaquina)e.Cell.Row.Tag;

            ugMaquinas.UpdateData();
            switch (e.Cell.Column.Key)
            {
            case colCostoPreparacion:
                Item.CostoPreparacion = Convert.ToDecimal((e.Cell.Value == DBNull.Value) ? 0 : e.Cell.Value);
                break;

            case colCostoProduccion:
                Item.CostoProduccion = Convert.ToDecimal((e.Cell.Value == DBNull.Value) ? 0 : e.Cell.Value);
                break;

            default:
                break;
            }
            MostrarItem(e.Cell.Row);
        }