示例#1
0
        private void btnAgregar_Click(object sender, RoutedEventArgs e)
        {
            int iAccion = cmbAccion.SelectedIndex;
            if (iAccion != 0)
            {
                if(txtDestino.Text == "")
                {
                    ITCMessageBox.Show((Window)this, "Debes pones la ruta destino!", "Error!");
                    txtDestino.Focus();
                }
                else
                {
                    if(lstArchivos.SelectedIndex == -1)
                    {
                        if (txtExplorar.Text == "")
                        {
                            ITCMessageBox.Show((Window)this, "Debes seleccionar un archivo o introducir una ruta!", "Error!");
                            txtDestino.Focus();
                        }
                        else
                        {
                            Archivo aTemp = new Archivo();
                            aTemp.option = iAccion - 1;
                            aTemp.sDestino = txtDestino.Text;
                            aTemp.sName = txtExplorar.Text;
                            aTemp.sShort = txtExplorar.Text;
                            lstAgregados.Items.Add(aTemp);
                            cmbAccion.SelectedIndex = 0;
                        }
                    }
                    else
                    {
                        int iIndex = lstArchivos.SelectedIndex;

                        Archivo aTemp = (Archivo)lstArchivos.Items.GetItemAt(iIndex);
                        lstArchivos.Items.RemoveAt(iIndex);
                        aTemp.option = iAccion-1;
                        aTemp.sDestino = txtDestino.Text;
                        lstAgregados.Items.Add(aTemp);
                        cmbAccion.SelectedIndex = 0;
                    }
                }
            }
            else
            {
                ITCMessageBox.Show((Window)this, "Debes seleccionar una accion!", "Error!");
                cmbAccion.Focus();
                cmbAccion.SelectedIndex = 0;
            }
        }
示例#2
0
        private void FillUpdateArchivo(string path)
        {
            try
            {
                string[] sArchivos = Directory.GetFiles(path);

                foreach (string sName in sArchivos)
                {
                    Archivo aAdd = new Archivo();
                    aAdd.sName = sName;
                    aAdd.sShort = sName.Substring(path.Length + 1);
                    aAdd.option = -1;
                    aAdd.sDestino = "";
                    lDirectorio.Add(aAdd);
                }
            }
            catch
            {
                txtExplorar.Text = string.Empty;
            }
        }
示例#3
0
 private void FillListArchivos()
 {
     lstArchivos.Items.Clear();
     if ((cmbDispo.SelectedIndex != 0)&&(cmbDispo.SelectedIndex != -1))
     {
         System.Data.Odbc.OdbcConnection myConn = new System.Data.Odbc.OdbcConnection();
         myConn.ConnectionString = ((Menu)this.Owner).sConexion;
         string myQuery = "SELECT ORDEN, NOMBRE, PATH_DESTINO, ACCION FROM HHc_ArchivosVersion Where CODIGO_AGENCIA = ? AND VERSION = ? AND  TIPO_DISPOSITIVO = ? ORDER BY ORDEN";
         OdbcCommand myOdbcCommand = new OdbcCommand(myQuery);
         myOdbcCommand.Connection = myConn;
         myOdbcCommand.Parameters.Add("CODIGO_AGENCIA", OdbcType.Int).Value = Int32.Parse((string)cmbAgencia.SelectedValue);
         myOdbcCommand.Parameters.Add("VERSION", OdbcType.VarChar).Value = (string)cmbVersion.SelectedValue;
         myOdbcCommand.Parameters.Add("TIPO_DISPOSITIVO", OdbcType.VarChar).Value = (string)cmbDispo.SelectedValue;
         myConn.Open();
         OdbcDataReader myReader = myOdbcCommand.ExecuteReader(CommandBehavior.CloseConnection);
         while (myReader.Read())
         {
             Archivo aTmp = new Archivo();
             aTmp.sShort = myReader.GetString(1);
             aTmp.sDestino = myReader.GetString(2);
             aTmp.option = myReader.GetInt32(3);
             lstArchivos.Items.Add(aTmp);
         }
         myConn.Close();
     }
 }