static void Main(string[] args)
        {
            Persona p1 = new Persona("juan", "perez", 123456);
            PersonaExternaSellada p2 = new PersonaExternaSellada("juan", "perez", 12, Entidades.Externa.Sellada.ESexo.Masculino);
            copia p3 = new copia("lionel", "perez", 20, Entidades.Externa.ESexo.Masculino);

            Console.WriteLine(p1.ObternerInfo());
            Console.ReadLine();

            Console.WriteLine(p3.ObternerInfo());
            Console.ReadLine();

            Console.WriteLine(Extensora.ObtenerInfo(p2));
            Console.ReadLine();
        }
Beispiel #2
0
        private void ContentLoaded(object sender, RoutedEventArgs e)
        {
            var w = Window.GetWindow(this);

            if (w != null && w is CopyListViewDialog)
            {
                int id = ((CopyListViewDialog)w).getDBCopyId();

                copia c = DBManager.CopiasRepo.FindById(id);
                if (c != null)
                {
                    tbCodigo.Text       = "#" + c.codigo;
                    tbTipoPago.Text     = c.tipos_pago.nombre;
                    tbFecha.Text        = c.fecha.ToString();
                    tbMontoSystema.Text = "$" + c.monto_sistema.ToString();
                    tbMontoReal.Text    = "$" + c.monto_real.ToString();

                    foreach (registro_copias rc in DBManager.CopiasRepo.ListRegistros(id))
                    {
                        _listSeleccion.Items.Add("(" + rc.nombre_categoria + ") " + rc.titulo + ", [" + Math.Round(rc.Size, 2) + " GB], " + rc.destino_url);
                    }
                }
            }
        }
Beispiel #3
0
        /** COPIAR LISTA SELECCIONADA */
        private void BtnCopy_Click(object sender, RoutedEventArgs e)
        {
            string realValue = tbReal.Text.Replace(" ", "");

            while (realValue.StartsWith("0"))
            {
                realValue = realValue.Substring(1);
            }

            if (string.IsNullOrWhiteSpace(realValue) || double.Parse(realValue) <= 0)
            {
                AppMAnager.SetLabel_Error(lCostoReal, "Real:");
                AppMAnager.SetErrorTextBox(tbReal);
                MessageBox.Show("El costo real debe ser mayor que 0");
                return;
            }

            string destination = AppMAnager.showFolderBrowser("");

            if (Directory.Exists(destination))
            {
                string root      = Directory.GetDirectoryRoot(destination);
                long   freespace = new DriveInfo(root).AvailableFreeSpace;

                List <MediaFile_Basic_Info> mf_list = new List <MediaFile_Basic_Info>();
                MediaFile_Basic_Info        MFBI;
                foreach (StackPanel sp in _listSeleccion.Items)
                {
                    MFBI = (MediaFile_Basic_Info)sp.Tag;
                    mf_list.Add(MFBI);
                    //copySize += MFBI.getTotalSize();
                }

                if (freespace < listCopySize)
                {
                    double free = Math.Round(StorageConverter.Convert(Differential.ByteToGiga, freespace, StorageBase.BASE2), 2);
                    double need = Math.Round(StorageConverter.Convert(Differential.ByteToGiga, listCopySize, StorageBase.BASE2), 2);
                    MessageBox.Show("No hay espacio suficiente en el dispositivo seleccionado" + "\n" +
                                    "Necesario: " + need + "Gb       Disponible: " + free + "Gb");
                }
                else
                {
                    if (_copySplitter.Visibility == Visibility.Hidden)
                    {
                        _copysRow.Height         = new GridLength(100);
                        _copySplitter.Visibility = Visibility.Visible;
                    }

                    //  ProgressInfo pinfo = new ProgressInfo();
                    // int pos = _copysContainer.Children.Add(pinfo);  //Uso la posicion del componente para enlazarlo con el BackgroundMediaCopy
                    // pinfo.Tag = pos;

                    double montoReal = 0;
                    if (!string.IsNullOrEmpty(realValue))
                    {
                        montoReal = double.Parse(realValue);
                    }

                    copia c = new copia
                    {
                        user_id        = AppMAnager.CurrentUser().id,
                        punto_copia_id = AppMAnager.CurrentPuntoCopia().id,
                        codigo         = DBManager.CopiasRepo.NextSerie().ToString(),
                        tipo_pago_id   = tpagoId,
                        fecha          = DateTime.Now,
                        monto_sistema  = costoLista,
                        monto_real     = montoReal
                    };
                    copia the_copy = DBManager.CopiasRepo.Add(c);

                    if (the_copy != null)
                    {
                        BackgroundMediaFileCopy copier = new BackgroundMediaFileCopy(the_copy.id);
                        ProgressInfo            pinfo  = new ProgressInfo(copier);
                        _copysContainer.Children.Add(pinfo);
                        copier.StartCopyWorker(mf_list, destination, pinfo);
                        AppMAnager.RUNNING_COPYS_COUNT++;

                        //ClearPageSelection(true);
                        // AppMAnager.thread_copys.Add(pos, copier);

                        _listSeleccion.Items.Clear();
                        btnCopy.IsEnabled = false;

                        restartCostInfo();
                    }
                }
            }
        }