コード例 #1
0
        public void Archivo_SP()
        {
            var    Separacion        = "ç0";
            string CarpetaMetadata_S = Environment.CurrentDirectory;

            if (Directory.Exists(Path.Combine(CarpetaMetadata_S, "Metadata_SP")))
            {
                if (File.Exists(Path.Combine(CarpetaMetadata_S, "Metadata_SP", "Producto-Sucursal.txt")))
                {
                    FileStream   Archivo  = new FileStream((Path.Combine(CarpetaMetadata_S, "Metadata_SP", "Producto-Sucursal.txt")), FileMode.Open);
                    StreamReader reader   = new StreamReader(Archivo);
                    var          linea    = reader.ReadLine();
                    int          contador = 0;
                    while (linea != null)
                    {
                        linea = linea.Trim();
                        if (contador >= 3)
                        {
                            var Antiguo_Datos = new Precio_Sucursal();
                            if (linea.Length < 27)
                            {
                                break;
                            }
                            var Datos           = linea.Substring(27, linea.Length - 27);
                            var Datos_Separados = Datos.Split(Separacion);
                            for (int i = 0; i < Datos_Separados.Length - 1; i++)
                            {
                                Antiguo_Datos = new Precio_Sucursal()
                                {
                                    identificador = Convert.ToInt32(Datos_Separados[i]),
                                    ID_S          = Convert.ToInt32(Datos_Separados[i + 1]),
                                    ID_P          = Convert.ToInt32(Datos_Separados[i + 2]),
                                    cantidad      = Convert.ToInt32(Datos_Separados[i + 3])
                                };
                                Carga_Datos_PS.Enqueue(Antiguo_Datos);
                                i += 3;
                            }
                        }
                        linea = reader.ReadLine();
                        contador++;
                    }
                    Archivo.Close();
                }
            }
            string PathDebug = Environment.CurrentDirectory;

            if (File.Exists(Path.Combine(PathDebug, "Metadata_SP", "Producto-Sucursal.txt")))
            {
                File.Delete(Path.Combine(PathDebug, "Metadata_SP", "Producto-Sucursal.txt"));
            }
            while (Carga_Datos_PS.Count() != 0)
            {
                Estructuras.Bestrella_Producto_Sucursal_.Instance.Insertar(Carga_Datos_PS.Peek().ID_S, Carga_Datos_PS.Peek().ID_P, Carga_Datos_PS.Peek().cantidad);
                Carga_Datos_PS.Dequeue();
            }
        }
コード例 #2
0
        public Precio_Sucursal[] Auxiliar(int ID_S, int ID_P, int Cantida, Precio_Sucursal[] datos)
        {
            Precio_Sucursal[] Aux = new Precio_Sucursal[(valor) + 1];
            int entrada           = 0;

            foreach (var item in datos)
            {
                Aux[entrada] = item;
                entrada++;
            }
            Aux[entrada] = new Precio_Sucursal()
            {
                identificador = ID_S + ID_P,
                ID_S          = ID_S,
                ID_P          = ID_P,
                cantidad      = Cantida
            };
            Aux = Ordenar(Aux);
            return(Aux);
        }
コード例 #3
0
        public Precio_Sucursal Busqueda(int identificador)
        {
            Precio_Sucursal PS = raiz.Busqueda(identificador, grado);

            return(PS);
        }